Hi,
I am trying to connect with mysql. I have followed a video tutorial and it works fine for the person in the video but not for me.
The main php file code is as follows:
And the connect.php to mysql code is:
What am I doing wrong? I have included my password in the actual file on my computer but not above!
Thanks,
James
I am trying to connect with mysql. I have followed a video tutorial and it works fine for the person in the video but not for me.
The main php file code is as follows:
Code:
<?php
require("connect.php")
$name=$_POST['name'];
$comment=$_POST['comment'];
$submit=$_POST['submit'];
if($submit)
{
if($name&&$comment)
{
$query=mysql_query("INSERT INTO comment (id,name,comment) VALUES ('','$name','$comment')");
}
else
{
echo "Please fill out all the fields.";
}
}
?>
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
<title>Comment Box</title>
</head>
<body>
<form action="index22.php" method="POST">
<table>
<tr><td>Name: </td><td><input type="text" name="name"></td></tr>
<tr><td colspan="2">Comment: </td><td>
<tr><td colspan="2"><textarea name="comment"></textarea></td><td>
<tr><td colspan="2"><input type="submit" name="submit" value="comment"/></td></tr>
</table>
</body>
</html>
Code:
<?php
mysql_connect("cust-mysql-123-03,"****","****");
mysql_select_db("fourwaysdpcouk_576458_db1");
?>
What am I doing wrong? I have included my password in the actual file on my computer but not above!
Thanks,
James
Comment