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?

Member Avatar for diafol

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.

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.