Welcome To Snipplr


Everyone's Recent PHP Snippets Tagged mysql



1 2066 posted 16 years ago by ginoplusio
1 1450 posted 16 years ago by ginoplusio
A utility function to preserve an array in a session. Adding the newest element to the beginning of the array and popping out the last one. Useful for displaying for instance; your last searches option in your website.
1 1746 posted 16 years ago by Heroftime
1 1875 posted 16 years ago by ginoplusio
Every MySQL class for PHP I've seen so far has been an epic disappointment. This will not lead you to feel the same way. Enjoy!
0 1070 posted 16 years ago by jrgp
I wrote this really quick and dirty script to paginate a very large chunk of text. A client site was setup with the understanding their about page would consist of 5-6 paragraphs but their biography ended up being 60 paragraphs. At the end of the d...
0 1291 posted 16 years ago by aristoworks
0 1775 posted 16 years ago by loric
1 1291 posted 16 years ago by ReeceMarsland
A very simple class that quickly gets you interacting with a database, as long as you know sql :P.
1 2088 posted 16 years ago by r3morse
This snippet collects a date from a var and formats it into the correct format for database date entry
0 1542 posted 16 years ago by daveismyname
3 1619 posted 16 years ago by nkm
Dumps whole query so developer can see where is error. However it's potential security issue, exposing SQL commands to attacker. (Recommended to use only during development, replace message code with some custom error text)
0 1755 posted 16 years ago by acosonic
This piece of code will store each line of a txt file into a mysql database
2 2193 posted 16 years ago by fackz
0 1215 posted 16 years ago by jonniespratley
Outputs MySQL server stats : uptime, threads, questions, slow queries, opens, flush tables, open tables, queries per sec (avg).
2 1146 posted 16 years ago by NyX
Here is a small function that I use to update records in a database. It coincides with the insertFromPost function that I have posted earlier. The element names in the form need to have the same name as in the DB and the field names should all...
1 1657 posted 16 years ago by brownrl
Need a function to clean your _POST array before inserting into a database? Just pass $_POST to this function.
1 2742 posted 16 years ago by the_dev
Here is the correct way to turn your mysql results into an array. Forget the other nonsense of useless code. Why type out this long code: "for($i = 0; $array[$i] = mysqli_fetch_assoc($result); $i++) ;" when you can accomplish the same thing with m...
1 1671 posted 16 years ago by the_dev
Use this function to print out all the rows in a table. Specify columns to show using the columnstring parameter: tablulardata(tablename, columnstring); ie: tabluardata("users","username=Username|fname=First Name|lname=Last Name");
1 1496 posted 16 years ago by kilrizzy
Use this function to pull all columns from a single database field. getrowdata(tablename,rowid,prefix); You would call this function like: getrowdata("users",$_SESSION['user'],"user_"); The prefix is the prefix you want for the array names,...
1 1674 posted 16 years ago by kilrizzy
This will create a Navigation from a MySQL database table names. It removes the table name "includes" by default so you can see how to remove any certain tables you wish to not use as a site section. Just plug in your MySQL database details and co...
3 1782 posted 16 years ago by jiggyhat
Este codigo inserta un registro en una base de datos mysql utilizando PHP
0 1678 posted 16 years ago by denker
In phpMyAdmin you can define strftime formats for your dumped database sql files. Here you are with two formats, one for sigle table export, one for multi-table export.
0 1412 posted 16 years ago by dawjdh