PHP daodb inserting, updating, and deleting data _php tutorial

Source: Internet
Author: User
Copy CodeThe code is as follows:
Include ("adodb/adodb.inc.php"); Contains the ADODB class library file
$conn = newadoconnection (' mysql '); Connecting to a database
$conn, Connect (' localhost ', ' root ', ' 1981427 ', ' test ');
$conn, Execute ("INSERT into tablename1 values (' 9 ', ' Zhuzhao ', ' Simon ')"); Execute SQL
?>

Copy CodeThe code is as follows:
Include ("adodb/adodb.inc.php"); Contains the ADODB class library file
$conn = newadoconnection (' mysql '); Create a ADODB object that 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 ('", ' Zhuzhao ', ' Simon ') "); Use $sqle to determine if SQL is performing successfully
if ($sqle)//If the execution succeeds, the output of the successful execution of the information
{
echo "SQL execution succeeded";
}
else//If execution fails, output error message
{
echo $conn->errormsg ();
}
?>

Copy CodeThe code is as follows:
Include ("adodb/adodb.inc.php"); Contains the ADODB class library file
$conn = newadoconnection (' mysql '); Create a ADODB object that 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 to save the result in the result set
if ($RS)//If execution succeeds, the output statement successfully executes the information
{
echo "statement execution succeeded";
}
else//If execution fails, output error message
{
echo $conn->errormsg ();
}
?>

Copy CodeThe code is as follows:
Include ("adodb/adodb.inc.php"); Contains the ADODB class library file
$conn = newadoconnection (' mysql '); Create a ADODB object that 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 to save the result in the result set
if ($RS)//If execution succeeds, loop read result set
{
while (! $rs->eof)//loop to read all records in $rs
{
Echo $rs->fields[0]. ' '. $rs->fields[1]. ' '. $rs->fields[2]. '
'; Output when moving forward
$rs->movenext (); Move the pointer to the next record
}
}
else//If execution fails, output error message
{
echo $conn->errormsg ();
}
?>

Copy CodeThe code is as follows:
Include ("adodb/adodb.inc.php"); Contains the ADODB class library file
$conn = newadoconnection (' mysql '); Create a ADODB object that 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 to save the result in the result set
if ($RS)//If execution succeeds, loop read result set
{
while (! $rs->eof)//loop to read all records in $rs
{
echo $rs->fields[' id ']. ' '. $rs->fields[' username '). ' '. $rs->fields[' password '). '
'; Output when moving forward
$rs->movenext (); Move the pointer to the next record
}
}
else//If execution fails, output error message
{
echo $conn->errormsg ();
}
?>

http://www.bkjia.com/PHPjc/320050.html www.bkjia.com true http://www.bkjia.com/PHPjc/320050.html techarticle Copy the code as follows: PHP include ("adodb/adodb.inc.php");//contains ADODB class library file $conn = newadoconnection (' mysql ');//Connect database $conn-conn ECT (' localhost ', ' root ',...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.