Phpdaodb inserts, updates, and deletes data. Copy the code as follows :? Phpinclude (adodbadodb. inc. php); contains the adodb class library file $ connNewADOConnection (mysql); connects to the database $ conn-Connect (localhost, root,
The code is as follows:
Include ("adodb/adodb. inc. php"); // contains the adodb class library file
$ Conn = NewADOConnection ('mysql'); // connect to the database
$ Conn-> Connect ('localhost', 'root', '123', 'test ');
$ Conn-> Execute ("insert into tablename1 values ('9', 'zhuzhao', 'Simon ')"); // Execute SQL
?>
The code is as follows:
Include ("adodb/adodb. inc. php"); // contains the adodb class library file
$ Conn = NewADOConnection ('mysql'); // creates an adodb object and declares that the database type is 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 the execution succeeds, the execution succeeds.
{
Echo "SQL execution successful ";
}
Else // if the execution fails, the error message is output.
{
Echo $ conn-> ErrorMsg ();
}
?>
The code is as follows:
Include ("adodb/adodb. inc. php"); // contains the adodb class library file
$ Conn = NewADOConnection ('mysql'); // creates an adodb object and declares that the database type is 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 result in the result set
If ($ rs) // if execution is successful, information about successful execution of the statement is output.
{
Echo "statement execution successful ";
}
Else // if the execution fails, the error message is output.
{
Echo $ conn-> ErrorMsg ();
}
?>
The code is as follows:
Include ("adodb/adodb. inc. php"); // contains the adodb class library file
$ Conn = NewADOConnection ('mysql'); // creates an adodb object and declares that the database type is 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 result in the result set
If ($ rs) // if the execution is successful, the result set is read cyclically.
{
While (! $ Rs-> EOF) // read all records in $ rs cyclically
{
Echo $ rs-> fields [0]. ''. $ rs-> fields [1].''. $ rs-> fields [2].'
'; // Output the current row
$ Rs-> MoveNext (); // move the pointer to the next record
}
}
Else // if the execution fails, the error message is output.
{
Echo $ conn-> ErrorMsg ();
}
?>
The code is as follows:
Include ("adodb/adodb. inc. php"); // contains the adodb class library file
$ Conn = NewADOConnection ('mysql'); // creates an adodb object and declares that the database type is 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 result in the result set
If ($ rs) // if the execution is successful, the result set is read cyclically.
{
While (! $ Rs-> EOF) // read all records in $ rs cyclically
{
Echo $ rs-> fields ['id']. ''. $ rs-> fields ['username']. ''. $ rs-> fields ['password'].'
'; // Output the current row
$ Rs-> MoveNext (); // move the pointer to the next record
}
}
Else // if the execution fails, the error message is output.
{
Echo $ conn-> ErrorMsg ();
}
?>
The http://www.bkjia.com/PHPjc/320050.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/320050.htmlTechArticle code is as follows :? Php include ("adodb/adodb. inc. php "); // contains the adodb class library file $ conn = NewADOConnection ('mysql'); // connects to the database $ conn-Connect ('localhost', 'root ',...