943,940 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1479
  • PHP RSS
Dec 13th, 2005
0

need help in error

Expand Post »
hi guys,

i ran into this error
"Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in c:\web\imagedb\pixel.php on line 19"

while running the code:

<?php
// database connection
$host = "localhost";
$user = "user";
$pass = "password";
$db = "imagedb";
$table= "image";

$conn = mysql_connect($host, $user, $pass)
OR DIE (mysql_error());
@mysql_select_db ($db, $conn) OR DIE (mysql_error());

$image=imageCreateFromJPEG('tulips.jpg');
$x = 10;
$y = 15;
$colorindex = imagecolorat($image,$x,$y);
$colorrgb = imagecolorsforindex($image,$colorindex);

echo "RGB values of the pixel at position $x - $y are: $colorrgb['red'] $colorrgb['green'] $colorrgb

['blue'] \n Apha value is: $colorrgb['alpha']" ;

?>

anybody can explain to me wats wrong?

thanks in advance!

tristan
Similar Threads
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
tristan17 is offline Offline
51 posts
since Sep 2005
Dec 14th, 2005
0

Re: need help in error

you have array variables in the string, but the coding is incomplete. it should be
[php] echo "RGB values of the pixel at position {$x} - {$y} are: {$colorrgb['red']} {$colorrgb['green']} {$colorrgb['blue']} \n Apha value is: {$colorrgb['alpha']}" ;[/php]The {} make the world of difference!
Reputation Points: 10
Solved Threads: 1
Junior Poster
sarahk is offline Offline
138 posts
since Apr 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: need help in installing gd library with php 4.3.10
Next Thread in PHP Forum Timeline: New Calendar Idea Needed





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC