Php SQL statement execution. Copy the code as follows :? Php @ mysql_connect (localhost, root, 1981427) before selecting a database, connect to the database server ordie (database server connection failed); @ my
The code is as follows:
@ Mysql_connect ("localhost", "root", "1981427") // you must connect to the database server before selecting a database.
Or die ("database server connection failed ");
@ Mysql_select_db ("test") // select the database mydb
Or die ("The database does not exist or is unavailable ");
$ Query = @ mysql_query ("select * from tablename1") // execute an SQL statement
Or die ("SQL statement execution failed ");
?>
The code is as follows:
@ Mysql_connect ("localhost", "root", "1981427") // you must connect to the database server before selecting a database.
Or die ("database server connection failed ");
@ Mysql_select_db ("test") // select the database mydb
Or die ("The database does not exist or is unavailable ");
$ Query = @ mysql_query ("insert into tablename1 values ('4', 'Judy ', '123 ')")
Or die ("SQL statement execution failed ");
?>
The code is as follows:
@ Mysql_connect ("localhost", "root", "1981427") // you must connect to the database server before selecting a database.
Or die ("database server connection failed ");
@ Mysql_select_db ("test") // select the database mydb
Or die ("The database does not exist or is unavailable ");
$ Query = @ mysql_query ("select * from tablename1") // execute an SQL statement
Or die ("SQL statement execution failed ");
Echo mysql_result ($ query, 0, 'Username'); // output the name column of row 0th
?>
The http://www.bkjia.com/PHPjc/319926.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/319926.htmlTechArticle code is as follows :? Php @ mysql_connect ("localhost", "root", "1981427") // before selecting a database, connect to the database server or die ("database server connection failed "); @ my...