Update table using isset() shows nothing

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 2
Joined: Fri Jan 11, 2013 9:21 am

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

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" href="main.css" type="text/css">
    <body background="media/dark_blue_background-wallpaper-1920x1200.jpg">
        if ($_SESSION['uname']) {
            <div id="bus">
                <p><img src="media/rk_logo2.png" height="100" width="220"></p>
                    <li style="float: right; padding-right: 10px; font-family: sans-serif; font-weight: bold;">You are Logged in as, <?php echo "" . $_SESSION['uname'] . "!"; ?></li>
                <div id="menu">               
                        <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>                       
            $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());

                $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();

Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest