Search, then an empty string is used for the rest of
Header ("location:".Getting Started Introduction A simple tutorial Language Reference Basic syntax Types Variables Constants Expressions Operators Control Structures Functions Classes and Objects Namespaces Enumerations Errors Exceptions Generators Attributes References Explained Predefined Variables Predefined Exceptions Predefined Interfaces and Classes Context options and parameters Supported Protocols and Wrappers Security Introduction General considerations Installed as CGI binary Installed as an Apache module Session Security Filesystem Security Database Security Error Reporting User Submitted Data Hiding PHP Keeping Current Features HTTP authentication with PHP Cookies Sessions Dealing with XForms Handling file uploads Using remote files Connection handling Persistent Database Connections Command line usage Garbage Collection DTrace Dynamic Tracing Function Reference Affecting PHP's Behaviour Audio Formats Manipulation Authentication Services Command Line Specific Extensions Compression and Archive Extensions Cryptography Extensions Database Extensions Date and Time Related Extensions File System Related Extensions Human Language and Character Encoding Support Image Processing and Generation Mail Related Extensions Mathematical Extensions Non-Text MIME Output Process Control Extensions Other Basic Extensions Other Services Search Engine Extensions Server Specific Extensions Session Extensions Text Processing Variable and Type Related Extensions Web Services Windows Only Extensions XML Manipulation GUI Extensions Keyboard Shortcuts ? This help j Next menu item k Previous menu item g p Previous man page g n Next man page G Scroll to bottom g g Scroll to top g h Goto homepage g s Goto searchĪrrays, then str_replace() takes a value from each arrayĪnd uses them to search and replace on subject.
Here is the full function for adding an item to the cart. add 1 to quantity if item in cart already Manage.php looks like this.Įlse if (array_key_exists($_GET, $_SESSION)) The file that adds items to the cart and uses the function above is manage.php. Now the other server is on a certain hosting company so I can't make changes to their php.ini file =/. I do have all the error reports turned on too on my localserver. Items get added correctly without any errors. if globasl if off then you must refer to the session directly. (perhaps you shoudl clone the php.ini settings of the server too!!!!) If globals is on the $id will be 'assumed' teh $id from the session var. I suspect you have register globals on your own computer set to a different value than it is on the server. So the next page you use $id on it will take the array $id from the session array. Since this is a session variable when you add another item to the cart $id is actually an array of 8 elements (0-8). How is $id defined prior to these lines of code? I refer to the value of $id used in the mysql query. If you go and switch it on and DON'T get the same errors then something is a miss.Īlso check you are running the same versions of apache, php and mysql as the 'live' server. It simply appears that on your own machine you have error reporting switched off in your php.ini file. So right now it currently does not add anything on the cart.
I don't understand how this code works on one server and not the other. $num_rows = mysql_num_rows($sel_products) returns the number of rows in a result, if 1 item exists if 0 item doesn't exists. $item = mysql_fetch_array($sel_products) $sel_products = mysql_query("SELECT special_pick, special, price, artist, album FROM products WHERE id=".$id."") (Note: Lines 42-57 are the lines like $_SESSION) The code that adds the stuff onto the cart is the following. Warning: Cannot use a scalar value as an array in /home/joeystec/public_html/test/php/lib/ on line 57 Warning: Cannot use a scalar value as an array in /home/joeystec/public_html/test/php/lib/ on line 56 Warning: Cannot use a scalar value as an array in /home/joeystec/public_html/test/php/lib/ on line 55 Warning: Cannot use a scalar value as an array in /home/joeystec/public_html/test/php/lib/ on line 54 Warning: Cannot use a scalar value as an array in /home/joeystec/public_html/test/php/lib/ on line 53 Warning: Cannot use a scalar value as an array in /home/joeystec/public_html/test/php/lib/ on line 51 Warning: Cannot use a scalar value as an array in /home/joeystec/public_html/test/php/lib/ on line 43 QUOTEWarning: Cannot use a scalar value as an array in /home/joeystec/public_html/test/php/lib/ on line 42 I'm writing a simple cart script right now and for some reason when I moved it to another server I got these errors when I try to add an item to the cart.