Retrieving Integar from MySQL

wxdqz

New Member
I have a table setup in MySQL with the following fields: EmpNumber (Int), EmpName (VarChar), EmpPosition (VarChar), and I am attempting to retrieve a listing of the entries. Here is the code:

<?php

$db = mysql_connect("localhost", "xxxxx", "xxxxxxx");

mysql_select_db("PurchReq",$db);

$result = mysql_query("SELECT * FROM Emp Order by EmpName",$db);

echo "<table border=1>\n";

echo "<tr><td><b>Number</b></td><td>Name</td><td>Position</td></tr>\n";

while ($myrow = mysql_fetch_row($result)) {

printf("<tr><td>%d</td><td>%s</td><td>%d</td></tr>\n", $myrow[1], $myrow[2], $myrow[3]);

}

echo "</table>\n";

?>

But, I am unable to obtain the first field, the EmpNumber. Can anyone direct me to the error on this script?

Thanks,

from a newbie!
 
Back
Top