Jump to content

[SOLVED] line wont add in database


aebstract

Recommended Posts

It's kinda weird, and confusing me. I have tryed a few methods. I am uploading two files, and then all I want to do is add one line to the database. I actually don't need any information added. There is only one column, called id.. it is set to auto increment, so as long as I can add one line to the db then it should just be the next number in line. (which is what I want) Below is my code, maybe someone can tell me how I can get it to just add another line on to my db.

 

<html>
<head>
<link href="stylesheet.css" rel="stylesheet" type=text/css title=default />
</head>
<body>

<?php

mysql_connect("localhost","hmg","hillpass"); 
mysql_select_db("hmg"); 


$result = mysql_query("SELECT * FROM mailers ORDER BY id ASC"); 
$rows = mysql_num_rows($result);
$rows2 = $rows + 1;



if (isset($_POST['submit'])) {

if (move_uploaded_file($_FILES['thefile']['tmp_name'],  $_SERVER['DOCUMENT_ROOT']. "/mailers/$rows2.jpg" )) { 
}
        


if (move_uploaded_file($_FILES['thefile2']['tmp_name'],  $_SERVER['DOCUMENT_ROOT']. "/mailers/big/$rows2.jpg" )) {       
}
     


$results = MYSQL_QUERY("INSERT INTO mailers (id)".
"VALUES (0)");


}
?>


<div id="uploadform">
<?php echo "There are currently $rows mailers."; ?>
<br /><br /><br />
<form action="test.php" enctype="multipart/form-data" method="post" >

Thumbnail Image:<br />
<input type="file" name="thefile" class="upform" /><br /><br />

Large Image:<br />
<input type="file" name="thefile2" class="upform" /><br /><br />

<input name="submit" type="submit" value="add mailer" class="upform" />


</form>
</div>

</body>
</html>

 

Thanks in advance

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.