Hello all, I'm a newbie to Mysql.  I just installed mysql 3.23.53 on
Solaris 7.  I am running Apache 2.0.42 and PHP 4.2.3.

I am trying to connect to my Mysql DB via Apache and PHP, but I get the
following error:  "Warning: Unknown MySQL Server Host '' (1) in
helloSql.php on line 3 Warning: MySQL Connection Failed: Unknown MySQL
Server Host '' (1) in helloSql.php on line 3 Could not connect"

Here is the code I used.

<?php
// Connecting, selecting database
$link = mysql_connect("<localhost>", "<root>", "<mypassword>")
    or die("Could not connect");
print "Connected successfully";


// Performing SQL query
$query = "SELECT now()";
$result = mysql_query($query)
    or die("Query failed");


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


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



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to