0

arent those two the same function?

and i want to ask, can i use 2 query statement in 1 while?

while($row = mysql_fetch_array($result))

i want to add another one beside that,

it will be like this

while($row = mysql_fetch_array($result) && $row1 = mysql_fetch_array($result1))

is it valid?

2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by diafol
0

array gets both numeric index (numbered fields) and associative index (fieldnames) by default. You can stipulate one or the other with a second parameter: MYSQL_ASSOC or MYSQL_NUM.
assoc just gets the associative index (fieldnames)

just do a print_r($row); and you'll see both arrays with array
The following just gets the first row in each loop

echo "Start ARRAY:<br />";
while($row = mysql_fetch_array($result)){
  print_r($row);
  break;
}
echo "Start ARRAY with MYSQL_NUM:<br />";
while($row = mysql_fetch_array($result,MYSQL_NUM)){
  print_r($row);
  break;
}

echo "Start ARRAY with MYSQL_ASSOC:<br />";
while($row = mysql_fetch_array($result,MYSQL_ASSOC)){
  print_r($row);
  break;
}

echo "Start ASSOC:<br />";
while($row = mysql_fetch_assoc($result)){
  print_r($row);
  break;
}

while($row = mysql_fetch_array($result) && $row1 = mysql_fetch_array($result1))

doesn't make much sense to me. It sounds as though you need to use a JOIN, a subquery in your original SQL query.

Edited by diafol

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.