MySQL insert not working
Posted: Sat May 17, 2003 7:05 pm
Hey guys,
I made this insert page about a month ago, which has been working fine. Though, recently I have tried to incorporate an image uploader. I don't know what I have done, but now it just flickers when you press the add/submit button, instead of inserting into the database and then telling the user that the information was inserted.
Cheers
Sky
I made this insert page about a month ago, which has been working fine. Though, recently I have tried to incorporate an image uploader. I don't know what I have done, but now it just flickers when you press the add/submit button, instead of inserting into the database and then telling the user that the information was inserted.
Cheers
Sky
Code: Select all
<?php
if ($add=="yes"){
mysql_connect("localhost","user","password")
or die ("!!! Problem(s) connecting to DataBase !!!");
$query = "insert into usedcars values ('$auto','$make','$model','$year','$comments','$price','$image')";
$result = mysql_db_query(jackcaseymotors_com_au, $query);
echo"<table width="400" border="0" cellspacing="0" cellpadding="0"><tr><td><table width="50" border="0" cellspacing="0" cellpadding="0"><tr><td> </td></tr></table></td><td><table align="left" width="350" border="0" cellspacing="0" cellpadding="0">";
echo"<tr><td><font size="2" face="Arial, Helvetica, sans-serif">Your $make Car Listing has been Added</td><td><a href="add.php"><img src="../images/ok-button.jpg" width="33" height="24" border="0"></a></td></tr>";
?>
<?
}
else{
echo'
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr><td><table width="50" border="0" cellspacing="0" cellpadding="0"><tr><td> </td></tr></table></td>
<td><table width="550" border="0" cellspacing="0" cellpadding="0">
<tr><td><form action="add.php" method="post" enctype="multipart/form-data" name="insert" id="insert"></td></tr>
<tr><td>Make:</td><td>
<input name="make" type="text" id="make">
</td></tr>
<tr><td>Model:</td><td>
<input name="model" type="text" id="model">
</td></tr>
<tr><td>Year:</td><td>
<input name="year" type="text" id="year">
</td></tr>
<tr><td>Comments:</td><td>
<textarea name="comments" id="comments"></textarea>
</td></tr>
<tr><td>Price:</td><td>
<input name="price" type="text" id="price">
</td></tr>
<tr><td>Image:</td><td>
<input name="image" type="file" id="image">
</td></tr>
<tr><td></td><td>
<input name="reset" type="reset" id="reset" value="Reset">
<input name="submit" type="submit" id="submit" value="Add">
<INPUT NAME="add" TYPE=Hidden Value="yes" Size="">
<INPUT NAME="auto" TYPE=Hidden Value="0000" Size="">
</td></tr>
</form>
</table>
'; } ?>