Welcome To Snipplr
Everyone's Recent Snippets Tagged mysql
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
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
Handy when web hosts limit database upload size. Create folder in home directory call "mysql_dump", upload and extract mysql file into this directory. Ask web host to enable SSH.
0
978
posted 15 years ago by hotdiggity
This script shows the top 10 worst indexes (in terms of selectivity %) on the whole MySQL server instance. Selectivity is the percentage of distinct values in an indexed field compared to the number of records in the table.
Note that this query can...
1
752
posted 15 years ago by Eloi
This will create and then populate a MySQL table with a list of the names for countries in existence. Country names are in Turkish language.
0
1224
posted 15 years ago by sensimevanidus
granting DB specific and general access priveleges from the CLI
1
844
posted 15 years ago by stiobhart
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
869
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
862
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
Splitting table users in frequently and infrequently accessed attributes
2
1175
posted 15 years ago by Eloi
Saving the IP as Int we save a lot of space and permit do beautibul selects
2
786
posted 15 years ago by Eloi
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
844
posted 15 years ago by dawjdh
Simple way to escape string for LIKE statements, useful for searches.
3
739
posted 15 years ago by robv
When you forget to "SET NAMES utf8", you'll probably end up with a bunch of latin1 data in your utf8 column. This query fixes that, CONVERTing the existing data to its correct collation.
4
852
posted 15 years ago by jdbartlett
Database backup function that you can call whenever you want — including nightly CRONs.
6
1078
posted 15 years ago by fackz