Jump to content
Larry Ullman's Book Forums

CraneWing

Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About CraneWing

  • Rank
    Newbie
  1. Found it myself! "sc.size" should be "sc.size_id" in a couple instances. Possible errata?
  2. 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 ) ))
  3. I am trying to do this in the tutorial for the coffee shop site. I have set up a virtual host on my computer's Apache server called clever-coffee.net. It is listening on Port 80. Where I am tripped up is going to the checkout page for the coffee shop. I wanted to do as the original poster did, which was have all pages unsecure (http) until checking out, and then go to https. I have done a lot of Googling and searcing Stack Overflow and can't find a solution to "hand off" from http to https. I thought that the .htaccess file and the Apache vhosts-httpd.conf files were the key. However, no matter what I read and tried, I can't shift to https. This is my .htaccess file: <IfModule mod_rewrite.c> Options +FollowSymLinks -Multiviews RewriteEngine On RewriteBase / # this prevents access to "html" systems folder to 403 Forbidden RedirectMatch 403 ^.*/html/index\.php$ # Check to see if user is attempting to access valid file, # such as image or css document. # If false, sends request to index.php. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # sales: RewriteRule ^shop/sales/?$ sales.php # primary categories: RewriteRule ^shop/(coffee|goodies)/?$ /shop.php?type=$1 # specific products: RewriteRule ^browse/(coffee|goodies)/([A-Za-z\+\-]+)/([0-9]+)/?$ browse.php?type=$1&category=$2&id=$3 # For HTTPS pages: RewriteRule %{HTTPS} off RewriteRule ^(checkout\.php|billing\.php|final\.php|admin/(.*))$ https://%{HTTP_HOST}/$1 [R=301,L] </IfModule> <IfModule !mod_rewrite.c> # If mod_rewrite is not installed, all 404s can be send to index.php ErrorDocument 404 /index.php </IfModule> And httpd-vhosts file: <VirtualHost *:80> DocumentRoot "/usr/docs/clever-coffee.net" ServerName clever-coffee.net ServerAlias www.clever-coffee.net <Directory "/usr/docs/clever-coffee.net"> AllowOverride All Require local </Directory> </VirtualHost> NameVirtualHost *:443 <VirtualHost *:443> DocumentRoot "/usr/docs/clever-coffee.net" ServerName clever-coffee.net ServerAlias www.clever-coffee.net SSLCertificateFile "/private/etc/apache2/ssl/clever-coffee.net.crt" SSLCertificateKeyFile "/private/etc/apache2/ssl/clever-coffee.net.key" <Directory "/usr/docs/clever-coffee.net"> AllowOverride All Require local </Directory> </VirtualHost>
×
×
  • Create New...