Hosting News & Commentary Hosting News & Commentary Hosting News & Commentary

768 Part VII: Appendixes For example, to add data to the customers table in the store database, you can run the following: mysql> insert into customers (name,address,telephone) values( Mohammed Kabir , 2904 Wead Way, Sacramento, CA 95833 , 555-5555 ); Query OK, 1 row affected (0.33 sec) Note that the values should be properly quoted if the values contain any characters that could confuse the statement. Such characters include the comma ( , ), a space ( ), a quote ( ), etc. If you must use a quote character of any type in the data, be sure to use the opposite quote to surround the values. For example, if you use an apostrophe (which is a single-quote), surround the data with a double-quote. The preceding command inserts a row in the customers table. Notice that we do not use the id field in the insert statement because it is set to auto_increment and therefore is automatically inserted as the next available value. Note that you do not have to ever explicitly deal with setting an auto_increment field, nor do you have to worry about multiple clients causing an error the MySQL developers have taken care of almost any contingencies. Querying data from a database To find data in a table, you need to use SELECT statements, as shown here: select field_list FROM table_name WHERE conditions; This statement enables you to find field_list data from a table called table_name, where the data meets the given conditions. For example: mysql> select name from customers where id = 1; | name | | Mohammed Kabir | 1 row in set (0.01 sec)

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Cheap Hosting services

Tag: php hosting

  1. No user reviews yet.


Leave a Reply