Testing MySQL PHP connection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



While trying to connect to the mysqll database with php, I use the
following file:

 

<?php

/* Program: mysql_up.php

 * Desc:    Connects to MySQL Server and 

 *          outputs settings.

 */

 echo "<html>

       <head><title>Test MySQL</title></head>

       <body>";

 $host="PHP-AND-MYSQL";

 $user="root";

 $password="Britt9906";

 

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

 

When I access this file I I get "Fatal error: Call to undefined function
mysqli_connect() in C:\Program Files\Apache
Group\Apache2\htdocs\mysql_up.php on line 13"

 

Not sure what is wrong...  I'm pretty new to all this and grabbed this
out of a book.  Thanks for the help!

 

Jacob Bergman

Network Technician

Pullman School District #267

(509) 432-4012

jbergman@xxxxxxxxxxxxxxxxx

 


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux