note 47794 added to function.mysqli-query
| From: | paulfp at gmail dot com | Date: | Tue, 30 Nov 2004 15:53:03 +0000 |
| Subject: | note 47794 added to function.mysqli-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-81185@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/function.mysqli-query.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+47794
Delete -- http://master.php.net/manage/user-notes.php?action=delete+47794&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47794&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47794&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47794&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47794&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47794&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+47794&report=yes
Search -- http://master.php.net/manage/user-notes.php