PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 11th, 2013, 10:48 PM
psonawane psonawane is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 2 psonawane User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 43 sec
Reputation Power: 0
Unhappy PHP-DB - Update table using isset() shows nothing

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!!!!

PHP Code:
<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> 

Reply With Quote
  #2  
Old January 11th, 2013, 11:14 PM
requinix's Avatar
requinix requinix is offline
Still alive
Dev Shed God 16th Plane (12500 - 12999 posts)
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,864 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 5 Days 5 h 56 m 54 sec
Reputation Power: 8977
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
If you take a look at your post you'll see all the code is on one line. That makes it hard for us to read. Please edit your post, select everything between the [php] tags, and paste your code again. Next time don't use the popup dialog to enter code: paste your code into the textbox, select it, and then click the code button.

Reply With Quote
  #3  
Old January 11th, 2013, 11:24 PM
psonawane psonawane is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 2 psonawane User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 43 sec
Reputation Power: 0
update table using isset() function shows nothing


Last edited by psonawane : January 11th, 2013 at 11:26 PM. Reason: Code was hard to read

Reply With Quote
  #4  
Old January 12th, 2013, 12:11 AM
requinix's Avatar
requinix requinix is offline
Still alive
Dev Shed God 16th Plane (12500 - 12999 posts)
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,864 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 5 Days 5 h 56 m 54 sec
Reputation Power: 8977
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
Well that's interesting.

Quote:
Originally Posted by psonawane
well am sorry i'm totally new here so never knew this.
any way here u go

PHP Code:
<!DOCTYPE html>
<
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><hr>
                <?php
            
}
            
$host "localhost";
            
$uname "root";
            
$pass "pranit";
            
$db_name "rk_bookings";
            
$tbl_name "bus_details";

            
mysql_connect("$host""$uname""$pass") or die("cannot connect");
            
mysql_select_db("$db_name") or die("cannot select DB");

            
$coname $_POST['coname'];
            
$dest $_POST['destination'];
            
$sql "SELECT * FROM $tbl_name WHERE company='$coname' and destination='$dest'";
            
$result mysql_query($sql) or die(mysql_error());
            
$rows mysql_fetch_array($resultMYSQLI_ASSOC);
            
?>
            <div id="disp">
                <form action="update.php">
                    <table>                
                        <tr>
                            <th>Company Name</th>
                            <th>Bus Facilities</th>
                            <th>Depart Time</th>
                            <th>Arrival Time</th>
                        </tr>                                        
                        <tr>
                            <td><input type="text" name="coname" value="<?php echo $rows['company']; ?>"></td>
                            <td><input type="text" name="aminities" value="<?php echo $rows['aminities']; ?>"></td>
                            <td><input type="text" name="depart" value="<?php echo $rows['depart']; ?>"></td>
                            <td><input type="text" name="arrive" value="<?php echo $rows['arrive']; ?>"></td>
                        </tr>
                        <tr>
                            <th>Duration</th>
                            <th>Rate</th>
                            <th>From</th>
                            <th>To</th>                    
                        </tr>
                        <tr>
                            <td><input type="text" name="duration" value="<?php echo $rows['duration']; ?>"></td>
                            <td><input type="text" name="rate" value="<?php echo $rows['price']; ?>"></td>
                            <td><input type="text" name="start" value="<?php echo $rows['start']; ?>"></td>
                            <td><input type="text" name="destination" value="<?php echo $rows['destination']; ?>"></td>
                        </tr> 
                        <tr>
                            <th style="border: none; background: none;"></th>
                            <td></td>
                            <th style="border: none; background: none; float: right;"></th>                
                        </tr>
                    </table>
                    <button type="submit" name="submit">Update!</button><br><br><br>
                </form>                                
                <strong><a href="home.php">Click Here to Go Back!</a></strong>
                <br><br><br>
            </div>
            </body>
            </html> 

Reply With Quote
  #5  
Old January 12th, 2013, 12:13 AM
requinix's Avatar
requinix requinix is offline
Still alive
Dev Shed God 16th Plane (12500 - 12999 posts)
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,864 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 5 Days 5 h 56 m 54 sec
Reputation Power: 8977
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
Where'd the isset() go?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP-DB - Update table using isset() shows nothing

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap