Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Update table using isset() shows nothing

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Update table using isset() shows nothing

Postby psonawane » Fri Jan 11, 2013 8:38 pm

Hi all I'm trying to update records from my table and i used isset() function which neither shows success message nor error. Where am I going wrong? Please suggest!!! Here's My CODE!!!! :yawn:

Code: Select all
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <link rel="stylesheet" href="main.css" type="text/css">
    </head>
    <body background="media/dark_blue_background-wallpaper-1920x1200.jpg">
    <center>
        <?php
        session_start();
        if ($_SESSION['uname']) {
            ?>   
            <div id="bus">
                <p><img src="media/rk_logo2.png" height="100" width="220"></p>
                <ul>
                    <li style="float: right; padding-right: 10px; font-family: sans-serif; font-weight: bold;">You are Logged in as, <?php echo "" . $_SESSION['uname'] . "!"; ?></li>
                </ul><br>
                <div id="menu">               
                    <ul>
                        <li><a href="add.php">Add Bus and Service</a></li>
                        <li><a href="edit.php">Change Bus and Service</a></li>
                        <li><a href="del.php">Delete Bus and Service</a></li>
                        <li><a href="show.php">View Bus and Service</a></li>                       
                    </ul>               
                </div>
                <?php
            }
            $host = "localhost";
            $uname = "root";
            $pass = "pranit";
            $db_name = "rk_bookings";
            $tbl_name = "bus_details";
            if (isset($_POST['update'])) {

                $rate = $_POST['rate'];
                $coname = $_POST['coname'];
                $dest = $_POST['destination'];

                mysql_connect("$host", "$uname", "$pass") or die(mysql_error());
                mysql_select_db($db_name);

                $sql1 = "UPDATE $tbl_name SET price='$rate' WHERE company='$coname' AND destination='$dest'";
                $result = mysql_query($sql1);
                if ($result) {
                    echo "Successful";
                } else {
                    echo mysql_error();
                }
            }
            ?>
            </body>
            </html>
psonawane
New php-forum User
New php-forum User
 
Posts: 2
Joined: Fri Jan 11, 2013 9:21 am

Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron