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
2195
posted 16 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
1457
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
1679
posted 16 years ago by aristoworks
A very simple class that quickly gets you interacting with a database, as long as you know sql :P.
1
2574
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
1980
posted 16 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
2283
posted 17 years ago by acosonic
This piece of code will store each line of a txt file into a mysql database
2
2686
posted 17 years ago by fackz
Outputs MySQL server stats : uptime, threads, questions, slow queries, opens, flush tables, open tables, queries per sec (avg).
2
1579
posted 17 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
2086
posted 17 years ago by brownrl
Need a function to clean your _POST array before inserting into a database? Just pass $_POST to this function.
1
3252
posted 17 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
2129
posted 17 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
1940
posted 17 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
2158
posted 17 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
2291
posted 17 years ago by jiggyhat
Este codigo inserta un registro en una base de datos mysql utilizando PHP
0
2162
posted 17 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
1849
posted 17 years ago by dawjdh
Simple way to escape string for LIKE statements, useful for searches.
3
1817
posted 17 years ago by robv