Copy code The code is as follows:
@mysql_connect("localhost", "root","1981427" ) //You need to connect to the database server before selecting the database
or die("Database server connection failed");
@mysql_select_db("test") //Select the database mydb
or die("The database does not exist or not available");
$query = @mysql_query("select * from tablename1") //Execute SQL statement
or die("SQL statement execution failed");
?>
Copy code The code is as follows:
@mysql_connect("localhost ", "root","1981427") //You need to connect to the database server before selecting the database
or die("Database server connection failed");
@mysql_select_db("test") //Select database mydb
or die("Database does not exist or is unavailable");
$query = @mysql_query("insert into tablename1 values('4', 'Judy','456')")
or die( "SQL statement execution failed");
?>
Copy code The code is as follows:
@mysql_connect("localhost", "root","1981427") //You need to connect to the database server before selecting the database
or die("Database server connection failed") ;
@mysql_select_db("test") //Select database mydb
or die("Database does not exist or is unavailable");
$query = @mysql_query("select * from tablename1") // Execute SQL statement
or die("SQL statement execution failed");
echo mysql_result($query, 0, 'username'); //Output the name column of row 0
?>
http://www.bkjia.com/PHPjc/319926.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319926.htmlTechArticleCopy the code as follows: ?php @mysql_connect("localhost", "root","1981427") // Before selecting the database, you need to connect to the database server or die ("Database server connection failed"); @my...