What is the use of the MYSQL_BOTH in the code?

Asked By 0 points N/A Posted on -

For example from this code if($count>0){

$username=$row['username']; $user_id=$row['user_id'];
$query5 ="UPDATE message SET status='read' WHERE user='$userdata'";
$result5=mysql_query($query5,$link) or die("Error". mysql_error());
$query1="select * from message Where user='$user_id' ORDER BY date DESC, time DESC";
$result1=mysql_query($query1,$link) or die ("Error". mysql_error());
Answered By 30 points N/A #177669

What is the use of the MYSQL_BOTH in the code?


Hi Chillz18,

When mysql_fetch_array() is used, it fetches the result row as an associative or numeric array.You can choose to fetch both associative and numeric array by using the MYSQL_BOTH type. To fetch only the associative array, you can use MYSQL_ASSOC.To fetch only the numeric array you can use MYSQL_NUM.

Here using MYSQL_BOTH you can access both the fields in the column, the username and user id.


Login/Register to Answer

Related Questions