ukweb Posted October 10, 2008 Share Posted October 10, 2008 Hi peeps, I'm making results from a query build an array, and I'm having problems with it but strangely, PHP is not outputting any notices, errors or warnings, it just returns a blank page. error reporting is on in my config, but I can;t see whats up with my code Basically the results from a query are to be put into a multidimensional array, and like I say as far as I can see i have coded correctly, so cant see whats up! Any ideas or suggestions are welcome! heres the code: // Function to Generate an array for the language list function lang_list() { global $database_sql, $sql; mysql_select_db($database_sql, $sql); $query_langs = "SELECT short_name AS name, long_name AS desc FROM languages"; $langs = mysql_query($query_langs, $sql) or die(mysql_error()); $row_langs = mysql_fetch_assoc($langs); $totalRows_langs = mysql_num_rows($langs); $languages = array(); if ($totalRows_langs == 0) { $languages = false; } else { do { $languages[] = array("name" => $row_langs['name'], "description" => $row_langs['desc']); } while ($langs = mysql_fetch_assoc($langs)); } return $languages; } THis bit is just to see if its working ok: $lang_list = lang_list(); if (!($lang_list == false)) { $rows = count($lang_list); print_r $lang_list; print "number of rows ".$rows; } Thanks again Stephen Link to comment https://forums.phpfreaks.com/topic/127840-solved-array-problems/ Share on other sites More sharing options...
Barand Posted October 10, 2008 Share Posted October 10, 2008 try putting error_reporting(E_ALL); at top of script Link to comment https://forums.phpfreaks.com/topic/127840-solved-array-problems/#findComment-661844 Share on other sites More sharing options...
ukweb Posted October 10, 2008 Author Share Posted October 10, 2008 Already got it there, no luck ??? I tried changing my php.ini too to show all errors with no luck! rubbish!!! Think error reporting is working ok too because its displaying notice for a variable without a value, and did show up a parse error when I was writing the function and forgot a '}' bit confused.com on this one. the query works fine too, tried running the query outside a function and it did return the db values. Link to comment https://forums.phpfreaks.com/topic/127840-solved-array-problems/#findComment-661852 Share on other sites More sharing options...
ukweb Posted October 10, 2008 Author Share Posted October 10, 2008 Worked it out! I put 'desc' instead of desc in the query and it worked. not sure why this didnt show when I ran the query outside the function though! Link to comment https://forums.phpfreaks.com/topic/127840-solved-array-problems/#findComment-661854 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.