Escape Sequences Used In MySQL
From the MySQL website:
For input, if the
FIELDS ESCAPED BY
character is not empty, occurrences of that character are stripped and the following character is taken literally as part of a field value. Some two-character sequences that are exceptions, where the first character is the escape character. These sequences are shown in the following table (using “\
†for the escape character). The rules forNULL
handling are described later in this section.
\0
An ASCII NUL ( 0x00
) character\b
A backspace character \n
A newline (linefeed) character \r
A carriage return character \t
A tab character. \Z
ASCII 26 (Control-Z) \N
NULL For more information about “
\
â€-escape syntax, see Section 8.1, “Literal Valuesâ€.
This post was written by Content Curator on November 16, 2009
How to Show MySQL Warnings at CLI
When logged in to the MySQL server using the command line interface (CLI) the generated errors on the previously run command.
mysql> show warnings;
Thanks to Trevor Nichols and www.issociate.de
This post was written by Content Curator on November 16, 2009
How to Select First Last or Range of Records in MySQL Table
When using MySQL, and wanting to retrieve the first n records from a table, one can use the LIMIT function. It can also be used to grab a range of records, not just a series starting with the first record. Use as follows:
SELECT * FROM yourtable LIMIT yourlowlimit,yourhighlimit;
This will return all rows between the number yourlowlimit and yourhighlimit inclusive.
e.g. SELECT FROM users LIMIT 20,50
will return the rows 20, 21, 22,…, 49, 50
This post was written by Content Curator on November 16, 2009
How to Delete Records in PHP using MySQL
The code in the HTML/PHP markup would look something like:
<?php mysql_query("DELETE FROM yourtable WHERE yourfield='yourvalue' ")
or die(mysql_error()); ?>
This code deletes any record from the table named “yourtable” when that record’s field named “yourfield” is identically equal to “yourvalue”. The names of these objects will, of course, be replaced by the unique names that your set up uses.
Source: tizag.com – excellent tutorials on all kinds of coding, programming, and other technical stuff.
Posted under Freeware, MySQL, WebDev
This post was written by Content Curator on November 16, 2009
MySQL login with command line (CLI)
# mysql -h hostname -u username -p
It will prompt you for the password.
Then:
> connect dbname
Posted under MySQL
This post was written by Content Curator on September 17, 2007