#10861 [Com]: Array bug w/MySQL
| From: | suck at mydick dot com | Date: | Tue, 24 Aug 2004 11:39:14 +0000 |
| Subject: | #10861 [Com]: Array bug w/MySQL | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-65162@lists.php.net to get a copy of this message | ||
ID: 10861
Comment by: suck at mydick dot com
Reported By: czaries at hotmail dot com
Status: Bogus
Bug Type: Arrays related
Operating System: Unix
PHP Version: 4.0.5
New Comment:
<HTML>
<BODY BGCOLOR=#000000>
<FONT COLOR=#00FF00>TEST</FONT>
</BODY>
</HTML>
Previous Comments:
------------------------------------------------------------------------
[2001-05-14 17:34:39] cmv@php.net
You can't "print" an array in PHP. You either need to loop through the
array and print each element, or use something like print_r() or
var_dump() to see the contents of the array.
I bet this will work for you:
$board_r = mysql_query("SELECT * FROM mb_boards WHERE
BoardID='$BoardID'", $link);
$board = mysql_fetch_row ($board_r);
$userarr = array($board[9]);
print_r($userarr); // this, or ...
echo $userarr[0]; // this.
- Colin
------------------------------------------------------------------------
[2001-05-14 17:06:22] derick@php.net
user error:
change this line:
$userarr = array($board[9]);
to:
$userarr = $board[9];
and mysql_fetch_row gives one row per call
derick
------------------------------------------------------------------------
[2001-05-14 16:59:21] czaries at hotmail dot com
When trying to put a value from a database into an array for checking,
it jsut won't do it...
Like this:
$board_r = mysql_query("SELECT * FROM mb_boards WHERE
BoardID='$BoardID'", $link);
$board = mysql_fetch_row ($board_r);
$userarr = array($board[9]);
When I try to call $userarr at a later date, all it prints is: "Array"
- and it doesn't put the contents of that veriable into the array, even
though the contents of the cell are separated with commas and all the
proper stuff needed for an array!
Please help me!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=10861&edit=1