Foser Posted May 30, 2007 Share Posted May 30, 2007 <?php mysql_connect("localhost", "root", "password") or die(mysql_error); mysql_select_db("tutorial1") or die(mysql_error); $personalinfo = mysql_fetch_array(mysql_query("SELECT * FROM personalinfo")) or die(mysql_error); echo "Name:" .$personalinfo['name']. "<br>Age:" .$personalinfo['age']. "<br>Sex Type:" .$personalinfo['sex']; ?> Not that i get an error or anything but its just not showing up the associative sql array... thanks! ^^ Quote Link to comment https://forums.phpfreaks.com/topic/53539-solved-select-from-command-error/ Share on other sites More sharing options...
chigley Posted May 30, 2007 Share Posted May 30, 2007 <?php mysql_connect("localhost", "root", "password") or die(mysql_error()); mysql_select_db("tutorial1") or die(mysql_error()); $personalinfo = mysql_fetch_array(mysql_query("SELECT * FROM personalinfo")) or die(mysql_error()); echo "Name:" .$personalinfo['name']. "<br>Age:" .$personalinfo['age']. "<br>Sex Type:" .$personalinfo['sex']; ?> You got your mysql_error() syntax wrong! Quote Link to comment https://forums.phpfreaks.com/topic/53539-solved-select-from-command-error/#findComment-264562 Share on other sites More sharing options...
Foser Posted May 30, 2007 Author Share Posted May 30, 2007 changed the error syntax, didn't do anything, Quote Link to comment https://forums.phpfreaks.com/topic/53539-solved-select-from-command-error/#findComment-264580 Share on other sites More sharing options...
MadTechie Posted May 30, 2007 Share Posted May 30, 2007 try print_r($personalinfo); at the end Quote Link to comment https://forums.phpfreaks.com/topic/53539-solved-select-from-command-error/#findComment-264585 Share on other sites More sharing options...
Foser Posted May 30, 2007 Author Share Posted May 30, 2007 I get the correct information, don't know why I'm not getting it. Array ( [0] => Foster [Name] => Foster [1] => 15 [Age] => 15 [2] => Male [sex] => Male ) 1 Quote Link to comment https://forums.phpfreaks.com/topic/53539-solved-select-from-command-error/#findComment-264588 Share on other sites More sharing options...
MadTechie Posted May 30, 2007 Share Posted May 30, 2007 can you post the results (or some of them) Quote Link to comment https://forums.phpfreaks.com/topic/53539-solved-select-from-command-error/#findComment-264589 Share on other sites More sharing options...
Foser Posted May 30, 2007 Author Share Posted May 30, 2007 Name: Age: Sex Type:Array ( [0] => Foster [Name] => Foster [1] => 15 [Age] => 15 [2] => Male [sex] => Male ) 1 thats what i get aand for my info in my mysql datase, i only have one line in it. which is Full Texts Name Age Sex Foster 15 Male Quote Link to comment https://forums.phpfreaks.com/topic/53539-solved-select-from-command-error/#findComment-264616 Share on other sites More sharing options...
Foser Posted May 30, 2007 Author Share Posted May 30, 2007 I hate to bump, but here it is... *bump* Quote Link to comment https://forums.phpfreaks.com/topic/53539-solved-select-from-command-error/#findComment-264674 Share on other sites More sharing options...
MadTechie Posted May 30, 2007 Share Posted May 30, 2007 echo "Name:" .$personalinfo['Name']. "<br>Age:" .$personalinfo['Age']. "<br>Sex Type:" .$personalinfo['Sex']; Quote Link to comment https://forums.phpfreaks.com/topic/53539-solved-select-from-command-error/#findComment-264676 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.