You are getting resource id #4
because $result
is an resource,you must extract the values contained in it by this way,
$result=mysql_query($sql);
$values = mysql_fetch_array($result);
var_dump($values);
More about resource variable
Update 2(From OP comments)
You are printing values using field name,In that case you will have to change to
while($rows=mysql_fetch_array($result,MYSQL_ASSOC))
Or you can directly use mysql_fetch_assoc(),which in your case will be
while($rows=mysql_fetch_assoc($result)){
echo $rows['id'];
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…