It won't for some reason come up with the function.
What I currently have is:
PHP Code:
<?php
$ref=$HTTP_GET_VARS['q'];
echo "this is 1 " . $ref . "<br />";
//connect to db code
function save($data) {
$dref=$ref;
echo "this is dref" . $dref . "<br />";
if($sql="INSERT INTO photos (Id, ref, subcategory, photo, date)
VALUES ('".$_SESSION['Id']."', '{$dref}', '".$data['photo']."', '".$data['filename']."', NOW())"){
echo "This is " . $sql . "<br />";
return true;
}
And the echo is:
this is 1 1074615275128082806527590
this is dref
This is INSERT INTO photos (Id, ref, subcategory, photo, date) VALUES ('1893475024', '', '0', '32838e374bd6429.jpg', NOW())
Photo #0 is uploaded and saved to the db
I originally changed it to the below which I believe is what you suggested:
PHP Code:
//connect to db code
function save($data) {
$ref=$HTTP_GET_VARS['q'];
if($sql="INSERT INTO photos (Id, ref, subcategory, photo, date)
VALUES ('".$_SESSION['Id']."', '".$ref."', '".$data['photo']."', '".$data['filename']."', NOW())"){
echo "This is " . $sql . "<br />";
return true;
And then changed it to the above to check that it was only within the function that it wouldn't be echoed out.
I have no idea why it would work outside the function and not within, unless I have misunderstood where to place the code.