The PHP DB runquery function is used to execute a SQL query on a database using PHP. It is commonly used for retrieving data from a database or updating the data in the database.
Example 1: Retrieving data from a database
include 'database_connection.php'; $query = "SELECT name, age FROM users"; $result = $db->runquery($query); while($row = mysqli_fetch_assoc($result)) { echo "Name: ".$row['name']." Age: ".$row['age']." "; } ?>
In this example, the code retrieves all the name and age values from the users table in the database. The package library used here is mysqli.
Example 2: Updating data in a database
include 'database_connection.php'; $query = "UPDATE users SET name='John', age=25 WHERE id=1"; $db->runquery($query); ?>
In this example, the code updates the name and age values for the record with the id of 1 in the users table. The package library used here is mysqli.
To determine the package library, look for the connection file which will contain information on the database specific routines and extensions used in the code.
PHP Db::runQuery - 30 examples found. These are the top rated real world PHP examples of Db::runQuery from package thinksns extracted from open source projects. You can rate examples to help us improve the quality of examples.