Some MySQL For The Brain
Tuesday, March 4th, 2008Looking for a few, quick PHP+MySQL tips? You found some.
List all tables in the pre-set database:
SHOW TABLES;
Always, always, always use an auto-incrementing unique ID:
CREATE TABLE table_name (
id INT NOT NULL AUTO_INCREMENT,
table_field1 varchar(250) NOT NULL default ”,
PRIMARY KEY (id)
);
Adding to an auto-incrementing table:
@mysql_query(”insert into table_name values(NULL,’My Field’)”);
There’s actually three different PHP API’s which you can use:
The [...]



