urbanrays
09-29-2009, 06:56 PM
Hi
I have been messing with php/mysql the problem I am having is the info does not seem to be uploading into the sql database, I am using an image upload to a seperat file called image on my server and thats is getting through but when I try to retrive the data its just not there.
Here is my html code for the form
<form action="php/test.php" method="post" enctype="multipart/form-data" name="tester" id="tester">
Name<input name="name" type="text"><br>
Address<input name="address" type="text"><br>
email<input name="email" type="text"><br>
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
upload<input name="upload" type="file"><br>
<input name="submit" type="submit" value="submit">
</form>
Here is the php processing script
<?php
$target = "image/";
$target = $target . basename( $_FILES['upload']['name']);
$name=$_POST['name'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$upload=($_FILES['upload']['name']);
mysql_connect("", "", "") or die(mysql_error()) ;
mysql_select_db("derbyartists_co") or die(mysql_error()) ;
mysql_query("INSERT INTO `test` VALUES ('$name', '$address', '$email', '$upload')");
if(move_uploaded_file($_FILES['upload']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";
}
else {
echo "Sorry, there was a problem uploading your file.";
}
?>
And this is the script i am using to retrieve the info
<?php
mysql_connect("", "", "") or die(mysql_error()) ;
mysql_select_db("derbyartists_co") or die(mysql_error()) ;
$data = mysql_query("SELECT * FROM test") or die(mysql_error());
while($info = mysql_fetch_array( $data ))
{
Echo "<img src=http://www.derbyartists.co.uk/php/image".$info['upload'] ."> <br>";
Echo "<b>Name:</b> ".$info['name'] . "<br> ";
Echo "<b>Email:</b> ".$info['email'] . " <br>";
Echo "<b>Phone:</b> ".$info['phone'] . " <hr>";
}
?>
Any help would be much appreciated
I have been messing with php/mysql the problem I am having is the info does not seem to be uploading into the sql database, I am using an image upload to a seperat file called image on my server and thats is getting through but when I try to retrive the data its just not there.
Here is my html code for the form
<form action="php/test.php" method="post" enctype="multipart/form-data" name="tester" id="tester">
Name<input name="name" type="text"><br>
Address<input name="address" type="text"><br>
email<input name="email" type="text"><br>
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
upload<input name="upload" type="file"><br>
<input name="submit" type="submit" value="submit">
</form>
Here is the php processing script
<?php
$target = "image/";
$target = $target . basename( $_FILES['upload']['name']);
$name=$_POST['name'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$upload=($_FILES['upload']['name']);
mysql_connect("", "", "") or die(mysql_error()) ;
mysql_select_db("derbyartists_co") or die(mysql_error()) ;
mysql_query("INSERT INTO `test` VALUES ('$name', '$address', '$email', '$upload')");
if(move_uploaded_file($_FILES['upload']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";
}
else {
echo "Sorry, there was a problem uploading your file.";
}
?>
And this is the script i am using to retrieve the info
<?php
mysql_connect("", "", "") or die(mysql_error()) ;
mysql_select_db("derbyartists_co") or die(mysql_error()) ;
$data = mysql_query("SELECT * FROM test") or die(mysql_error());
while($info = mysql_fetch_array( $data ))
{
Echo "<img src=http://www.derbyartists.co.uk/php/image".$info['upload'] ."> <br>";
Echo "<b>Name:</b> ".$info['name'] . "<br> ";
Echo "<b>Email:</b> ".$info['email'] . " <br>";
Echo "<b>Phone:</b> ".$info['phone'] . " <hr>";
}
?>
Any help would be much appreciated