Page 1 of 1

[SOLVED] Uploading Picture error

Posted: Mon Jun 28, 2004 8:42 pm
by fuyenhou
This is the PHP coding

Code: Select all

<html> 
<head> 
<title>Update Movies GUI</title> 
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"></head> 
<body background="../Graphics/backgd.gif"> 
<h1>Database Movies Update Result</h1></body> 
<?php 
//Create short variable names. (REGISTER_GLOBALS = OFF) 
$Picture = $HTTP_POST_VARS['Picture']; 
$filename = $HTTP_POST_VARS['filename']; 


mysql_select_db("fuyenhou_freetohost_com"); 
[b]$query = "insert into image ('id', 'Picture', 'filename')";
         "VALUES ('""', '"$Picture"', '"$filename"')";[/b] 
$result = mysql_query($query); 
if (!$result) 
{ 
  echo ( "<p>Error performing INSERT: ".mysql_error(). "</p>" ); 
} 
  
else 
{  
    $Itemcode = mysql_insert_id(); 
   print '<h2>The itemcode for this movie is: <B>$Itemcode.</B></h2>'; 
} 
?> 
</body> 
</html>

On the bold error was the line 15.. may I know why my programme cannot works?


the error show this
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/vhosts/fuyenhou.freetohost.com/image.php on line 15

What can I do?

markl - It's

Code: Select all

not [php_man] tags[/color]

Posted: Mon Jun 28, 2004 8:45 pm
by dull1554

Code: Select all

<html>
<head>
<title>Update Movies GUI</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"></head>
<body background="../Graphics/backgd.gif">
<h1>Database Movies Update Result</h1></body>
<?php
//Create short variable names. (REGISTER_GLOBALS = OFF)
$Picture = $HTTP_POST_VARS['Picture'];
$filename = $HTTP_POST_VARS['filename'];


mysql_select_db("fuyenhou_freetohost_com");
$query = "insert into image ('id', 'Picture', 'filename')";
"VALUES ('""', '"$Picture"', '"$filename"')";
$result = mysql_query($query);
if (!$result)
{
echo ( "<p>Error performing INSERT: ".mysql_error(). "</p>" );
}

else
{
$Itemcode = mysql_insert_id();
print '<h2>The itemcode for this movie is: <B>$Itemcode.</B></h2>';
}
?>
</body>
</html>

Posted: Mon Jun 28, 2004 8:46 pm
by dull1554
try this

Code: Select all

<html>
<head>
<title>Update Movies GUI</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"></head>
<body background="../Graphics/backgd.gif">
<h1>Database Movies Update Result</h1></body>
<?php
//Create short variable names. (REGISTER_GLOBALS = OFF)
$Picture = $HTTP_POST_VARS['Picture'];
$filename = $HTTP_POST_VARS['filename'];


mysql_select_db("fuyenhou_freetohost_com");
$query = "insert into image ('id', 'Picture', 'filename') VALUES ('""', '"$Picture"', '"$filename"')";
$result = mysql_query($query);
if (!$result)
{
echo ( "<p>Error performing INSERT: ".mysql_error(). "</p>" );
}

else
{
$Itemcode = mysql_insert_id();
print '<h2>The itemcode for this movie is: <B>$Itemcode.</B></h2>';
}
?>
</body>
</html>

Posted: Mon Jun 28, 2004 8:57 pm
by fuyenhou
Still the error are still there

Code: Select all

<html> 
<head> 
<title>Update Movies GUI</title> 
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"></head> 
<body background="../Graphics/backgd.gif"> 
<h1>Database Movies Update Result</h1></body> 
<?php 
//Create short variable names. (REGISTER_GLOBALS = OFF) 
$Picture = $HTTP_POST_VARS['Picture']; 
$filename = $HTTP_POST_VARS['filename']; 

mysql_select_db("fuyenhou_freetohost_com"); 
$query = "insert into image ('id', 'Picture', 'filename') VALUES ('"', '".$Picture."', '".$filename')";
$result = mysql_query($query); 
if (!$result) 
{ 
  echo ( "<p>Error performing INSERT: ".mysql_error(). "</p>" ); 
} 
  
else 
{  
    $Itemcode = mysql_insert_id(); 
   print '<h2>The itemcode for this movie is: <B>$Itemcode.</B></h2>'; 
} 
?> 
</body> 
</html>
Why does this happen??
The error show...
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/vhosts/fuyenhou.freetohost.com/image.php on line 13

And then the above way..cannot works as well
I think do i need to do some connection to the database? are the cause of the error?


UPDATE.. nope are not the connection problem

Posted: Mon Jun 28, 2004 9:11 pm
by markl999

Code: Select all

$query = "insert into image (id,Picture,filename) VALUES ('', '".$Picture."', '".$filename."')";

Posted: Mon Jun 28, 2004 9:13 pm
by fuyenhou
Huuray DONE