Tag Archive

Perl script make MySQL query, binds variables, outputs JSON

By Colin

An example of a Perl script that is called by an ajax request. The script takes in just one parameter, opens a MySQL DB connection, binds the parameter to the query, and sends the query. The result is then formatted into JSON and returned to the browser. This can be seen in action... »

Perl script makes MySQL query; outputs to JSON

By Colin

An example of a perl script that is called by an ajax request. The script takes in a few parameters, opens a mySQL DB connection, and then makes a rather tortuous query. The result is then formatted in to JSON and returned to the browser. »

Handy MySQL Commands

By Colin

To reset an auto_increment field to 1: ALTER TABLE tbl_name AUTO_INCREMENT = 1; To load a local csv file into an empty existing table: LOAD DATA LOCAL INFILE ‘/completePathToLocalData.csv’ INTO TABLE tableName FIELDS TERMINATED BY ‘,’ ENCLOSED BY ‘”‘ LINES TERMINATED BY ‘\n’ IGNORE 1 LINES; This assumes you’ve already created your empty table with the same number... »