Jump to content
Larry Ullman's Book Forums

Recommended Posts

i got this error after connecting db and index.php

Mr Larry help me

Knowledge is Power and it pays to know
Welcome

Welcome to Knowledge is Power, a site dedicated to keeping you up to date on the Web security and programming information you need to know. Blah, blah, blah. Yadda, yadda, yadda.

Most Popular Pages

 

An error occurred in script 'C:\xampp\htdocs\test\index.php' on line 37:
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\test\index.php                    [3] => 37                    [4] => Array                        (                            [GLOBALS] => Array *RECURSION*                            [_POST] => Array                                (                                )                            [_GET] => Array                                (                                )                            [_COOKIE] => Array                                (                                )                            [_FILES] => Array                                (                                )                            [_SERVER] => Array                                (                                    [MIBDIRS] => C:/xampp/php/extras/mibs                                    [MYSQL_HOME] => C:\xampp\mysql\bin                                    [OPENSSL_CONF] => C:/xampp/apache/bin/openssl.cnf                                    [PHP_PEAR_SYSCONF_DIR] => C:\xampp\php                                    [PHPRC] => C:\xampp\php                                    [TMP] => C:\xampp\tmp                                    [HTTP_HOST] => 127.0.0.1                                    [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0                                    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8                                    [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.5                                    [HTTP_ACCEPT_ENCODING] => gzip, deflate                                    [HTTP_CONNECTION] => keep-alive                                    [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)\QuickTime\QTSystem\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\                                    [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.2.14 (Win32) DAV/2 mod_autoindex_color PHP/5.3.1 Server at 127.0.0.1 Port 80                                    [SERVER_SOFTWARE] => Apache/2.2.14 (Win32) DAV/2 mod_autoindex_color PHP/5.3.1                                    [SERVER_NAME] => 127.0.0.1                                    [SERVER_ADDR] => 127.0.0.1                                    [SERVER_PORT] => 80                                    [REMOTE_ADDR] => 127.0.0.1                                    [DOCUMENT_ROOT] => C:/xampp/htdocs                                    [SERVER_ADMIN] => postmaster@localhost                                    [SCRIPT_FILENAME] => C:/xampp/htdocs/test/index.php                                    [REMOTE_PORT] => 51571                                    [GATEWAY_INTERFACE] => CGI/1.1                                    [SERVER_PROTOCOL] => HTTP/1.1                                    [REQUEST_METHOD] => GET                                    [QUERY_STRING] =>                                     [REQUEST_URI] => /test/                                    [SCRIPT_NAME] => /test/index.php                                    [PHP_SELF] => /test/index.php                                    [REQUEST_TIME] => 1402100874                                    [argv] => Array                                        (                                        )                                    [argc] => 0                                )                            [live] =>                             [contact_email] => you@example.com                            [_SESSION] => Array                                (                                )                            [dbc] => mysqli Object                                (                                    [affected_rows] => -1                                    [client_info] => 5.1.41                                    [client_version] => 50141                                    [connect_errno] => 0                                    [connect_error] =>                                     [errno] => 1146                                    [error] => Table 'ecommerce1.history' doesn't exist                                    [field_count] => 0                                    [host_info] => localhost via TCP/IP                                    [info] =>                                     [insert_id] => 0                                    [server_info] => 5.1.41                                    [server_version] => 50141                                    [sqlstate] => 42S02                                    [protocol_version] => 10                                    [thread_id] => 1                                    [warning_count] => 0                                )                            [pages] => Array                                (                                    [Home] => index.php                                    [About] => #                                    [Contact] => #                                    [Register] => register.php                                )                            [this_page] => index.php                            [v] => register.php                            [k] => Register                            [q] => SELECT COUNT(history.id) AS num, pages.id, pages.title FROM pages, history WHERE pages.id=history.page_id AND history.type='page' GROUP BY (history.page_id) ORDER BY num DESC LIMIT 10                            [r] =>                             [n] => 1                        )                )        )    [1] => Array        (            [file] => C:\xampp\htdocs\test\index.php            [line] => 37            [function] => mysqli_fetch_array            [args] => Array                (                    [0] =>                     [1] => 2                )        ))

 

Highest Rated Pages

 

An error occurred in script 'C:\xampp\htdocs\test\index.php' on line 55:
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\test\index.php                    [3] => 55                    [4] => Array                        (                            [GLOBALS] => Array *RECURSION*                            [_POST] => Array                                (                                )                            [_GET] => Array                                (                                )                            [_COOKIE] => Array                                (                                )                            [_FILES] => Array                                (                                )                            [_SERVER] => Array                                (                                    [MIBDIRS] => C:/xampp/php/extras/mibs                                    [MYSQL_HOME] => C:\xampp\mysql\bin                                    [OPENSSL_CONF] => C:/xampp/apache/bin/openssl.cnf                                    [PHP_PEAR_SYSCONF_DIR] => C:\xampp\php                                    [PHPRC] => C:\xampp\php                                    [TMP] => C:\xampp\tmp                                    [HTTP_HOST] => 127.0.0.1                                    [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0                                    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8                                    [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.5                                    [HTTP_ACCEPT_ENCODING] => gzip, deflate                                    [HTTP_CONNECTION] => keep-alive                                    [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)\QuickTime\QTSystem\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\                                    [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.2.14 (Win32) DAV/2 mod_autoindex_color PHP/5.3.1 Server at 127.0.0.1 Port 80                                    [SERVER_SOFTWARE] => Apache/2.2.14 (Win32) DAV/2 mod_autoindex_color PHP/5.3.1                                    [SERVER_NAME] => 127.0.0.1                                    [SERVER_ADDR] => 127.0.0.1                                    [SERVER_PORT] => 80                                    [REMOTE_ADDR] => 127.0.0.1                                    [DOCUMENT_ROOT] => C:/xampp/htdocs                                    [SERVER_ADMIN] => postmaster@localhost                                    [SCRIPT_FILENAME] => C:/xampp/htdocs/test/index.php                                    [REMOTE_PORT] => 51571                                    [GATEWAY_INTERFACE] => CGI/1.1                                    [SERVER_PROTOCOL] => HTTP/1.1                                    [REQUEST_METHOD] => GET                                    [QUERY_STRING] =>                                     [REQUEST_URI] => /test/                                    [SCRIPT_NAME] => /test/index.php                                    [PHP_SELF] => /test/index.php                                    [REQUEST_TIME] => 1402100874                                    [argv] => Array                                        (                                        )                                    [argc] => 0                                )                            [live] =>                             [contact_email] => you@example.com                            [_SESSION] => Array                                (                                )                            [dbc] => mysqli Object                                (                                    [affected_rows] => -1                                    [client_info] => 5.1.41                                    [client_version] => 50141                                    [connect_errno] => 0                                    [connect_error] =>                                     [errno] => 1146                                    [error] => Table 'ecommerce1.page_ratings' doesn't exist                                    [field_count] => 0                                    [host_info] => localhost via TCP/IP                                    [info] =>                                     [insert_id] => 0                                    [server_info] => 5.1.41                                    [server_version] => 50141                                    [sqlstate] => 42S02                                    [protocol_version] => 10                                    [thread_id] => 1                                    [warning_count] => 0                                )                            [pages] => Array                                (                                    [Home] => index.php                                    [About] => #                                    [Contact] => #                                    [Register] => register.php                                )                            [this_page] => index.php                            [v] => register.php                            [k] => Register                            [q] => SELECT ROUND(AVG(rating),1) AS average, pages.id, pages.title FROM pages, page_ratings WHERE pages.id=page_ratings.page_id GROUP BY (page_ratings.page_id) ORDER BY average DESC LIMIT 10                            [r] =>                             [n] => 1                            [row] =>                         )                )        )    [1] => Array        (            [file] => C:\xampp\htdocs\test\index.php            [line] => 55            [function] => mysqli_fetch_array            [args] => Array                (                    [0] =>                     [1] => 2                )        ))

 

Lorem Ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent consectetur volutpat nunc, eget vulputate quam tristique sit amet. Donec suscipit mollis erat in egestas. Morbi id risus quam. Sed vitae erat eu tortor tempus consequat. Morbi quam massa, viverra sed ullamcorper sit amet, ultrices ullamcorper eros. Mauris ultricies rhoncus leo, ac vehicula sem condimentum vel. Morbi varius rutrum laoreet. Maecenas vitae turpis turpis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce leo turpis, faucibus et consequat eget, adipiscing ut turpis. Donec lacinia sodales nulla nec pellentesque. Fusce fringilla dictum purus in imperdiet. Vivamus at nulla diam, sagittis rutrum diam. Integer porta imperdiet euismod.

 

Login

Email Address

Password
Forgot?

Content
Knowledge is Power and it pays to know
Welcome

Welcome to Knowledge is Power, a site dedicated to keeping you up to date on the Web security and programming information you need to know. Blah, blah, blah. Yadda, yadda, yadda.

Most Popular Pages

 

An error occurred in script 'C:\xampp\htdocs\test\index.php' on line 37:
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\test\index.php                    [3] => 37                    [4] => Array                        (                            [GLOBALS] => Array *RECURSION*                            [_POST] => Array                                (                                )                            [_GET] => Array                                (                                )                            [_COOKIE] => Array                                (                                )                            [_FILES] => Array                                (                                )                            [_SERVER] => Array                                (                                    [MIBDIRS] => C:/xampp/php/extras/mibs                                    [MYSQL_HOME] => C:\xampp\mysql\bin                                    [OPENSSL_CONF] => C:/xampp/apache/bin/openssl.cnf                                    [PHP_PEAR_SYSCONF_DIR] => C:\xampp\php                                    [PHPRC] => C:\xampp\php                                    [TMP] => C:\xampp\tmp                                    [HTTP_HOST] => 127.0.0.1                                    [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0                                    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8                                    [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.5                                    [HTTP_ACCEPT_ENCODING] => gzip, deflate                                    [HTTP_CONNECTION] => keep-alive                                    [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)\QuickTime\QTSystem\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\                                    [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.2.14 (Win32) DAV/2 mod_autoindex_color PHP/5.3.1 Server at 127.0.0.1 Port 80                                    [SERVER_SOFTWARE] => Apache/2.2.14 (Win32) DAV/2 mod_autoindex_color PHP/5.3.1                                    [SERVER_NAME] => 127.0.0.1                                    [SERVER_ADDR] => 127.0.0.1                                    [SERVER_PORT] => 80                                    [REMOTE_ADDR] => 127.0.0.1                                    [DOCUMENT_ROOT] => C:/xampp/htdocs                                    [SERVER_ADMIN] => postmaster@localhost                                    [SCRIPT_FILENAME] => C:/xampp/htdocs/test/index.php                                    [REMOTE_PORT] => 51571                                    [GATEWAY_INTERFACE] => CGI/1.1                                    [SERVER_PROTOCOL] => HTTP/1.1                                    [REQUEST_METHOD] => GET                                    [QUERY_STRING] =>                                     [REQUEST_URI] => /test/                                    [SCRIPT_NAME] => /test/index.php                                    [PHP_SELF] => /test/index.php                                    [REQUEST_TIME] => 1402100874                                    [argv] => Array                                        (                                        )                                    [argc] => 0                                )                            [live] =>                             [contact_email] => you@example.com                            [_SESSION] => Array                                (                                )                            [dbc] => mysqli Object                                (                                    [affected_rows] => -1                                    [client_info] => 5.1.41                                    [client_version] => 50141                                    [connect_errno] => 0                                    [connect_error] =>                                     [errno] => 1146                                    [error] => Table 'ecommerce1.history' doesn't exist                                    [field_count] => 0                                    [host_info] => localhost via TCP/IP                                    [info] =>                                     [insert_id] => 0                                    [server_info] => 5.1.41                                    [server_version] => 50141                                    [sqlstate] => 42S02                                    [protocol_version] => 10                                    [thread_id] => 1                                    [warning_count] => 0                                )                            [pages] => Array                                (                                    [Home] => index.php                                    [About] => #                                    [Contact] => #                                    [Register] => register.php                                )                            [this_page] => index.php                            [v] => register.php                            [k] => Register                            [q] => SELECT COUNT(history.id) AS num, pages.id, pages.title FROM pages, history WHERE pages.id=history.page_id AND history.type='page' GROUP BY (history.page_id) ORDER BY num DESC LIMIT 10                            [r] =>                             [n] => 1                        )                )        )    [1] => Array        (            [file] => C:\xampp\htdocs\test\index.php            [line] => 37            [function] => mysqli_fetch_array            [args] => Array                (                    [0] =>                     [1] => 2                )        ))

 

Highest Rated Pages

 

An error occurred in script 'C:\xampp\htdocs\test\index.php' on line 55:
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\test\index.php                    [3] => 55                    [4] => Array                        (                            [GLOBALS] => Array *RECURSION*                            [_POST] => Array                                (                                )                            [_GET] => Array                                (                                )                            [_COOKIE] => Array                                (                                )                            [_FILES] => Array                                (                                )                            [_SERVER] => Array                                (                                    [MIBDIRS] => C:/xampp/php/extras/mibs                                    [MYSQL_HOME] => C:\xampp\mysql\bin                                    [OPENSSL_CONF] => C:/xampp/apache/bin/openssl.cnf                                    [PHP_PEAR_SYSCONF_DIR] => C:\xampp\php                                    [PHPRC] => C:\xampp\php                                    [TMP] => C:\xampp\tmp                                    [HTTP_HOST] => 127.0.0.1                                    [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0                                    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8                                    [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.5                                    [HTTP_ACCEPT_ENCODING] => gzip, deflate                                    [HTTP_CONNECTION] => keep-alive                                    [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)\QuickTime\QTSystem\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\                                    [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.2.14 (Win32) DAV/2 mod_autoindex_color PHP/5.3.1 Server at 127.0.0.1 Port 80                                    [SERVER_SOFTWARE] => Apache/2.2.14 (Win32) DAV/2 mod_autoindex_color PHP/5.3.1                                    [SERVER_NAME] => 127.0.0.1                                    [SERVER_ADDR] => 127.0.0.1                                    [SERVER_PORT] => 80                                    [REMOTE_ADDR] => 127.0.0.1                                    [DOCUMENT_ROOT] => C:/xampp/htdocs                                    [SERVER_ADMIN] => postmaster@localhost                                    [SCRIPT_FILENAME] => C:/xampp/htdocs/test/index.php                                    [REMOTE_PORT] => 51571                                    [GATEWAY_INTERFACE] => CGI/1.1                                    [SERVER_PROTOCOL] => HTTP/1.1                                    [REQUEST_METHOD] => GET                                    [QUERY_STRING] =>                                     [REQUEST_URI] => /test/                                    [SCRIPT_NAME] => /test/index.php                                    [PHP_SELF] => /test/index.php                                    [REQUEST_TIME] => 1402100874                                    [argv] => Array                                        (                                        )                                    [argc] => 0                                )                            [live] =>                             [contact_email] => you@example.com                            [_SESSION] => Array                                (                                )                            [dbc] => mysqli Object                                (                                    [affected_rows] => -1                                    [client_info] => 5.1.41                                    [client_version] => 50141                                    [connect_errno] => 0                                    [connect_error] =>                                     [errno] => 1146                                    [error] => Table 'ecommerce1.page_ratings' doesn't exist                                    [field_count] => 0                                    [host_info] => localhost via TCP/IP                                    [info] =>                                     [insert_id] => 0                                    [server_info] => 5.1.41                                    [server_version] => 50141                                    [sqlstate] => 42S02                                    [protocol_version] => 10                                    [thread_id] => 1                                    [warning_count] => 0                                )                            [pages] => Array                                (                                    [Home] => index.php                                    [About] => #                                    [Contact] => #                                    [Register] => register.php                                )                            [this_page] => index.php                            [v] => register.php                            [k] => Register                            [q] => SELECT ROUND(AVG(rating),1) AS average, pages.id, pages.title FROM pages, page_ratings WHERE pages.id=page_ratings.page_id GROUP BY (page_ratings.page_id) ORDER BY average DESC LIMIT 10                            [r] =>                             [n] => 1                            [row] =>                         )                )        )    [1] => Array        (            [file] => C:\xampp\htdocs\test\index.php            [line] => 55            [function] => mysqli_fetch_array            [args] => Array                (                    [0] =>                     [1] => 2                )        ))

 

Lorem Ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent consectetur volutpat nunc, eget vulputate quam tristique sit amet. Donec suscipit mollis erat in egestas. Morbi id risus quam. Sed vitae erat eu tortor tempus consequat. Morbi quam massa, viverra sed ullamcorper sit amet, ultrices ullamcorper eros. Mauris ultricies rhoncus leo, ac vehicula sem condimentum vel. Morbi varius rutrum laoreet. Maecenas vitae turpis turpis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce leo turpis, faucibus et consequat eget, adipiscing ut turpis. Donec lacinia sodales nulla nec pellentesque. Fusce fringilla dictum purus in imperdiet. Vivamus at nulla diam, sagittis rutrum diam. Integer porta imperdiet euismod.

 

Login

Email Address

Password
Forgot?

Content

 

 

Share this post


Link to post
Share on other sites

You're getting that error because the query isn't working. Specifically it's: Table 'ecommerce1.history' doesn't exist

Share this post


Link to post
Share on other sites

If it doesn't exist, you can't delete it. You can either create it or you can take out the code in the script that references it. The history table is added in Part 4 of the book, so you can just remove the code from the index.php file for the time being (it's not in the index.php file in the downloads, it's only in index-bonus.php).

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...