Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

something with this code

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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","");
$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]";
New php-forum User
New php-forum User
Posts: 4
Joined: Sun Jul 06, 2003 2:51 am

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

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

Try that.

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

Return to PHP coding => General

Who is online

Users browsing this forum: Google Feedfetcher and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.