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
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
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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.