Jump to content

Recommended Posts

I am getting an unexpected T_string error? Not seeing it need a second pair of eyes!

<?php
print '<div id="roster">';
print '<h1 class=backstage>Singles Biographies</h1>';
print '<a href="/roster/tagteam">Tag Teams</a> | <a href="/roster/stables">Stables</a> | <a href="/roster/managers">Managers</a> | <a href="/roster/referees">Referees</a> | <a href=/roster/staff>Staff</a>';
$query = "SELECT bio.sortorder as sortorder FROM efed_bio as bio INNER JOIN efed_list_styles as style ON ( bio.style_id = style.id ) WHERE style.name = 'singles' and bio.status_id = '1' GROUP BY bio.sortorder ORDER BY bio.sortorder";
$result = mysql_query ($query); 
while ($row = mysql_fetch_assoc($result)) { $sortorder=$row['sortorder'];
if ($sortorder == "0-9") {
print '<!--<h2 class=backstage>- ".$sortorder." -</h2>-->';
} else
{
print '<!--<h2 class=backstage>- ".$sortorder.strtolower($sortorder)." -</h2>-->';
} 
print '<table>';
$querya = "SELECT bio.username as username, bio.charactername as charactername, biosingles.hometown as singleshometown, biosingles.height as singlesheight,biosingles.weight as singlesweight, FROM efed_bio as bio INNER JOIN efed_list_styles as style ON ( bio.style_id = style.id ) LEFT JOIN efed_bio_singles as biosingles ON ( bio.id = biosingles.bio_id )  WHERE style.name = 'singles' and bio.sortorder = '$sortorder' and bio.status_id = '1' ORDER BY bio.charactername";
$resulta = mysql_query ($querya); 
while ($rowa = mysql_fetch_assoc($resulta))
{
$fieldarray=array('username','charactername','singleshometown','singlesheight','singlesweight');
foreach ($fieldarray as $fieldlabel)
{
if (isset($rowa[$fieldlabel])) 
{ 
$$fieldlabel=$rowa[$fieldlabel];
$$fieldlabel=cleanquerydata($$fieldlabel);
}
}
print '<tr>';
print '<td align=center>';
if (file_exists('/images/headshots/'.$posername.'.jpg'))
{
print '<img src='/backstage/images/headshots/".$posername.".jpg'></a>';
}else{
print '<img src='/backstage/images/headshots/default.jpg'></a>';
}
print '</td>';
print '<td class=name><span class=rostername><a class=biolinks href=/backstage/bio.php?username=" . $username . ">".$charactername."</a></span>';
print 'Height: ".$singlesheight."<br />';
print 'Weight: ".$singlesweight."<br />';
print 'Hometown: ".$singleshometown."<br />';
print '</td></tr>';
}
print '</table>';
print '<!--<br>-->';
print '</div>';
?>

Link to comment
https://forums.phpfreaks.com/topic/200559-unexpected-tstring/
Share on other sites

Yeah lesson here is never c&p to ms word to hold your code into something else. lol I'm an idiot. Anyway now getting.

 

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/content/y/a/n/yankeefaninkc/html/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 32

 

Link to comment
https://forums.phpfreaks.com/topic/200559-unexpected-tstring/#findComment-1052424
Share on other sites

Just about every string in that code that contains either a php variable or contains another quote within the outer quoted string is wrong (take a look at the color highlighting that the forum software did.)

 

A) php variables are only repalced by their value when they are contained within a string that starts/ends with double-quotes.

B) Putting php variables inside double-quoted strings usually results in fewer syntax errors than using concatenate.

C) Any quote within a string that is the same type of quote that started the string will close the string unless you escape it or use a different type of quote in the string than starts/ends the string.

 

What does this thread have to do with the forum section you posted it in? It is php syntax errors in strings that are not being written correctly.

Link to comment
https://forums.phpfreaks.com/topic/200559-unexpected-tstring/#findComment-1052441
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.