0

this part of php that connected with db

$q2="select *from emp order by id";
$r2=mysql_query($q2)or dai("query faild:"mysql_error());

while($x=mysql_fetch_array($r2)
 {

if($x["depno"]==10)//dose it right to use $x=["depno"]like this when i use the query select* from the table??
{
echo"<tr><td>$x["emloyeeno"]</td>";
echo"<td>$x["employee name"]</td>";
echo"<tr><td>$x["address"]</td>";
echo"<td>$x["salary"]</td>";
$sum=$sum+$x["salary"];
}
}

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by smartness
0

im not sure really if i have the right to answer ur question
or it is just the business of experts here

anyway.. i don't have time to try it it works or not
try it and tell us if it assigns an error here

for me i will do it like this and it works..

//just an example..
$row = mysql_fetch_object($result);

//use it like this..
$row->age

i hope i could help
good luck

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.