[PHP-DEV] Re: Bug #10861 Updated: Array bug w/MySQL
Well thank you for all your help... now I can print the array just fine. But I am having another problem... I need to put that variable into an in_array function... like: if(in_array($user[UserName],array($userarr))) I can't print it into the array, and $userarr[0] doesn't seem to work. Can you help me with this one? - Czaries Out www.czaries.net - Original Message - From: Bug Database [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, May 14, 2001 2:34 PM Subject: Bug #10861 Updated: Array bug w/MySQL ID: 10861 Updated by: cmv Reported By: [EMAIL PROTECTED] Status: Bogus Bug Type: Arrays related Operating system: PHP Version: 4.0.5 Assigned To: Comments: 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 Previous Comments: -- - [2001-05-14 17:06:22] [EMAIL PROTECTED] 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] [EMAIL PROTECTED] 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! -- - ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=10861edit=2 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] Re: Bug #10861 Updated: Array bug w/MySQL
I tried that, too... then I do: $userarr = $board[9]; Then later down the page, I try to put that into an array, like so: print array($userarr); or even: $userarr2 = array($userarr); And they all just print: Array ... and the column value would have, say: Webmaster, LinkChecker, Strategist and I want to put that into an array, then use in_array to check if their user rank is one of the ones in the required user rank column... but I can never get the above column in a array to do that! Thanks for replying so fast... - Czaries Out www.czaries.net - Original Message - From: Bug Database [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, May 14, 2001 2:06 PM Subject: Bug #10861 Updated: Array bug w/MySQL ID: 10861 Updated by: derick Reported By: [EMAIL PROTECTED] Old-Status: Open Status: Bogus Bug Type: Arrays related Operating system: PHP Version: 4.0.5 Assigned To: Comments: user error: change this line: $userarr = array($board[9]); to: $userarr = $board[9]; and mysql_fetch_row gives one row per call derick Previous Comments: -- - [2001-05-14 16:59:21] [EMAIL PROTECTED] 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! -- - ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=10861edit=2 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]