[SOLVED] Uploading Picture error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fuyenhou
Forum Newbie
Posts: 9
Joined: Tue Jun 22, 2004 4:54 am
Location: Malaysia
Contact:

[SOLVED] Uploading Picture error

Post 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]
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post 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>
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post 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>
fuyenhou
Forum Newbie
Posts: 9
Joined: Tue Jun 22, 2004 4:54 am
Location: Malaysia
Contact:

Post 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
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Code: Select all

$query = "insert into image (id,Picture,filename) VALUES ('', '".$Picture."', '".$filename."')";
fuyenhou
Forum Newbie
Posts: 9
Joined: Tue Jun 22, 2004 4:54 am
Location: Malaysia
Contact:

Post by fuyenhou »

Huuray DONE
Post Reply