Jump to content

[SOLVED] how i do this?


ohdang888

Recommended Posts

thanks, but one problem...

its giving this error:

 

 

Parse error: syntax error, unexpected '<' in C:\xampp\htdocs\game.php on line 61

 

 

 

heres my full code

<?php

$game_pic = stripslashes($row['game_picture_url']);

  if (strlen($game_pic) > 0) {
    <IMG SRC="gamepic/<?php echo stripslashes($row['game_picture_url'])?>" WIDTH="150" HEIGHT="110" BORDER="0" ALT= "free online (THIS IS LINE 61)
games, free flash games">
  }

?>

Link to comment
Share on other sites

your mixing html and php without echoing it...

 

rewrite your code to this

<?php

$game_pic = stripslashes($row['game_picture_url']);

  if (strlen($game_pic) > 0) {
    echo "<IMG SRC="gamepic/";
    echo stripslashes($row['game_picture_url']). " ' WIDTH='150' HEIGHT='110' BORDER='0' ALT= 'free online (THIS IS LINE 61)
games, free flash games">";
  }

?>

Link to comment
Share on other sites

<?php

$game_pic = stripslashes($row['game_picture_url']);

  if (strlen($game_pic) > 0) {
    ?>

<IMG SRC="gamepic/<?=stripslashes($row['game_picture_url']) ?>"  WIDTH="150" HEIGHT="110" BORDER="0" ALT= "free online games, free flash games">
<?php
  }

?>

 

Try that... the single and double quotes were being mixed and not escaped properly.

 

Link to comment
Share on other sites

Notice how I dropped out of PHP and into HTML and back when needed. This can sometimes make the code a bit sloppy, but it allows you to avoid a lot of single and double quotes and escaping them properly and such.

 

I always try to use ' ' when possible.

 

for example..

 

<?php
$var1='<a href="#" class="someclass">This is my string when I need to </a>escape for a '.$variable .' I do so like that see '.$anothervar;
?>

Notice how I did not have to escape the hell out of the HTML. It helps in the long run. :)

 

Hope I helped some.

 

Nate

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.