Jump to content

Recommended Posts

Hello, tinkering around with my code (which worked) and I've attempted to use frames and the php is having errors.

I've tried including html tags, using echo all through (escaping quotes) etc, and I just can't figure it out =/

 

It returns

 

Parse error: syntax error, unexpected '<' in xxxxxxxxxxxxx/content.php  on line 19  (line 19 is print "it worked"..ironically)

 

Many thanks in advance.

 

<?php
//INDEX
session_start();
include 'connect.php';
?>
<center>

<h1>lets hope it connects..</h1>

</center><br><br>
<link rel="stylesheet" href="style.css" type="text/css">
<?php
if (isset($_SESSION['player'])) 
  {
    $player=$_SESSION['player'];
    $userstats="SELECT * from database where playername='$player'";
    $userstats2=mysql_query($userstats) or die("Could not get user stats");
    $userstats3=mysql_fetch_array($userstats2);
    print "it worked =)";<br>
    <a href="fight.php">Kill A Creature!</a><br>
    if($userstats3[dead]=='Yes')
    {
      print "You're dead.<br>";
    }
  }
else
  {
    print "Sorry, not logged in  please <A href='login.php' target="content.php">Login</a><br>";
  
  }

?>

Link to comment
https://forums.phpfreaks.com/topic/202930-php-and-frames/
Share on other sites

Like thorpe stated, the correct code should be:

 

<?php
//INDEX
session_start();
include 'connect.php';
?>
<center>

<h1>lets hope it connects..</h1>

</center><br><br>
<link rel="stylesheet" href="style.css" type="text/css">
<?php
if (isset($_SESSION['player'])) 
  {
    $player=$_SESSION['player'];
    $userstats="SELECT * from database where playername='$player'";
    $userstats2=mysql_query($userstats) or die("Could not get user stats");
    $userstats3=mysql_fetch_array($userstats2);
    print "it worked =)
    <br>
    <a href=\"fight.php\">Kill A Creature!</a><br>";
    if($userstats3[dead]=='Yes')
    {
      print "You're dead.<br>";
    }
  }
else
  {
    print "Sorry, not logged in  please <A href='login.php' target="content.php">Login</a><br>";
  
  }

?>

 

Please read for future reference: http://gulati.info/2010/01/many-ways-to-integrate-html-into-php/

Link to comment
https://forums.phpfreaks.com/topic/202930-php-and-frames/#findComment-1063443
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.