MySQL

Error message

Deprecated function: Function create_function() is deprecated in GeSHi->_optimize_regexp_list_tokens_to_string() (line 4698 of /home/digipiph/public_html/sites/all/libraries/geshi/geshi.php).

PHP Dynamic Variables

Let's say that you have a bunch of data in a recordset and you want to populate that data into a list of variables. In my example we will draw 20 items from a players inventory from a MySQL table which stores all the items for a player in rows we call slot_1, slot_2, slot_3, … all the way to 20. So when we pull all of the items from the MySQL table we want to assign them to variables respectively. For example, our variable of "slot_1" that we are creating will equal "slot_1" from the MySQL table.

MySQL Joins (Left and Inner)

MYSQL Joins are confusing, to say the least. I was successfully able to do one a few different ways and thought it be best to write down how I did it so I can do it in the future.

What I had was two different tables. One table was xcart_products_categories which stores all "productid" and matches them with which category they go to "categoryid". The other table which was xcart_products had the “productid” and all of its information.

Reset a MySQL Recordset with PHP

When you run a recordset through a loop, you will not be able to re-run the recordset further down in the same page. Here is how to reset the recordset so you can use it again on the same page. Just place this code after your loop. Change the "$Recordset" to your recordset's variable.

Create a PHP Recordset

Recordsets in PHP are useful bits of code used to display data that is stored within a MYSQL table. You can run a loop to display all of this data or you can display only the bit of information you want. Here is how I do this:

Pages

Subscribe to RSS - MySQL