mysql_fetch_assoc

mysql_fetch_assoc -- Fetch a result row as an associative array

Description

array mysql_fetch_assoc ( resource result)

דוגמה 1 . mysql_fetch_assoc( )

 
?php

 
mysql_connect(

 
"localhost"

 
,

 
"mysql_user"

 
,

 
"mysql_password")

 
;

 
mysql_select_db("mydb")

 
;

 
$query

 
=

 
"select

 
*

 
from

 
table"

 
;

 
$result

 
=

 
mysql_query($query)

 
;

 
while

 
($row

 
=

 
mysql_fetch_assoc($result)

 
)

 
{

 
echo

 
$row["user_id"]

 
;

 
echo

 
$row["fullname"]

 
;

 
    }

 
mysql_free_result($result)

 
;

 
?



For further details , see also mysql_fetch_row( ) , mysql_fetch_array( ) and mysql_query( ) .