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
https://forums.phpfreaks.com/topic/42535-solved-line-wont-add-in-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.