Page 1 of 1
Im Just Getting Started
Posted: Mon Oct 15, 2007 11:26 am
by joe81fight
Basically i just got this dummies book. I got Apache 2 installed and running, i got PHP version 5.2.4 up and running and tested. It is working.
The book had me test MySQL also, i have version 5.0. When i test it i get this
Fatal error: Call to undefined function mysqli_connect() in C:\Server\Apache2\htdocs\mysql_up.php on line 13
So whats going on here? I popped about 40 very valuable blood vessels in my brain, now my brain is getting no more oxygen and life is fading.
Posted: Mon Oct 15, 2007 11:41 am
by arjan.top
looks like mysql extension is not enabled ...
Try using more "standard" mysql_connect() or look in the manual (
http://si2.php.net/manual/en/ref.mysqli.php) how to enable mysqli
Getting somewhere
Posted: Mon Oct 15, 2007 12:41 pm
by joe81fight
I followed some of the different advice on that page. I am still not getting the table that i am expecting.
Warning: mysqli_connect() [function.mysqli-connect]: (28000/1045): Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\Server\Apache2\htdocs\mysql_up.php on line 13
Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in C:\Server\Apache2\htdocs\mysql_up.php on line 15
Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in C:\Server\Apache2\htdocs\mysql_up.php on line 18
Error:
So what happened? Im definitely not getting the same error message.
Is it my account name and password?
I am pretty positive that i have my account name and password correct.
Please note
Posted: Mon Oct 15, 2007 12:46 pm
by joe81fight
***** PLEASE USE Code: Select all
AND OTHER TAGS WHEN POSTING CODE *****[/color]
Code: Select all
<?php
/* Program: mysql_up.php
* Desc: Connects to MySQL Server and
* outputs settings.
*/
echo "<html>
<head><title>Test MySQL</title></head>
<body>";
$host="localhost";
$user="root";
$password="NOTPOSTED";
$cxn = mysqli_connect($host,$user,$password);
$sql="SHOW STATUS";
$result = mysqli_query($cxn,$sql);
if($result == false)
{
echo "<h4>Error: ".mysqli_error($cxn)."</h4>";
}
else
{
/* Table that displays the results */
echo "<table border='1'>
<tr><th>Variable_name</th>
<th>Value</th></tr>";
for($i = 0; $i < mysqli_num_rows($result); $i++)
{
echo "<tr>";
$row_array = mysqli_fetch_row($result);
for($j = 0;$j < mysqli_num_fields($result);$j++)
{
echo "<td>".$row_array[$j]."</td>\n";
}
}
echo "</table>";
}
?>
</body></html>
The above is the code that i am trying to run from my server. It is located in my htdocs folder, inside my Apache2 folder.
Posted: Mon Oct 15, 2007 4:54 pm
by califdon
I suggest that you try using mysql commands, rather than mysqli commands, as someone else suggested earlier. For your information, mysqli is an "improved" extension that most of us probably don't use. Since using it involves configuring your server, it would be simpler to first see if standard mysql is working. Just change everyplace that mysqli appears in a command to mysql. You can do it with a single Replace operation. Then come back here and tell us if it runs.
Posted: Mon Oct 15, 2007 4:54 pm
by califdon
I suggest that you try using mysql commands, rather than mysqli commands, as someone else suggested earlier. For your information, mysqli is an "improved" extension that most of us probably don't use. Since using it involves configuring your server, it would be simpler to first see if standard mysql is working. Just change everyplace that mysqli appears in a command to mysql. You can do it with a single Replace operation. Then come back here and tell us if it runs.
Posted: Mon Oct 15, 2007 11:40 pm
by RobertGonzalez
Moved to Installation and Configuration.