Jump to content

Getting Parse error: syntax error, unexpected '<' in


Iank1968

Recommended Posts

I get this error everytime I try to access the landmarks page:

 

Parse error: syntax error, unexpected '<' in /home/ianapps/public_html/globetrotters/common.php on line 114

 

114 is <?

 

Here is the code

<?
  <table border="0" colspacing="2" colpadding="2">
  <tr> <th width="100"> <h3 class="subtitle">Date</h3> </th> <th width="120"> <h3 class="subtitle">Name</h3> </th> <th width="120"> <h3 class="subtitle">You Get</h3> </th> <th width="120"> <h3 class="subtitle">They want</h3> </th><th width="80"> <h3 class="subtitle">Action</h3> </th> 
  </tr>
?>

 

I cant figure out whats wrong.

Link to comment
Share on other sites

I just realized this is in the wrong forum ooops lol. Anyhow I did have an open tag and closed it now I have the parse error in line 115

 

this is before that

 

}
function ParseInTrades ($data) {
global $db_to_desc_send;
  if (!count($data))
    return;
  global $facebook;
}

Link to comment
Share on other sites

Like that:

 

<?php
// some php
}
function ParseInTrades ($data) {
global $db_to_desc_send;
  if (!count($data))
    return;
  global $facebook;
}
?>
  <table border="0" colspacing="2" colpadding="2">
  <tr> <th width="100"> <h3 class="subtitle">Date</h3> </th> <th width="120"> <h3 class="subtitle">Name</h3> </th> <th width="120"> <h3 class="subtitle">You Get</h3> </th> <th width="120"> <h3 class="subtitle">They want</h3> </th><th width="80"> <h3 class="subtitle">Action</h3> </th>
  </tr>
<?php 
//more php
?>

 

Link to comment
Share on other sites

Well that didnt work, no I get that error in line 109 which is <?php

 

heres the code now

<?php
//some php
function ParseInTrades ($data) {
global $db_to_desc_send;
  if (!count($data))
    return;
  global $facebook;
}
<?
  <table border="0" colspacing="2" colpadding="2">
  <tr> <th width="100"> <h3 class="subtitle">Date</h3> </th> <th width="120"> <h3 class="subtitle">Name</h3> </th> <th width="120"> <h3 class="subtitle">You Get</h3> </th> <th width="120"> <h3 class="subtitle">They want</h3> </th><th width="80"> <h3 class="subtitle">Action</h3> </th> 
  </tr>
<?php
?>

Link to comment
Share on other sites

Like that:

 

<?php
// some php
}
function ParseInTrades ($data) {
global $db_to_desc_send;
  if (!count($data))
    return;
  global $facebook;
}
?>
  <table border="0" colspacing="2" colpadding="2">
  <tr> <th width="100"> <h3 class="subtitle">Date</h3> </th> <th width="120"> <h3 class="subtitle">Name</h3> </th> <th width="120"> <h3 class="subtitle">You Get</h3> </th> <th width="120"> <h3 class="subtitle">They want</h3> </th><th width="80"> <h3 class="subtitle">Action</h3> </th>
  </tr>
<?php 
//more php
?>

 

This is right, but for you I think you want the following

 

(COPY AND PASTE)

<?php
// some php
}
function ParseInTrades ($data) {
global $db_to_desc_send;
  if (!count($data))
    return;
  global $facebook;
}
?>
  <table border="0" colspacing="2" colpadding="2">
  <tr> <th width="100"> <h3 class="subtitle">Date</h3> </th> <th width="120"> <h3 class="subtitle">Name</h3> </th> <th width="120"> <h3 class="subtitle">You Get</h3> </th> <th width="120"> <h3 class="subtitle">They want</h3> </th><th width="80"> <h3 class="subtitle">Action</h3> </th>
  </tr>

If you want to add more php put in <?php your code here than close it with ?>

Link to comment
Share on other sites

Well I did as you said and I still get the same error. Its like it doesnt like <? or <?php

 

