Im Just Getting Started

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
joe81fight
Forum Newbie
Posts: 3
Joined: Mon Oct 15, 2007 11:13 am

Im Just Getting Started

Post 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.
User avatar
arjan.top
Forum Contributor
Posts: 305
Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia

Post 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
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

Post 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.
joe81fight
Forum Newbie
Posts: 3
Joined: Mon Oct 15, 2007 11:13 am

Please note

Post 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.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Post 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.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Post 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.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Moved to Installation and Configuration.
Post Reply