Copy codeThe Code is as follows:
<? Php
@ 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 ");
?>
Copy codeThe Code is as follows:
<? Php
@ 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 ");
?>
Copy codeThe Code is as follows:
<? Php
@ 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
?>