I get the same problem. I don't know how to get a MySQL server running on my computer and how to contact it.. I used EasyPHP since it was supposed to make everything so easy.. So it's an apacheserver with PHP 4.0.6 and phpMyAdmin 2.2.0rc4 is used to edit the MySQL tables.. Umm.. I get really annoyed. I'll give you some code too:
File made to collect data from a form and put it into a database:
<head><title>PHP workshop for form management: ajoutimp.php</title><head>
<body>
<?php
$db = mysql_connect("localhost","nisse","ground");
$continu=1;
if ($name == "")
{
print("Your name is needed !<br>");
$continu=0;
}
if ($continu == 1)
{
$date=date("Y-m-d HⓂs");
$sql="INSERT INTO impression (name, email, date, kom) VALUES ('$name', '$email', '$date', '$kom')";
mysql_query($sql, $db);
print("Thank you for giving me your impressions !") ;
print("<a href=impressions.php>back</a>");
}
?>
</body>
File that is supposed to show the @!#$:
<head><title>PHP workshop for form management: adminimp.php</title><head>
<body>
<table align="center" cellspacing="0" cellpadding="0" border="1" width="80%">
<tr>
<td bgcolor="black"><font color="white">DATE</td>
<td bgcolor="black"><font color="white">NAME</td>
<td bgcolor="black"><font color="white">EMAIL</td>
<td bgcolor="black"><font color="white">COMMENTS</td>
</tr>
<?php
$db = mysql_connect("localhost, nisse, ground");
$sql="SELECT * FROM gastbok ORDER BY datetime";
$res=mysql_query($sql, $db);
while ($line = mysql_fetch_object ($res))
{
print "<tr>";
print "<td>$line->date</td>";
print "<td>$line->name</td>";
print "<td>$line->email</td>";
print "<td>$line->kom</td>";
print "</tr>";
}
mysql_free_result ($res);
?>
</table>
</body>
Error message:
Warning: Unknown MySQL Server Host 'localhost, nisse, ground' (2) in c:\mina dokument\frans\programfrans\easyphp\www\test\impressions.php on line 12
Warning: MySQL Connection Failed: Unknown MySQL Server Host 'localhost, nisse, ground' (2) in c:\mina dokument\frans\programfrans\easyphp\www\test\impressions.php on line 12
Warning: Supplied argument is not a valid MySQL-Link resource in c:\mina dokument\frans\programfrans\easyphp\www\test\impressions.php on line 14
Warning: Supplied argument is not a valid MySQL result resource in c:\mina dokument\frans\programfrans\easyphp\www\test\impressions.php on line 15
Warning: Supplied argument is not a valid MySQL result resource in c:\mina dokument\frans\programfrans\easyphp\www\test\impressions.php on line 24
What else is there?
Hmm. I don't know how to tell MySQL that I want to use my own comp. as host for it. I've told it that username is nisse, password - ground, host - localhost.. but thats in the database MySQL and the table user.. There is a table - host - but I don't know how to set the parameters..
PLEASE reply to my email too, so that I definitley know that somebody's answered.
Thank you // Tiger