ZURKE
12-19-2004, 09:48 PM
Hello, as you will soon realize I am new to this database thing. My situation appears to be in trying to connect to a particular MYSQL database. It seems I can connect to MYSQL but when I try and "select" a database once within I end up with warnings and no connection to that database. I have tried a number of changes(in the dark I might ad) relating to "mysqli" instead of "mysql" in querying.
I am using:
PHP 5.0.2
Apache 1.3.33
MySQL 4.1.7
Zend Optimizer 2.5.5
phpMyAdmin 2.6.0-pl2
Perl 5.8.4
Here is what I have,
$user = "xxxx";
$host = "localhost";
$password = "xxxx";
$database = "signature";
$connection = mysqli_connect($host,$user,$password);
if (!$connection){
echo ("<b>unable to connect to the mysql server at this time</b>");
exit();
}
mysqli_select_db('$connection','$database'); line #19
if(!mysqli_select_db('database')){ line #20
exit("<b>unable to connect to signaturedb</b>");
}
mysqli_query(query);
$result = mysqli_query("SELECT * FROM sig");
if (!$result){
exit("<b>unable to retrieve sig mysql_error()</b>");
}
while ($row = mysqli_fetch_array(result));{
echo ($row[sig]);
}
and this is what I get:
Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in c:\AppServ\www\onemoretime.php on line 19
Warning: mysqli_select_db() expects exactly 2 parameters, 1 given in c:\AppServ\www\onemoretime.php on line 20
unable to connect to signaturedb
Any assistance would be greatly appreciated as I have few hairs left.
I am using:
PHP 5.0.2
Apache 1.3.33
MySQL 4.1.7
Zend Optimizer 2.5.5
phpMyAdmin 2.6.0-pl2
Perl 5.8.4
Here is what I have,
$user = "xxxx";
$host = "localhost";
$password = "xxxx";
$database = "signature";
$connection = mysqli_connect($host,$user,$password);
if (!$connection){
echo ("<b>unable to connect to the mysql server at this time</b>");
exit();
}
mysqli_select_db('$connection','$database'); line #19
if(!mysqli_select_db('database')){ line #20
exit("<b>unable to connect to signaturedb</b>");
}
mysqli_query(query);
$result = mysqli_query("SELECT * FROM sig");
if (!$result){
exit("<b>unable to retrieve sig mysql_error()</b>");
}
while ($row = mysqli_fetch_array(result));{
echo ($row[sig]);
}
and this is what I get:
Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in c:\AppServ\www\onemoretime.php on line 19
Warning: mysqli_select_db() expects exactly 2 parameters, 1 given in c:\AppServ\www\onemoretime.php on line 20
unable to connect to signaturedb
Any assistance would be greatly appreciated as I have few hairs left.