Jump to content

parse error ?


Porkie

Recommended Posts

echo "<a href='www.aa.co.uk/Newdirectory/video.php?category={$videos['category']}'>($videos['category']}</a>";

 

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/myuklive/public_html/Newdirectory/video.php on line 64

 

cheers for any help

Link to comment
https://forums.phpfreaks.com/topic/164442-parse-error/
Share on other sites

whats line 63-65, line 64 checks out as far as I can tell. You could try this just to be sure it gets parsed as expected (not that it should have any issues as is):

echo "<a href='www.aa.co.uk/Newdirectory/video.php?category=".$videos['category']."'>".$videos['category']."</a>";

 

Link to comment
https://forums.phpfreaks.com/topic/164442-parse-error/#findComment-867417
Share on other sites

I believe that that is saying that $videos['category'] is not set. Not just empty, but hasn't been defined at all.

Try:

$cat = (is_set($videos['category'])) ? $videos['category'] : "NULL";
echo "<a href='www.aaa.co.uk/Newdirectory/video.php?category=".$cat ."'>".$cat ."</a>";

 

mjdamato, whats the problem, do explain...

Link to comment
https://forums.phpfreaks.com/topic/164442-parse-error/#findComment-867433
Share on other sites

Maybe you were writing your post before I added my last comment. Look at the two characters I highlighted in red. They are being used to encapsulate a variable that the PHP code should evaluate in the string. but the first character is a paren and the second is a curly brace. The BOTH need to be curly braces

 

() - parens

{} - curly braces

Link to comment
https://forums.phpfreaks.com/topic/164442-parse-error/#findComment-867436
Share on other sites

echo "<a href='www.aa.co.uk/Newdirectory/video.php?category={$video[$c]['category']}'>{$video[$c]['category']}</a>";

 

Notice: Undefined offset: 8 in /home/myuklive/public_html/Newdirectory/video.php on line 64

 

Notice: Undefined offset: 8 in /home/myuklive/public_html/Newdirectory/video.php on line 64

 

still errors m8

 

cheers for all help tho :D

Link to comment
https://forums.phpfreaks.com/topic/164442-parse-error/#findComment-867439
Share on other sites

echo "<a href='www.aa.co.uk/Newdirectory/video.php?category={$video[$c]['category']}'>{$video[$c]['category']}</a>";

 

Notice: Undefined offset: 8 in /home/myuklive/public_html/Newdirectory/video.php on line 64

 

Notice: Undefined offset: 8 in /home/myuklive/public_html/Newdirectory/video.php on line 64

 

still errors mate

 

cheers for all help tho :D

 

What the hell! You're changing the code. In the code you first posted the array didn't have two indexes with the first index being [$c]

 

Original: $videos['category']

Modified: $video[$c]['category']

 

Hmm... you aded a new index and you get an error about an undefined offset. I'll go out on a limb here and guess you haven't defined $c or it is a value that doesn't exist as an index in that array. Either way you should fix the original problem before trying to add new code/functionality.

Link to comment
https://forums.phpfreaks.com/topic/164442-parse-error/#findComment-867445
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.