Copy code The code is as follows:
include("adodb/adodb.inc.php"); /Contains adodb class library file
$conn = NewADOConnection('mysql'); //Connect to the database
$conn -> Connect('localhost', 'root', '1981427', 'test');
$conn -> Execute("insert into tablename1 values('9','zhuzhao', 'Simon')"); //Execute SQL
?>
Copy code The code is as follows:
include("adodb/adodb.inc.php"); /Contains adodb class library file
$conn = NewADOConnection('mysql'); //Create adodb object and declare the database type to be MySQL
$conn->Connect("localhost", "root", "1981427 ", "test"); //Connect to the database, where mydb is the database name
$sqle = $conn->Execute("insert into tablename1 values('10','zhuzhao','Simon')") ; //Use $sqle to determine whether SQL execution is successful
if($sqle) //If execution is successful, output successful execution information
{
echo "SQL execution is successful";
}
else //If execution fails, output error message
{
echo $conn->ErrorMsg();
}
?>
Copy code The code is as follows:
include("adodb/adodb.inc.php"); /Contains adodb class library file
$conn = NewADOConnection('mysql'); //Create adodb object and declare the database type to be MySQL
$conn->Connect("localhost", "root", "1981427 ", "test"); //Connect to the database, where mydb is the database name
$rs = $conn->Execute("SELECT * FROM tablename1"); //Execute the SQL statement and save the results in the result set
if($rs) //If the execution is successful, output information about the successful execution of the statement
{
echo "The statement is executed successfully";
}
else //If the execution fails, then Output error message
{
echo $conn->ErrorMsg();
}
?>
Copy code The code is as follows:
include("adodb/adodb.inc.php"); //Include adodb class library file
$conn = NewADOConnection('mysql'); //Create an adodb object and declare the database type to be MySQL
$conn->Connect("localhost", "root", "1981427", "test"); //Connect to the database , where mydb is the database name
$rs = $conn->Execute("SELECT * FROM tablename1"); //Execute the SQL statement and save the results in the result set
if($rs) //If If the execution is successful, then loop to read the result set
{
while (!$rs->EOF) //Loop to read all records in $rs
{
echo $rs-> fields[0].' '.$rs->fields[1].' '.$rs->fields[2].'
'; //Output the current line
$rs-> ;MoveNext(); //Move the pointer to the next record
}
}
else //If the execution fails, output an error message
{
echo $conn->ErrorMsg ();
}
?>
Copy code The code is as follows:
include("adodb/adodb.inc.php"); //Include adodb class library file
$conn = NewADOConnection('mysql'); //Create adodb object and declare database type For MySQL
$conn->Connect("localhost", "root", "1981427", "test"); //Connect to the database, where mydb is the database name
$rs = $conn-> Execute("SELECT * FROM tablename1"); //Execute the SQL statement and save the results in the result set
if($rs) //If the execution is successful, loop to read the result set
{
while (!$rs->EOF) //Loop to read all records in $rs
{
echo $rs->fields['id'].' '.$rs->fields[ 'username'].' '.$rs->fields['password'].'
'; //Output the current line
$rs->MoveNext(); //Move the pointer to Next record
}
}
else //If execution fails, output error message
{
echo $conn->ErrorMsg();
}
? >
http://www.bkjia.com/PHPjc/320050.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320050.htmlTechArticleCopy the code as follows: ?php include("adodb/adodb.inc.php"); //Include adodb Class library file $conn = NewADOConnection('mysql'); //Connect to the database $conn - Connect('localhost', 'root',...