Re: [PHP-INSTALL] install question - phpinfo(), db connection problem

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



for your mysql connection ,you need to be sure that php is compiled with mysql

use phpinfo() and look at the configure command

you must have a --with-mysql...
if you  have a --without-mysql then php is not compiled with mysql


at the end of page , you must have a mysql section too


Blanton, Bob a écrit :
Hi All,
  I have MySQL, PHP, and Apache installed using windows XP professional.
  I am able to use the MySQL Query Browser and create DBs, tables,
populate with data, etc.
  I am able to create files using php and view in a browser.  I have
tried the beginning tutorial and some others from the php manual to
include using the phpinfo() function.  This function list the
configuration file (php.ini) at c:\windows.  The file is not in this
directory but is in the c:\php directory.  The c:\php directory is also
in the PATH.  Why is the information not showing correctly in the
webpage when phpinfo() is called?

  The extension_dir is also listed as c:\php5 when it is actually at
c:\php\ext.  Where is the function phpinfo() getting this information?

  Next problem - mysql connection
  I am trying to get a db connection to mysql and show table data in a
webpage.  I am using an example in the manual off the php website.  This
is the code from the manual:

<?php
// Connecting, selecting database
$link = mysql_connect('localhost:3306', 'root', 'mysql')
   or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('flms') or die('Could not select database');

// Performing SQL query
$query = 'SELECT * FROM allow';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());

// Printing results in HTML
echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
   echo "\t<tr>\n";
   foreach ($line as $col_value) {
       echo "\t\t<td>$col_value</td>\n";
   }
   echo "\t</tr>\n";
}
echo "</table>\n";

// Free resultset
mysql_free_result($result);

// Closing connection
mysql_close($link);
?>

  The webpage executes everything before this code trying to access the
DB.  I suspect it has something to do with the install and whether some
files have visibility.  I do not receive any sort of error on the
screen.  I am able to use mysql query browser to access the db with no
problems.
  My php install is the latest off the website and it is unzipped to
c:\php directory.  Does anyone have any ideas why the above code is not
working for me?

Thanks,
Bob


[Index of Archives]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [Postgresql]     [PHP Books]     [PHP Databases]     [PHP SOAP]
  Powered by Linux