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.
Im Just Getting Started
Moderator: General Moderators
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
Try using more "standard" mysql_connect() or look in the manual (http://si2.php.net/manual/en/ref.mysqli.php) how to enable mysqli
Last edited by arjan.top on Mon Oct 15, 2007 11:43 am, edited 1 time in total.
-
joe81fight
- Forum Newbie
- Posts: 3
- Joined: Mon Oct 15, 2007 11:13 am
Getting somewhere
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.
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.
-
joe81fight
- Forum Newbie
- Posts: 3
- Joined: Mon Oct 15, 2007 11:13 am
Please note
***** PLEASE USE
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.
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.
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.
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.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA