Ok...I've been working on this code for the past 3 hours. If anyone could help...that'd be great!
I keep getting this error when trying to submit a form from a browser:
Warning: Supplied argument is not a valid MySQL-Link resource in /usr/local/etc/apache_1.3.12/htdocs/test/eventsform.php on line 12
Insert failed!
Here is the PHP file that the form accesses:
<?PHP
$dbhost='localhost';
$dbusername='xx';
$dbuserpassword='xx';
$default_dbname='events';
$link_id=mysql_connect($dbhost, $dbusername, $dbuserpassword) or DIE("Unable to connect to Server!");
$db=mysql_select_db("events", $link_id) or DIE("Unable to select database!");
$query="INSERT INTO events VALUES(NULL, '$name','$date','$body')";
$result=mysql_query($query, $db) or DIE("Insert failed!");
?>
<h2> Event added! </h2>
<p> </p>
<table width="75%" border="1" height="206">
<tr>
<td><font color="#003399"><b>Name:</b></font><?php echo $name ?></td>
</tr>
<tr>
<td><font color="#003399"><b>Date:</b></font><?php echo $date ?></td>
</tr>
<tr>
<td><font color="#003399"><b>Description:</b></font><?php echo $body ?></td>
</tr>
</table>
<p> </p>
I keep getting this error when trying to submit a form from a browser:
Warning: Supplied argument is not a valid MySQL-Link resource in /usr/local/etc/apache_1.3.12/htdocs/test/eventsform.php on line 12
Insert failed!
Here is the PHP file that the form accesses:
<?PHP
$dbhost='localhost';
$dbusername='xx';
$dbuserpassword='xx';
$default_dbname='events';
$link_id=mysql_connect($dbhost, $dbusername, $dbuserpassword) or DIE("Unable to connect to Server!");
$db=mysql_select_db("events", $link_id) or DIE("Unable to select database!");
$query="INSERT INTO events VALUES(NULL, '$name','$date','$body')";
$result=mysql_query($query, $db) or DIE("Insert failed!");
?>
<h2> Event added! </h2>
<p> </p>
<table width="75%" border="1" height="206">
<tr>
<td><font color="#003399"><b>Name:</b></font><?php echo $name ?></td>
</tr>
<tr>
<td><font color="#003399"><b>Date:</b></font><?php echo $date ?></td>
</tr>
<tr>
<td><font color="#003399"><b>Description:</b></font><?php echo $body ?></td>
</tr>
</table>
<p> </p>