I've done a little PHP in the past but this is probably a simple PHP/MySQL issue from a YouTube tutorial which the author say does work. Here's that tutorial
Now I am trying to do exactly this just with a few more fields we have a domain called and we are just trying to upload some pictures and text into a MySQL database, that's all for the moment.
This SHOULD store the picture and details in the database table called "properties" but there seems to be an error my error log is here from the domain.
--------------------------------
[Fri Jul 13 10:12:08 2012] [error] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Access denied for user 'web233-smt-web_1'@'localhost' (using password: YES) in /home/sites/kenilworthcomputerrepairs.com/public_html/mobilepropertysearch.co.uk/StoreInfo.php on line 2, referer:
[Fri Jul 13 10:12:08 2012] [error] PHP Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/sites/kenilworthcomputerrepairs.com/public_html/mobilepropertysearch.co.uk/StoreInfo.php on line 3, referer:
[Fri Jul 13 10:12:08 2012] [error] PHP Warning: file_get_contents() [<a href='function.file-get-contents'>function.file-get-contents</a>]: Filename cannot be empty in /home/sites/kenilworthcomputerrepairs.com/public_html/mobilepropertysearch.co.uk/StoreInfo.php on line 10, referer:
[Fri Jul 13 10:12:08 2012] [error] PHP Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/sites/kenilworthcomputerrepairs.com/public_html/mobilepropertysearch.co.uk/StoreInfo.php on line 20, referer: ---------------------------------
HERE'S MY CODE FOR THE DATABASE STORING PART index.html is at
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
$conn = mysql_connect("localhost","web233-smt-web_1","web233-smt-web_1","john041066");
$db= mysql_select_db("properties",$conn);
if(!$db)
{
echo mysql_error();
}
$image = addslashes (file_get_contents($_FILES['image']['tmp_name']));
$imgtype = $image['mime'];
$salerent = $_POST['salerent'];
$proptype = $_POST['proptype'];
$bedrooms = $_POST['bedrooms'];
$address = $_POST['address'];
$price= $_POST['price'];
$q ="INSERT INTO properties VALUES('$image','$salerent','$proptype','$bedrooms','$address','$price')";
$r = mysql_query($q,$conn);
if($r)
{
echo "Information Stored Successfully";
}
else
{
echo mysql_error();
}
?>
Please can someone help me out ? I am sure this is reasonably easy
Thanks
John Wheatcroft
Now I am trying to do exactly this just with a few more fields we have a domain called and we are just trying to upload some pictures and text into a MySQL database, that's all for the moment.
This SHOULD store the picture and details in the database table called "properties" but there seems to be an error my error log is here from the domain.
--------------------------------
[Fri Jul 13 10:12:08 2012] [error] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Access denied for user 'web233-smt-web_1'@'localhost' (using password: YES) in /home/sites/kenilworthcomputerrepairs.com/public_html/mobilepropertysearch.co.uk/StoreInfo.php on line 2, referer:
[Fri Jul 13 10:12:08 2012] [error] PHP Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/sites/kenilworthcomputerrepairs.com/public_html/mobilepropertysearch.co.uk/StoreInfo.php on line 3, referer:
[Fri Jul 13 10:12:08 2012] [error] PHP Warning: file_get_contents() [<a href='function.file-get-contents'>function.file-get-contents</a>]: Filename cannot be empty in /home/sites/kenilworthcomputerrepairs.com/public_html/mobilepropertysearch.co.uk/StoreInfo.php on line 10, referer:
[Fri Jul 13 10:12:08 2012] [error] PHP Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/sites/kenilworthcomputerrepairs.com/public_html/mobilepropertysearch.co.uk/StoreInfo.php on line 20, referer: ---------------------------------
HERE'S MY CODE FOR THE DATABASE STORING PART index.html is at
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
$conn = mysql_connect("localhost","web233-smt-web_1","web233-smt-web_1","john041066");
$db= mysql_select_db("properties",$conn);
if(!$db)
{
echo mysql_error();
}
$image = addslashes (file_get_contents($_FILES['image']['tmp_name']));
$imgtype = $image['mime'];
$salerent = $_POST['salerent'];
$proptype = $_POST['proptype'];
$bedrooms = $_POST['bedrooms'];
$address = $_POST['address'];
$price= $_POST['price'];
$q ="INSERT INTO properties VALUES('$image','$salerent','$proptype','$bedrooms','$address','$price')";
$r = mysql_query($q,$conn);
if($r)
{
echo "Information Stored Successfully";
}
else
{
echo mysql_error();
}
?>
Please can someone help me out ? I am sure this is reasonably easy
Thanks
John Wheatcroft