note 47794 deleted from function.mysqli-query by sean
| From: | sean@php.net | Date: | Wed, 01 Dec 2004 01:52:01 +0000 |
| Subject: | note 47794 deleted from function.mysqli-query by sean | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-81206@lists.php.net to get a copy of this message | ||
Note Submitter: paulfp at gmail dot com
----
Be careful with this function as it behaves differently from mysql_query() in that you must supply 2
arguments, the first being a link to the database connection you have opened, eg.
$terms = mysqli_query($database, "SELECT content FROM cms WHERE page =
'terms'");
on the page where you want the query. If you have connected to the database from an external file
then make sure you use the "global" keyword so that the database connection is accessible
in the script with the query.
eg.
function db_connect()
{
global $database;
@ $database = mysqli_connect("localhost", "username", "password");
@ $select = mysqli_select_db($database, "db_name");
}
Personally I think it's a pain in the ar$e cos i've gotta go through changing all my code
now.
----
Reason: useless note