With MYSQLI, Check which database im connected to
| Newsgroups | php.general |
|---|---|
| Message-ID | <CACOt7mFgSqYeu7SC6srjqaM4n20cZ3q6q5NejATxyi4r+khPtw@mail.gmail.com> |
Hi,
I've got a small problem with a php script. 'm using MYSQLI and
connecting to a DB with a SELECT.
However nothing happens. my logs say ive connected successfully,
however no results. If I go directly to MYSQLADMIN on my host, I am
getting a result.
Is there a quick MYSQI command to tell me
:- i am connected to server (xxxxx)
:- using database (xxxxx)
;- Connection : Successful
AND/OR
$GLOBALS["md5log"].= "Connected successfully\n";
mysqli_select_db($link, "NAMEOFDB");
$result = mysqli_query($sql,$link) die ('Unable to execute query. '.
mysqli_error($link));
instead of a DIE command, how can i save the die result to a GLOBALS variable ??
(I save the md5log into a log file for review)
if i use this, it displays the MYSQLI logs (for that function) ON
SCREEN. (which i dont want)
However no actual error.
Apparently it IMMEDIATELY stops without going to the shutdown routine
(saves the logs).
register_shutdown_function('shutdown');
$result = mysqli_query($sql,$link) or die ( $GLOBALS["md5log"].=
"MYSQLI error - ".mysqli_error($link));
Any advice ?
--
Gordon.