PLEASE HELP, I CANT SEEM TO GET MY PHP SCRIPT WORKING. I DONT GET A CONNECTION ERROR. I GET THIS....
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /usr/home/panao3/public_html/formuser.php on line 11
there is a trouble2
PHP SCRIPT
<?php
//open connection
$dbh=mysql_connect("localhost", "panao3_matt", "Kiani123"
or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db("panao3_tierii"
;
//create SQL statement
$sql = "INSERT INTO user (id, name) VALUES ('', '$_POST[name]')";
// execute the SQL statement
if (mysql_query($sql, $conn)) {
echo "record added!";
} else {
echo "there is a trouble2";
}
?>
HTML FILE
HTML>
<HEAD>
<TITLE>test</TITLE>
</HEAD>
<BODY>
<FORM METHOD="POST" ACTION="formuser.php" >
<!----name---->
<table width="100%" border="0" align="center">
<tr>
<td colspan="2" style="border-bottom-style: solid; border-bottom-width: 1" width="941">
<p align="center">DATABASE SUBMITTAL FORM</td>
</tr>
<tr>
<td width="939" colspan="2" style="border-style: solid; border-width: 1"> </td>
</tr>
<tr>
<td width="1" style="border-style: none; border-width: medium"><b>AUTHOR:</b></td><!--spacer--->
<td width="1043" style="border-style: none; border-width: medium">
<input type="text" name="name" size="20"></td>
</tr>
</table>
<p align="center">
<INPUT TYPE=SUBMIT VALUE="Submit Form">
<INPUT TYPE=RESET VALUE="Reset Form"> </p>
</FORM>
<HR>
</BODY>
</HTML>
MYSQL TABLE user
id int(15) UNSIGNED No auto_increment Primary Index
name text No
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /usr/home/panao3/public_html/formuser.php on line 11
there is a trouble2
PHP SCRIPT
<?php
//open connection
$dbh=mysql_connect("localhost", "panao3_matt", "Kiani123"
mysql_select_db("panao3_tierii"
//create SQL statement
$sql = "INSERT INTO user (id, name) VALUES ('', '$_POST[name]')";
// execute the SQL statement
if (mysql_query($sql, $conn)) {
echo "record added!";
} else {
echo "there is a trouble2";
}
?>
HTML FILE
HTML>
<HEAD>
<TITLE>test</TITLE>
</HEAD>
<BODY>
<FORM METHOD="POST" ACTION="formuser.php" >
<!----name---->
<table width="100%" border="0" align="center">
<tr>
<td colspan="2" style="border-bottom-style: solid; border-bottom-width: 1" width="941">
<p align="center">DATABASE SUBMITTAL FORM</td>
</tr>
<tr>
<td width="939" colspan="2" style="border-style: solid; border-width: 1"> </td>
</tr>
<tr>
<td width="1" style="border-style: none; border-width: medium"><b>AUTHOR:</b></td><!--spacer--->
<td width="1043" style="border-style: none; border-width: medium">
<input type="text" name="name" size="20"></td>
</tr>
</table>
<p align="center">
<INPUT TYPE=SUBMIT VALUE="Submit Form">
<INPUT TYPE=RESET VALUE="Reset Form"> </p>
</FORM>
<HR>
</BODY>
</HTML>
MYSQL TABLE user
id int(15) UNSIGNED No auto_increment Primary Index
name text No