BigDaddy Posted March 23, 2013 Share Posted March 23, 2013 <?php // Dynamically generate the content links:$q = 'SELECT * FROM categories ORDER BY category';$r = mysqli_query($dbc, $q);while (list($id, $category) = mysqli_fetch_array($r, MYSQLI_NUM)) { echo '<li><a href="category.php?id=' . $id . '" title="' . $category . '">' . $category . '</a></li>';}?> Line 54 is above in the yellow. 'C:\xampp\htdocs\MyEcommerce\html\includes\footer.html' on line 54:mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given Array( [0] => Array ( [function] => my_error_handler [args] => Array ( [0] => 2 [1] => mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given [2] => C:\xampp\htdocs\MyEcommerce\html\includes\footer.html [3] => 54 [4] => Array ( [_GET] => Array ( ) [_POST] => Array ( ) [_COOKIE] => Array ( [PHPSESSID] => tl6m4s5b4toqjd27p1hmuesen3 ) [_FILES] => Array ( ) [_SERVER] => Array ( [MIBDIRS] => C:/xampp/php/extras/mibs [MYSQL_HOME] => \xampp\mysql\bin [OPENSSL_CONF] => C:/xampp/apache/bin/openssl.cnf [PHP_PEAR_SYSCONF_DIR] => \xampp\php [PHPRC] => \xampp\php [TMP] => \xampp\tmp [HTTP_ACCEPT] => text/html, application/xhtml+xml, */* [HTTP_ACCEPT_LANGUAGE] => en-US [HTTP_USER_AGENT] => Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0) [HTTP_ACCEPT_ENCODING] => gzip, deflate [HTTP_HOST] => localhost [HTTP_DNT] => 1 [HTTP_CONNECTION] => Keep-Alive [HTTP_COOKIE] => PHPSESSID=tl6m4s5b4toqjd27p1hmuesen3 [PATH] => C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Toshiba\Bluetooth Toshiba Stack\sys\;C:\Program Files (x86)\Toshiba\Bluetooth Toshiba Stack\sys\x64\; [SystemRoot] => C:\windows [COMSPEC] => C:\windows\system32\cmd.exe [PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC [WINDIR] => C:\windows [SERVER_SIGNATURE] => Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 Server at localhost Port 80 [SERVER_SOFTWARE] => Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 [SERVER_NAME] => localhost [SERVER_ADDR] => ::1 [SERVER_PORT] => 80 [REMOTE_ADDR] => ::1 [DOCUMENT_ROOT] => C:/xampp/htdocs [REQUEST_SCHEME] => http [CONTEXT_PREFIX] => [CONTEXT_DOCUMENT_ROOT] => C:/xampp/htdocs [SERVER_ADMIN] => postmaster@localhost [SCRIPT_FILENAME] => C:/xampp/htdocs/MyEcommerce/html/index.php [REMOTE_PORT] => 49599 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => [REQUEST_URI] => /MyEcommerce/html/index.php [SCRIPT_NAME] => /MyEcommerce/html/index.php [PHP_SELF] => /MyEcommerce/html/index.php [REQUEST_TIME_FLOAT] => 1364055892.085 [REQUEST_TIME] => 1364055892 ) [live] => [contact_email] => you@example.com [_SESSION] => Array ( ) [dbc] => mysqli Object ( [affected_rows] => -1 [client_info] => mysqlnd 5.0.10 - 20111026 - $Id: b0b3b15c693b7f6aeb3aa66b646fee339f175e39 $ [client_version] => 50010 [connect_errno] => 0 [connect_error] => [errno] => 1046 [error] => No database selected [error_list] => Array ( [0] => Array ( [errno] => 1046 [sqlstate] => 3D000 [error] => No database selected ) ) [field_count] => 0 [host_info] => localhost via TCP/IP [info] => [insert_id] => 0 [server_info] => 5.5.27 [server_version] => 50527 [stat] => Uptime: 9026 Threads: 1 Questions: 8 Slow queries: 0 Opens: 33 Flush tables: 1 Open tables: 0 Queries per second avg: 0.000 [sqlstate] => 00000 [protocol_version] => 10 [thread_id] => 2 [warning_count] => 0 ) [pages] => Array ( [Home] => index.php [About] => # [Contact] => # [Register] => register.php ) [this_page] => index.php [v] => register.php [k] => Register [login_errors] => Array ( ) [q] => SELECT * FROM categories ORDER BY category [r] => ) ) ) [1] => Array ( [file] => C:\xampp\htdocs\MyEcommerce\html\includes\footer.html [line] => 54 [function] => mysqli_fetch_array [args] => Array ( [0] => [1] => 2 ) ) [2] => Array ( [file] => C:\xampp\htdocs\MyEcommerce\html\index.php [line] => 38 [args] => Array ( [0] => C:\xampp\htdocs\MyEcommerce\html\includes\footer.html ) [function] => require )) Link to comment Share on other sites More sharing options...
Edward Posted March 23, 2013 Share Posted March 23, 2013 Check $dbc has a database connection so the mysqli_query function can return a result for the function of which you are receiving the error. Link to comment Share on other sites More sharing options...
Larry Posted March 25, 2013 Share Posted March 25, 2013 Your query is not returning any results and is probably throwing an error. Use the standard PHP-MySQL debugging approach to figure out what's going on. Link to comment Share on other sites More sharing options...
Recommended Posts