Re: mysql newbie

From: Date: Sun, 27 Aug 2000 14:53:22 +0000
Subject: Re: mysql newbie
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-13838@lists.php.net to get a copy of this message
> can any one point me to some simple documentation for doing the > following FROM WITHINA PHP3 script > - creating a new table in a db > - showing a list of all tables in a given db > - adding new data into tables > - deleting data into tables > - searching tables > - querying the tables. First of all you should look at these two locations: http://www.mysql.com/documentation/ http://www.php.net/manual/ (or http://snaps.php.net/manual) Especially this section of the PHP manual: http://www.php.net/manual/ref.mysql.php Create a new table: CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)] [table_options] [select_statement] Example: CREATE TABLE foo (a int not null auto_increment, primary key (a), b varchar (50)) Documentation here: http://www.mysql.com/documentation/mysql/commented/manual.php?section=CR EATE_TABLE Show list of tables in db: SHOW TABLES [FROM db_name] [LIKE wild] Example: SHOW TABLES FROM foo Documentation here: http://www.mysql.com/documentation/mysql/commented/manual.php?section=SH OW Adding new data to a table: INSERT [LOW_PRIORITY | DELAYED] [IGNORE] [INTO] tbl_name [(col_name,...)] VALUES (expression,...),(...),... Example: INSERT INTO foo (a, b) VALUES (NULL, 'bar') Documentation here: http://www.mysql.com/documentation/mysql/commented/manual.php?section=IN SERT Deleting data from a table: DELETE [LOW_PRIORITY] FROM tbl_name [WHERE where_definition] [LIMIT rows] Example: DELETE FROM foo WHERE a=5 OR b='bar' Documentation here: http://www.mysql.com/documentation/mysql/commented/manual.php?section=DE LETE Searching/querying tables: Examples: SELECT b FROM foo WHERE b LIKE '%sometext% SELECT * FROM foo WHERE a > 5 SELECT a, b FROM foo WHERE (a>=90 AND b LIKE 'bar%') OR (b='foobar') Documentation here: http://www.mysql.com/documentation/mysql/commented/manual.php?section=SE LECT here: http://www.mysql.com/documentation/mysql/commented/manual.php?section=Fu nctions and here: http://www.mysql.com/documentation/mysql/commented/manual.php?section=St ring_functions > sorry this seems so, ummmmm, basic, but all the documentation seems to > be either very brief, or way to techie for me this weekend :) I hope the above helps you :-) > thanks heaps in advance > justin french Best regards, Jesper Juhl juhl@eisenstein.dk

« previous php.general (#13838) next »