<?php
// some php
}
function ParseInTrades ($data) {
global $db_to_desc_send;
  if (!count($data))
    return;
  global $facebook;
}
?>
  <table border="0" colspacing="2" colpadding="2">
  <tr> <th width="100"> <h3 class="subtitle">Date</h3> </th> <th width="120"> <h3 class="subtitle">Name</h3> </th> <th width="120"> <h3 class="subtitle">You Get</h3> </th> <th width="120"> <h3 class="subtitle">They want</h3> </th><th width="80"> <h3 class="subtitle">Action</h3> </th>
  </tr>

 

 

Link to comment
Share on other sites

Might be an idea to post a bit more of the code prior to the error - are there any php sections before it that are not closed properly etc?

 

<?php
// some php
}     //<<<<<<<<<<<<< Why are you closing a bracket thats not opened, unless it's opened in a previous section?
function ParseInTrades ($data) {
global $db_to_desc_send;
  if (!count($data))
    return;
  global $facebook;
}
?>

 

Link to comment
Share on other sites

this is on my common.php file, its 2000 lines long, dont think you want it all do you? I will give you a few lines before that function. I got rid of that bracket and still got the parse error

 

function GetInTradesSideBar ($user) {
  global $logtrade_table;
  $result = Query ("SELECT id,unix_timestamp(date) as datets,uid_from,what,amt,what_req,amt_req,auth FROM $logtrade_table WHERE uid_to=$user and hide=0 and auth=0 ORDER by date DESC"); // get trades coming into you
$i=0;
if (mysql_num_rows ($result) == 0)
  return "<br/>.";
$a = '<table>';
  while ($row = mysql_fetch_array ($result)) {
    $u = $row['uid_from'];
    $a .= '<tr><td bgcolor="#eaeaea"><fb:profile-pic uid="'.$u.'"/>  <br/><fb:name uid="'.$u.'"/></td><td bgcolor="#eaeaea">' . date ("F j", $row['datets'] ) . ' - <b><a href="?id=trade">View</a></b></td></tr>';
    $i++;
  }
  $a .= '</table>';
  return $a;
}
function GetOutTrades ($user) {
  global $logtrade_table;
  $result = Query ("SELECT id,unix_timestamp(date) as datets,uid_to,what,amt,what_req,amt_req,auth,hide FROM $logtrade_table WHERE uid_from=$user ORDER by date DESC limit 50 "); // get trades coming into you
  $i=0;
  while ($row = mysql_fetch_array ($result)) {
    $out[$i]['id'] = $row['id'];
    $out[$i]['date'] = $row['datets'];
    $out[$i]['uid_to'] = $row['uid_to'];
    $out[$i]['what'] = $row['what'];
    $out[$i]['amt'] = $row['amt'];
    $out[$i]['what_req'] = $row['what_req'];
    $out[$i]['amt_req'] = $row['amt_req'];
    $out[$i]['auth'] = $row['auth'];
    $out[$i]['hide'] = $row['hide'];
    $i++;
  }
  return $out;
}
<?php
// some php
function ParseInTrades ($data) {
global $db_to_desc_send;
  if (!count($data))
    return;
  global $facebook;
}
?>
<table border="0" colspacing="2" colpadding="2">
  <tr> <th width="100"> <h3 class="subtitle">Date</h3> </th> <th width="120"> <h3 class="subtitle">Name</h3> </th> <th width="120"> <h3 class="subtitle">You Get</h3> </th> <th width="120"> <h3 class="subtitle">They want</h3> </th><th width="80"> <h3 class="subtitle">Action</h3> </th>
  </tr>

 

line 109 is <?php

Link to comment
Share on other sites

ok I took out <?php ?> and now its saying Parse error: syntax error, unexpected '<' in /home/ianapps/public_html/globetrotters/common.php on line 118

 

line 118 - 120

<table border="0" colspacing="2" colpadding="2">
  <tr> <th width="100"> <h3 class="subtitle">Date</h3> </th> <th width="120"> <h3 class="subtitle">Name</h3> </th> <th width="120"> <h3 class="subtitle">You Get</h3> </th> <th width="120"> <h3 class="subtitle">They want</h3> </th><th width="80"> <h3 class="subtitle">Action</h3> </th>
  </tr>

Link to comment
Share on other sites

ok I am gonna post from line 1 to just past the error.

 

<?php
require 'settings.php';
$username = "ianapps";
$password = "wdLlGQbZlswP";
$hostname = "localhost"; 
$conn = mysql_connect ($dbhost, $dbuser, $dbpass);
$sel = mysql_select_db ($dbname, $conn);
if (!$sel || !$conn) {  exit; 
}
function Query ($q) {
  global $conn;
  $result = mysql_query ($q, $conn);
  if (!$result) {
      }
  return $result;
}
function getprizeproperty($fprize)
{
}
function TransferPrize ($from, $to, $prize, $amt) {
  if (GetPrizeProperty ($from, $prize) >= $amt) {
      ChangePrizeProperty ($from, $prize, -$amt, false);
      ChangePrizeProperty ($to, $prize, $amt, false);
      return true;
  }
   return false;
}
function TransferMoney ($from, $to, $amt) {
  if (GetMoney ($from) >= $amt*100) {
      AlterMoney ($from, -$amt*100);
      AlterMoney ($to, $amt*100);
      return true;
  }
  return false;
}
function IsThereEnough ($uid, $what, $amt) {
  if ($what == 'money') {
    if (GetMoney ($uid) < $amt)
      return false;
  }
  else {
    if (GetPrizeProperty ($uid, $what) < $amt)
      return false;
  }
    return true;
    }
function LogStealAttempt ($user_from, $user_to, $what, $amt) {
  global $logsendneg_table;
  Query ("INSERT INTO $logsendneg_table SET uid_from=$user_from, uid_to=$user_to, what='$what', amt=$amt");
}
function LogSend ($user_from, $user_to, $what, $amt, $trade=0) {
  global $logsend_table;
  Query ("INSERT INTO $logsend_table SET uid_from=$user_from, uid_to=$user_to, what='$what', amt=$amt, trade=$trade");
}
function LogTrade ($user_from, $user_to, $tx_what, $tx_amt, $rx_what, $rx_amt) {
  global $logtrade_table;
  Query ("INSERT INTO $logtrade_table SET uid_from=$user_from, uid_to=$user_to, what='$tx_what', amt=$tx_amt, what_req='$rx_what', amt_req=$rx_amt");
}
function GetInTrades ($user) {
  global $logtrade_table;
  $result = Query ("SELECT id,unix_timestamp(date) as datets,uid_from,what,amt,what_req,amt_req,auth FROM $logtrade_table WHERE uid_to=$user and hide=0 and auth=0 ORDER by date DESC"); // get trades coming into you
   $i=0;
  while ($row = mysql_fetch_array ($result)) {
    $in[$i]['id'] = $row['id'];
    $in[$i]['date'] = $row['datets'];
    $in[$i]['uid_from'] = $row['uid_from'];
    $in[$i]['what'] = $row['what'];
    $in[$i]['amt'] = $row['amt'];
    $in[$i]['what_req'] = $row['what_req'];
    $in[$i]['amt_req'] = $row['amt_req'];
    $in[$i]['auth'] = $row['auth'];
    $i++;
  }
  return $in;
}
function GetInTradesSideBar ($user) {
  global $logtrade_table;
  $result = Query ("SELECT id,unix_timestamp(date) as datets,uid_from,what,amt,what_req,amt_req,auth FROM $logtrade_table WHERE uid_to=$user and hide=0 and auth=0 ORDER by date DESC"); // get trades coming into you
$i=0;
if (mysql_num_rows ($result) == 0)
  return "<br/>.";
$a = '<table>';
  while ($row = mysql_fetch_array ($result)) {
    $u = $row['uid_from'];
    $a .= '<tr><td bgcolor="#eaeaea"><fb:profile-pic uid="'.$u.'"/>  <br/><fb:name uid="'.$u.'"/></td><td bgcolor="#eaeaea">' . date ("F j", $row['datets'] ) . ' - <b><a href="?id=trade">View</a></b></td></tr>';
    $i++;
  }
  $a .= '</table>';
  return $a;
}
function GetOutTrades ($user) {
  global $logtrade_table;
  $result = Query ("SELECT id,unix_timestamp(date) as datets,uid_to,what,amt,what_req,amt_req,auth,hide FROM $logtrade_table WHERE uid_from=$user ORDER by date DESC limit 50 "); // get trades coming into you
  $i=0;
  while ($row = mysql_fetch_array ($result)) {
    $out[$i]['id'] = $row['id'];
    $out[$i]['date'] = $row['datets'];
    $out[$i]['uid_to'] = $row['uid_to'];
    $out[$i]['what'] = $row['what'];
    $out[$i]['amt'] = $row['amt'];
    $out[$i]['what_req'] = $row['what_req'];
    $out[$i]['amt_req'] = $row['amt_req'];
    $out[$i]['auth'] = $row['auth'];
    $out[$i]['hide'] = $row['hide'];
    $i++;
  }
  return $out;
}

// some php
function ParseInTrades ($data) {
global $db_to_desc_send;
  if (!count($data))
    return;
  global $facebook;
}

<table border="0" colspacing="2" colpadding="2">
  <tr> <th width="100"> <h3 class="subtitle">Date</h3> </th> <th width="120"> <h3 class="subtitle">Name</h3> </th> <th width="120"> <h3 class="subtitle">You Get</h3> </th> <th width="120"> <h3 class="subtitle">They want</h3> </th><th width="80"> <h3 class="subtitle">Action</h3> </th>
  </tr>

Link to comment
Share on other sites

This is php code

 

// some php
function ParseInTrades ($data) {
global $db_to_desc_send;
  if (!count($data))
    return;
  global $facebook;
}

 

and this is HTML.

 

<table border="0" colspacing="2" colpadding="2">
  <tr> <th width="100"> <h3 class="subtitle">Date</h3> </th> <th width="120"> <h3 class="subtitle">Name</h3> </th> <th width="120"> <h3 class="subtitle">You Get</h3> </th> <th width="120"> <h3 class="subtitle">They want</h3> </th><th width="80"> <h3 class="subtitle">Action</h3> </th>
  </tr>

 

You can put html in a php section of code, but not like that. you have 2 options. This one closes the php tag, puts the html code, and then reopens it

 

<?php 

//all your code was in here, but cut to make it easier to understand

// some php
function ParseInTrades ($data) {
global $db_to_desc_send;
  if (!count($data))
    return;
  global $facebook;
}

?>
<table border="0" colspacing="2" colpadding="2">
  <tr> <th width="100"> <h3 class="subtitle">Date</h3> </th> <th width="120"> <h3 class="subtitle">Name</h3> </th> <th width="120"> <h3 class="subtitle">You Get</h3> </th> <th width="120"> <h3 class="subtitle">They want</h3> </th><th width="80"> <h3 class="subtitle">Action</h3> </th>
  </tr>
<?php
//any more php code goes here

?>

 

 

or, my preference, simply use echo to write the html code.

 

<?php 

//all your code was in here, but cut to make it easier to understand

// some php
function ParseInTrades ($data) {
global $db_to_desc_send;
  if (!count($data))
    return;
  global $facebook;
}

echo '<table border="0" colspacing="2" colpadding="2">';
echo '<tr><th width="100"><h3 class="subtitle">Date</h3></th><th width="120"><h3 class="subtitle">Name</h3></th><th width="120">';
echo '<h3 class="subtitle">You Get</h3></th><th width="120"><h3 class="subtitle">They want</h3></th><th width="80">';
echo '<h3 class="subtitle">Action</h3></th></tr>';

//any more php code goes here

?>

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.