| Blanton, Bob 2006-05-27, 7:59 am |
| Donatas,
That was it. Thanks so much.
Bob
_____
From: Donatas Vyzas [mailto:donatas@viesulas.ktu.lt]
Sent: Saturday, May 27, 2006 3:03 PM
To: php-install@lists.php.net
Subject: Re: [PHP-INSTALL] Using MySQL with PHP
Take a look at the line:
$link = mysql_connect('flms', 'userid', 'password') //appears to stop
here
the first argument to mysql_connect is a host, where your mysql server
is running. If your mysql server is the same computer where php is
running, this might be 'localhost'. Otherwise, use IP number (like
'192.168.0.1') or DNS name (like 'mysql.example.com').
Hope this helps,
Donatas
Blanton, Bob wrote:
Donatas,
When running the phpinfo() I get this below for the mysql section.
I copied the libmysql.dll to the windows directory as some of the
instructions had said. This is the library that is lets php talk to
mysql.
I am running php 5, mysql 5, and apache 1.3. I am successfully using
mysql with the administrator and workbench modules of mysql. I am
trying to perform
a db connection from one of the on-line tutorials and I can't get a db
connection. See my code below
//this does not work
<?php
// Connecting, selecting database
echo 'Trying to Connect...'; //last
line executed
$link = mysql_connect('flms', 'userid', 'password') //appears to stop
here
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);
?>
|