something with this code

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

loon
New php-forum User
New php-forum User
Posts: 4
Joined: Sun Jul 06, 2003 2:51 am

something with this code

Postby loon » Sun Jul 06, 2003 2:54 am

Why this code can't select the StaffID, if I delete 'where StaffID = $StaffID', this will show all the result, but I want the selected StaffID only. Something wrong with this code?
Thank you for your help!

<?
$Connect = mysql_connect("localhost","root","");
mysql_select_db("mw");
$StaffID = "$value";
$result=mysql_query("select * from Payroll where StaffID = $StaffID");
$number_of_array = mysql_num_rows($result);
while ($number_of_array = mysql_fetch_array($result)){
echo "$number_of_array[PayrollNumber]";
}
mysql_close();
?>

User avatar
bezmond
Moderator
Moderator
Posts: 312
Joined: Sat Apr 05, 2003 4:33 am
Location: Mansfield, UK
Contact:

Postby bezmond » Sun Jul 06, 2003 10:42 am

$StaffID = $value;
$result = mysql_query("select * from Payroll where StaffID='$StaffID'");

Try that.

Andrew


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 3 guests

cron