Forum Moderators: coopster

Message Too Old, No Replies

echo parse errors

         

kkonline

7:35 am on Sep 18, 2007 (gmt 0)

10+ Year Member



echo ' <img src="/addons/class.upload/test/'.$name.' border='0' height='50%' width='50%' alt='{$row['title']}'" />'; 

the above code gives a parse error. Please tell me where am i going wrong?

dreamcatcher

7:43 am on Sep 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You are echoing your data between single quotes and using single quotes in the string. The string will terminate when it reaches the the next single quote unless concatenated with a var.

echo '<img src="/addons/class.upload/test/'.$name.'" border="0" height="50%" width="50%" alt="'.{$row['title']}'" />';

dc

kkonline

8:11 am on Sep 18, 2007 (gmt 0)

10+ Year Member



dc the code you suggested still gives a parse error

kunwarbs

9:28 am on Sep 18, 2007 (gmt 0)

10+ Year Member



try this. it should work
$title=$row['title'];

echo "<img src='/addons/class.upload/test/$name' border='0' height='50%' width='50%' alt='$title' />";

kkonline

9:41 am on Sep 18, 2007 (gmt 0)

10+ Year Member



ya thanks for that bit. I think it's a very good idea to break the things into parts and then use them rather than writing one line full of commas, single quotes, double quotes , square and curly brackets...

tomda

9:56 am on Sep 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Dreamcatcher solution should work.

echo '<img src="/addons/class.upload/test/'.$name.'" border="0" height="50%" width="50%" alt="'.$row['title']'" />';

jatar_k

12:16 pm on Sep 18, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



except dc missed a dot ;)

echo '<img src="/addons/class.upload/test/'.$name.'" border="0" height="50%" width="50%" alt="'.{$row['title']}.'" />';

dreamcatcher

12:46 pm on Sep 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Oops, I did indeed. Sorry guys.

dc