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"];
}
}

Recommended Answers

All 3 Replies

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

u dont need to have the "'s in there just $x[thething]

or dai()

did you mean die() or is it your func!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.