Jump to content
Larry Ullman's Book Forums
CraneWing

Admin Area - Query Error For Inventory Page

Recommended Posts

I am working on the Admin area for the coffee shop site, and I am encountering an error when the query to get all products to list them on the page. I cut and paste the query because it was so complicated, thinking I would make a syntax error. I am getting an error anyway!

 

An error occurred in script 'C:\vhosts\clever-coffee.net\html\admin\add_inventory.php' on line 94:
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:\vhosts\clever-coffee.net\html\admin\add_inventory.php                    [3] => 94                    [4] => Array                        (                            [_GET] => Array                                (                                )                            [_POST] => Array                                (                                )                            [_COOKIE] => Array                                (                                    [SESSION] => 115cadb3f0e62db701dc0055e125b213                                    [PHPSESSID] => 115cadb3f0e62db701dc0055e125b213                                )                            [_FILES] => Array                                (                                )                            [_SERVER] => Array                                (                                    [HTTP_HOST] => clever-coffee.net                                    [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.1; rv:40.0) Gecko/20100101 Firefox/40.0 FirePHP/0.7.4                                    [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_REFERER] => http://clever-coffee.net/html/admin/add_coffee.php                                    [HTTP_COOKIE] => SESSION=115cadb3f0e62db701dc0055e125b213; PHPSESSID=115cadb3f0e62db701dc0055e125b213                                    [HTTP_X_INSIGHT] => activate                                    [HTTP_CONNECTION] => keep-alive                                    [HTTP_CACHE_CONTROL] => max-age=0                                    [PATH] => C:\Program Files\ActiveState Komodo Edit 9 nightly\;C:\ProgramData\Oracle\Java\javapath;C:\ImageMagick;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\PROGRA~1\IBM\CLIENT~1;C:\PROGRA~1\IBM\CLIENT~1\Shared;C:\PROGRA~1\IBM\CLIENT~1\Emulator;c:\Program Files\Java\jdk1.7.0_45\bin;C:\Program Files\Java\jdk1.7.0_51\/bin;C:\Apache Subversion 1.8.8\bin;C:\limejs\bin;C:\DevStack\MariaDB10\bin;c:\DevStack\php;c:\DevStack\php\ext;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\GnuWin32\bin;c:\drush;C:\PostgreSQL;C:\PostgreSQL\bin;C:\MinGW\bin;C:\devtools\bin\Ruby200\bin;C:\Windows\system32\WindowsPowerShell\v1.0\;C:\Python27\;C:\Python27\Scripts;C:\ImageMagick;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\PROGRA~1\IBM\CLIENT~1;C:\PROGRA~1\IBM\CLIENT~1\Shared;C:\PROGRA~1\IBM\CLIENT~1\Emulator;c:\Program Files\Java\jdk1.7.0_45\bin;C:\Program Files\Java\jdk1.7.0_51\/bin;C:\Apache Subversion 1.8.8\bin;C:\limejs\bin;C:\DevStack\mysql-5.6.19\bin;C:\DevStack\mysql-5.6.19\;C:\DevStack\mysql-5.6.19\Doctrine extensions for PHP\;c:\DevStack\php;c:\DevStack\php\ext;C:\Program Files\nodejs\;C:\Users\vmielke\AppData\Roaming\npm;C:\ProgramData\chocolatey\bin;C:\devtools\bin;\Git\bin;\Git\cmd;C:\devtools\bin\ruby\bin;C:\Users\vmielke\.gems;C:\Users\vmielke\.gems\bin                                    [SystemRoot] => C:\Windows                                    [COMSPEC] => C:\Windows\system32\cmd.exe                                    [PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.RB;.RBW                                    [WINDIR] => C:\Windows                                    [SERVER_SIGNATURE] =>                                     [SERVER_SOFTWARE] => Apache/2.4.16 (Win32) OpenSSL/1.0.2d PHP/5.5.14                                    [SERVER_NAME] => clever-coffee.net                                    [SERVER_ADDR] => 127.0.0.1                                    [SERVER_PORT] => 80                                    [REMOTE_ADDR] => 127.0.0.1                                    [DOCUMENT_ROOT] => C:/vhosts/clever-coffee.net                                    [REQUEST_SCHEME] => http                                    [CONTEXT_PREFIX] =>                                     [CONTEXT_DOCUMENT_ROOT] => C:/vhosts/clever-coffee.net                                    [SERVER_ADMIN] => admin@clever-coffee.net                                    [SCRIPT_FILENAME] => C:/vhosts/clever-coffee.net/html/admin/add_inventory.php                                    [REMOTE_PORT] => 58816                                    [REMOTE_USER] => vmielke                                    [AUTH_TYPE] => Basic                                    [GATEWAY_INTERFACE] => CGI/1.1                                    [SERVER_PROTOCOL] => HTTP/1.1                                    [REQUEST_METHOD] => GET                                    [QUERY_STRING] =>                                     [REQUEST_URI] => /html/admin/add_inventory.php                                    [SCRIPT_NAME] => /html/admin/add_inventory.php                                    [PHP_SELF] => /html/admin/add_inventory.php                                    [PHP_AUTH_USER] => vmielke                                    [PHP_AUTH_PW] => password                                    [REQUEST_TIME_FLOAT] => 1441830236.003                                    [REQUEST_TIME] => 1441830236                                )                            [connect] => mysqli Object                                (                                    [affected_rows] => -1                                    [client_info] => mysqlnd 5.0.11-dev - 20120503 - $Id: bf9ad53b11c9a57efdb1057292d73b928b8c5c77 $                                    [client_version] => 50011                                    [connect_errno] => 0                                    [connect_error] =>                                     [errno] => 1054                                    [error] => Unknown column 'sc.size' in 'order clause'                                    [error_list] => Array                                        (                                            [0] => Array                                                (                                                    [errno] => 1054                                                    [sqlstate] => 42S22                                                    [error] => Unknown column 'sc.size' in 'order clause'                                                )                                        )                                    [field_count] => 0                                    [host_info] => 127.0.0.1 via TCP/IP                                    [info] =>                                     [insert_id] => 0                                    [server_info] => 5.5.5-10.0.17-MariaDB                                    [server_version] => 50505                                    [stat] => Uptime: 116256  Threads: 1  Questions: 1928  Slow queries: 0  Opens: 25  Flush tables: 1  Open tables: 88  Queries per second avg: 0.016                                    [sqlstate] => 00000                                    [protocol_version] => 10                                    [thread_id] => 375                                    [warning_count] => 0                                )                            [page_title] => Add Inventory                            [message] =>                             [affected] => 0                            [_SESSION] => Array                                (                                )                            [query3] => (SELECT CONCAT("G", ncp.id) AS sku, ncc.category, ncp.name, FORMAT(ncp.price/100, 2) AS price, ncp.stock FROM non_coffee_products AS ncp INNER JOIN non_coffee_categories AS ncc ON ncc.id=ncp.non_coffee_category_id ORDER BY category, name) UNION (SELECT CONCAT("C", sc.id),gc.category, CONCAT_WS(" - ", s.size, sc.caf_decaf, sc.ground_whole), FORMAT(sc.price/100, 2), sc.stockFROM specific_coffees AS sc INNER JOIN sizes AS s ON s.id=sc.size_id INNER JOIN general_coffees AS gcON gc.id=sc.general_coffee_id ORDER BY sc.general_coffee_id, sc.size, sc.caf_decaf, sc.ground_whole)                            [result] =>                         )                )        )    [1] => Array        (            [file] => C:\vhosts\clever-coffee.net\html\admin\add_inventory.php            [line] => 94            [function] => mysqli_fetch_array            [args] => Array                (                    [0] =>                     [1] => 1                )        ))

Share this post


Link to post
Share on other sites

Sorry about that, but kudos for figuring it out and thanks for letting us know! I'll make a note to see if it's a mistake on my part.

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...

×
×
  • Create New...