Can't INSERT in MySQL!!!
| From: | Jesse Binam | Date: | Sat, 19 Aug 2000 07:52:19 +0000 |
| Subject: | Can't INSERT in MySQL!!! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-12571@lists.php.net to get a copy of this message | ||
Hi,
I have been messing with this for hours!! I have tried everything I can
think of and it is NOT inserting. It connects, the query looks good to me
(if I put it in on a command line it works). What am I doing wrong?? Here is
the links to the actual (semi-working) pages.
http://128.121.255.26/new_pcd/index2.php -
This page is where the end result
shows up. Under In The News
http://128.121.255.26/new_pcd/company/admin/inthenews_add.php
- This is
script I am having problems with.
Thanks for any and all help,
Jess
Here is the code (plz excuse the debug stuff):
<html>
<head>
<title>News Article Add</title>
</head>
<body>
<form method="get" action="inthenews_add.php"
encryption="multipart/formdata">
<?
if($Headline) {
print("Headline is $Headline<br>");
print("URL is $URL<br>");
print("Connecting...<br>");
$connection = mysql_connect("localhost", "root", "");
print("Connected to $connection<br>");
print("Setting Query...<br>");
$query = "INSERT INTO InTheNews (Headline,URL) VALUES ('$Headline', '$URL')
";
print("Query Set To: $query <br>");
print("Querying...<br>");
$result = mysql_query($query, $connection);
print("Result $result<br>");
print("Counting rows that were changed...<br>");
$affected = mysql_affected_rows($connection);
print("$affected rows were changed...<br>");
mysql_close($connection);
}
?>
<table border="1">
<tr>
<th width="33%" nowrap bgcolor="#00006F"><font
color="#FFFFFF">
In The News Article
</font></th>
<th width="33%" nowrap bgcolor="#00006F"><font
color="#FFFFFF">Article
URL</font></th>
</tr>
<tr>
<td width="33%" align="center" bgcolor="#C0C0C0"><input
type="text"
name="Headline" size="20"></td>
<td width="33%" align="center" bgcolor="#C0C0C0"><input
type="text"
name="URL" size="20"></td>
</tr>
<tr>
<td width="66%" bgcolor="#C0C0C0" align="center"
colspan="2">
<input type="submit" value="Add It" name="submit">
<input type="reset" value="Clear Form"
name="reset"></td>
</tr>
</table>
</form>
</body>
</html>