Jump to content

Question about mysql_fetch....


Gruzin

Recommended Posts

Have you read the manual, as this makes it pretty clear!

[b]mysql_fetch_array()[/b]
[quote]Fetch a result row as an associative array, a numeric array, or both[/quote]

[b]mysql_fetch_assoc()[/b]
[quote]Fetch a result row as an associative array[/quote]

Regards
Huggie
Thanks Huggie,

I will read the manual again...

Actaually I have a simple mysql query, like this:
[code]$sql = mysql_query("SELECT * FROM aid_poll_results WHERE id='17'");
while($row = mysql_fetch_assoc($sql)){
$opt1 = $row['1'];
$opt2 = $row['2'];
$opt3 = $row['3'];
$opt4 = $row['4'];
$opt5 = $row['5'];
$opt6 = $row['6'];
$opt7 = $row['7'];
$opt8 = $row['8'];
$opt9 = $row['9'];
}[/code]

above query fetches rows correctly, but this:
[code]$sql = mysql_query("SELECT * FROM aid_poll_results WHERE id='17'");
while($row = mysql_fetch_array($sql)){
$opt1 = $row['1'];
$opt2 = $row['2'];
$opt3 = $row['3'];
$opt4 = $row['4'];
$opt5 = $row['5'];
$opt6 = $row['6'];
$opt7 = $row['7'];
$opt8 = $row['8'];
$opt9 = $row['9'];
}[/code]

this example fetches rows, omitting 1 row, I mean it does fetch the rows except firts one, and instead of it fetches id row... hope u understand me :)

Thanks,
George

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.