Getting Results in PHP from query

Why does this…

[php]$record = mysql_query(“SELECT status FROM accounts WHERE confno_c=’$conf’”)
$status = mysql_fetch_array($record);
print_r($status);[/php]

result in this…

[table]
[tr]
[td]Array ( [ 0 ] => Closed [status] => Closed )[/td]
[/tr]
[/table]

instead of what I want…

[table]
[tr]
[td]Closed[/td]
[/tr]
[/table]

What do I need to do to get “Closed” instead of “Array…”?

print_r is a function for printing arrays, objects, etc. mainly used in debugging.

To print the value you want do this:
[php]echo $status[‘status’]; [/php]

Red :wink:

Yay! You’re awesome!

It is useful to read I’m not very good I am. This is a great story of another. I read a great advantage as much as I do.

Sponsor our Newsletter | Privacy Policy | Terms of Service