zgkhoo Posted August 11, 2007 Share Posted August 11, 2007 cant display the database information , why? <?php include 'config.php'; include 'opendb.php'; session_start(); echo "testing ".$_SESSION['username']; $result = mysql_query("SELECT * FROM person"); while($row = mysql_fetch_array($result)) { echo $row['fullname'] ; echo "<br />"; } include 'closedb.php'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/64373-cant-display-the-database-information-why/ Share on other sites More sharing options...
Chevy Posted August 11, 2007 Share Posted August 11, 2007 put this after the mysql_query and see what it says: or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/64373-cant-display-the-database-information-why/#findComment-320998 Share on other sites More sharing options...
zgkhoo Posted August 11, 2007 Author Share Posted August 11, 2007 put this after the mysql_query and see what it says: or die(mysql_error()); ("SELECT username,password FROM person" i changed to this code, problem solved, why? weird.. Quote Link to comment https://forums.phpfreaks.com/topic/64373-cant-display-the-database-information-why/#findComment-321003 Share on other sites More sharing options...
MadTechie Posted August 11, 2007 Share Posted August 11, 2007 that change will NOT fix the problem, as your pulling 'fullname', add the or die(mysql_error()); would of revealed the problem also try replacing echo $row['fullname'] ; with print_r($row); and check that fullname exists (it will not with your last change) Quote Link to comment https://forums.phpfreaks.com/topic/64373-cant-display-the-database-information-why/#findComment-321006 Share on other sites More sharing options...
Barand Posted August 11, 2007 Share Posted August 11, 2007 that change will NOT fix the problem, as your pulling 'fullname', add the or die(mysql_error()); would of revealed the problem AH! the clairvoyant version of mysql_error() that knows you are going to attempt to echo a non-existent column name subsequent to calling the query Quote Link to comment https://forums.phpfreaks.com/topic/64373-cant-display-the-database-information-why/#findComment-321022 Share on other sites More sharing options...
Chevy Posted August 11, 2007 Share Posted August 11, 2007 I never said it would fix it, I was just wondering if there was an error in the MySQL Quote Link to comment https://forums.phpfreaks.com/topic/64373-cant-display-the-database-information-why/#findComment-321025 Share on other sites More sharing options...
zgkhoo Posted August 11, 2007 Author Share Posted August 11, 2007 wat type of mysql error u meant? wat possible error might be.. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/64373-cant-display-the-database-information-why/#findComment-321030 Share on other sites More sharing options...
MadTechie Posted August 11, 2007 Share Posted August 11, 2007 @Chevy: i was refering to zgkhoo " i changed to this code, problem solved, why? weird.. @zgkhoo: any error, wrong field, invalid SQL statement.. have you eveb tried it yet ? Quote Link to comment https://forums.phpfreaks.com/topic/64373-cant-display-the-database-information-why/#findComment-321033 Share on other sites More sharing options...
zgkhoo Posted August 11, 2007 Author Share Posted August 11, 2007 nope Quote Link to comment https://forums.phpfreaks.com/topic/64373-cant-display-the-database-information-why/#findComment-321104 Share on other sites More sharing options...
Guest Posted August 11, 2007 Share Posted August 11, 2007 In your first code, you used this line echo $row['fullname']; then when you changed your SQL to "SELECT username,password FROM person" There was only the username and password fields being selected. We do not see any fullname field, so we assume you may be trying to get a field that doesn't exist when you did: echo $row['fullname']; Quote Link to comment https://forums.phpfreaks.com/topic/64373-cant-display-the-database-information-why/#findComment-321106 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.