Jump to content


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


Help making hello world PHP/Mysql app

Recommended Posts

I am trying to write a hello world type php/mysql app, but I am getting an error. See here: [a href=\"http://peltkore.net/~antineo/viewdb.php\" target=\"_blank\"]http://peltkore.net/~antineo/viewdb.php[/a]

here is the code:

$db = mysql_connect("localhost", "antineo", "my_password");
$result = mysql_query("SELECT * FROM personnel",$db);
echo "<TABLE>";
echo"<TR><TD><B>Full Name</B><TD><B>Nick
while($myrow = mysql_fetch_array($result))
echo "<TR><TD>";
echo $myrow["firstname"];
echo " ";
echo $myrow["lastname"];
echo "<TD>";
echo $myrow["nick"];
echo "<TD>";
echo $myrow["salary"];
echo "</TABLE>";

Any ideas? PHP/mySql is starting to confuse me.

Share this post

Link to post
Share on other sites
If you are getting that error messahe then that error is usually due to an error in your SQL query. To see why your query is failing change this line:
[code]$result = mysql_query("SELECT * FROM personnel",$db);[/code]
[code]$result = mysql_query("SELECT * FROM personnel", $db) or die("SQL Query error: " . mysql_error());[/code]
Now by looking at your query evertink is fine, but I have a feeling you have mistyped the table name (personnel).

If you dont understand the error message that will be returned when you run your code again then post it here and we'll explain why.

Share this post

Link to post
Share on other sites


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.