...

View Full Version : T_VARIABLE When adding the Query string.



shanparker
06-15-2006, 07:22 PM
I'm getting:
Parse error: syntax error, unexpected T_VARIABLE in /home/jiingo/public_html/upload.php on line 39

When I add the $query2, and $result2 lines below. Otherwise my script is working fine. Is there something I'm missing? They don't seen to be interfering with anything else in the code.

This is also the major part of the code, but there are a few other bits and pieces above this part which I can provide, although I don't think they are important (but could be i suppose!)


<?
define ("DIRECTORY", "/home/jiingo/public_html/photos/$row[vardir]/$session->username/");

do {
$dir = DIRECTORY;
while (!is_dir($dir)) {
$basedir = dirname($dir);
if ($basedir == '/' || is_dir($basedir))
mkdir($dir,0777);
else
$dir=$basedir;
}
} while ($dir != DIRECTORY);

$picname = $_FILES['userfile']['name'];
$random=rand(100000,999999);
$newpicname=$random.$picname;
$uploadfile = $dir.$newpicname;

move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile);
CHMOD("$uploadfile", 0777)

$query2 = "INSERT INTO photo_manager SET filename='$newpicname'";
$result2=mysql_query($query2)

?>

anarchy3200
06-15-2006, 07:25 PM
Well to start with your missing a semi-colon after


$result2=mysql_query($query2)


and also one after


CHMOD("$uploadfile", 0777)


It could be them.

shanparker
06-15-2006, 07:26 PM
Well to start with your missing a semi-colon after


$result2=mysql_query($query2)

It could be that.

It was the CHMOD!

Thanks! I'm still really new to PHP - but learning slowly! So it's hard for me to catch my errors sometimes.

anarchy3200
06-15-2006, 07:32 PM
Thats fair enough, that is why there are people here to help!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum