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!
Here is the code. Thank you!!
create table Payroll
(PayrollNumber int(5) not null,
StaffID varchar(25),
GrossPay float,
HourlyRate float,
YearToDateEarnings float,
IncomeTax float,
EPFNumber varchar(25),
SOCSONumber varchar(25));
insert into Payroll
values (10001, 'Ken', 12000.10, 160, 36000.50, 200.30, 'A12121212', 'B23232323');
<?php
foreach ($HTTP_COOKIE_VARS as $value)
print ("$value"; ?>
<? $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();
?>