Hi , I am trying to get a photo type base to work and have got stuck ,
I have 3 files ,
1- the html - that takes the input called door.html
2- the connect.php to open the base.
3- the php to insert insert.php.
1=
<FORM method=post action=insert.php><P>
</P><P><INPUT name=title value="Text Field">
</P><P><INPUT style="WIDTH: 635px; HEIGHT: 101px" value="Text Field" size=81></P>
<P><INPUT name=photo type=file></P><P></P>
<P><INPUT value="Submit Query" type=submit>
<INPUT value=Reset type=reset></P>
<P> </P></FORM>
2=
<?php
$con=mysqli_connect("localhost","user_me","password123","mybase1");
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
3=
<?php
require "connect.php";
$target = "images/";
$target = $target . basename( $_FILES['photo']['title']);
$photo = ($_FILES['photo']['name']);
$query="INSERT INTO mytable1 ( name, photo, date)
VALUES
('$_POST[title]','$_POST[photo]','$_POST[date]')";
$result = mysql_query($query, $connection)
or die ("you missed up again<br>$query");
if(move_uploaded_file($_FILES['photo']['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.";
}
?>
<HTML><HEAD><META name=GENERATOR content="MSHTML 9.00.8112.16457"></HEAD>
<BODY>
if(move_uploaded_file($_FILES['photo']['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.";
}
the error i am getting is Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in public_html/insert.php on line 13
any advice please ?
thank you .