Jump to content

[SOLVED] SELECT * FROM Command error


Foser

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/53539-solved-select-from-command-error/
Share on other sites

<?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! ;)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.