Welcome To Snipplr
Everyone's Recent PHP Snippets Tagged mysql
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
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
976
posted 14 years ago by Heroftime
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
596
posted 14 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
735
posted 14 years ago by aristoworks
A very simple class that quickly gets you interacting with a database, as long as you know sql :P.
1
1333
posted 15 years ago by r3morse
This snippet collects a date from a var and formats it into the correct format for database date entry
0
853
posted 15 years ago by daveismyname
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
1012
posted 15 years ago by acosonic
This piece of code will store each line of a txt file into a mysql database
2
1170
posted 15 years ago by fackz
Outputs MySQL server stats : uptime, threads, questions, slow queries, opens, flush tables, open tables, queries per sec (avg).
2
645
posted 15 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
847
posted 15 years ago by brownrl
Need a function to clean your _POST array before inserting into a database? Just pass $_POST to this function.
1
1106
posted 15 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
1021
posted 15 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
746
posted 15 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
866
posted 15 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
860
posted 15 years ago by jiggyhat
Este codigo inserta un registro en una base de datos mysql utilizando PHP
0
987
posted 15 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
843
posted 15 years ago by dawjdh