Parse error: parse error, unexpected T_STRING, expecting ',' or ';'
05-20-2005, 09:21 PM
|
Parse error: parse error, unexpected T_STRING, expecting ',' or ';'
|
Posts: 2,162
Name: ...
Location: ...
|
Hi,
I Have been going crazy over this simple problem...I just can't figure it out!!
Somone wanna take a shot at it?
Code:
// PHP script
<?
// Connect to the database
mysql_connect ('localhost', 'username', 'password') ;
mysql_select_db ('db_name');
// Edit this number to however many links you want displaying
$num_displayed = 3 ;
// Select random rows from the database
$result = mysql_query ("SELECT * FROM products ORDER BY RAND() LIMIT $num_displayed");
// For all the rows that you selected
while ($row = mysql_fetch_array($result))
{
// Display them to the screen...
echo "<a href="http://www.brothersvarietystore.com/shop/index.php?p=product&id= . $row["pid"]">
<img src=\"" . $row["image_url"] . "\" border=1 alt=\"" . $row["title"] ."\">
</a>" ;
}
?>
As you have probably already noticed, the error is in the title of this thread, for you convenience, here it is again, the dreaded T_String...
Code:
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/brother/public_html/rand.php on line 19
Your help is Greatly Appreciated!!
-Brian
__________________
Made2Own
|
|
|
|
05-20-2005, 09:27 PM
|
|
Posts: 2,099
Name: Adam
Location: Colchester CT
|
The error is in your echo statement, you forgot to escape the first double-quote
should be:
Code:
echo "<a href=\"http://www.brothersvarietystore.com .....
|
|
|
|
11-24-2007, 05:22 AM
|
Re: Parse error: parse error, unexpected T_STRING, expecting ',' or ';'
|
Posts: 4
Name: Marcel
|
have also this problem
Code:
<?php
session_start();
$sid=session_id();
include"intern.php"?>
<html>
<head>
<title><?php echo $titel?></title>
</head>
<?php echo $head?>
<table width="<?php echo $weite?>" align="center" valign="top" cellpadding="0" cellspacing="0">
<tr valign="top">
<td><?php echo $left2?></td>
<td width="<?php echo $weitemitte?>">
<table width="90%" cellpadding="0" cellspacing="0" align="center">
<tr height="30">
<td colspan="2" background="/Bilder/darkSilverHeader_01.gif" width="30"></td>
<td background="/Bilder/darkSilverHeader_03.gif"></td>
<td colspan="2" background="/Bilder/darkSilverHeader_05.gif" width="30"></td>
</tr>
<tr>
<td background="/Bilder/darkSilverFooter_05.gif" width="16"></td>
<td width="14"></td>
<td align="center">
<?php if(!isset($_POST['submit'])) {?>
<form action="<?php $PHP_SELF ?>" method="post">
<table width="80%" class="back1" style="border:medium solid ; border-color:#000000; padding:10px; border-spacing:10px" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="back1" align="center" colspan="2">
<b>Wählen Sie ihre Rasse und Klasse aus!!</b>
</td>
</tr>
<tr>
<td class="back1">Rasse</td>
<td class="back1"><select name="Rasse" size="1"><?php if ($data['Galaxie']=='1') { echo='<option>Mensch</option><option>Goauld</option><option>Tokra</option><option>Asgard</option><option>Replikator</option>'; } elseif ($data['Galaxie']=='2') { echo='<option>Mensch</option><option>Genii</option><option>Wraith</option><option>Replikator</option>'; } else { echo='<option>FEHLER</option>'; }?></select></td>
</tr>
<tr>
<td class="back1">Beschreibung</td>
<td class="back1"><textarea name="RBeschreibung" cols="25" rows="10"></textarea></td>
</tr>
<tr>
<td class="back1">Klasse</td>
<td class="back1"><select name="Klasse" size="1">
<option>Raider</option>
<option>Defer</option>
<option>Händler</option>
<option>Miener</option>
</select></td>
</tr>
<tr>
<td class="back1">Beschreibung</td>
<td class="back1"><textarea name="KBeschreibung" cols="25" rows="10"></textarea></td>
</tr>
<tr>
<td class="back1" align="center" colspan="2">
<input type="submit" name="submit" value="Auswahl treffen" class="button">
</td>
</tr>
</table>
</form>
<?php
}else{
$rasse = $_POST['Rasse'];
$klasse = $_POST['Klasse'];
$id = $_SESSION['user_id'];
if($update =@mysql_query("UPDATE benutzer SET Rasse = '$rasse', Klasse = '$klasse' WHERE Id = '$id'")) {
echo '<p align="center"><span class="green">Ihre Einstellungen wurden erfolgreich übernommen!<br><br>Rasse: '.$rasse.'<br>Klasse: '.$klasse.'<a href="/index2.php"><br><br>Weiter</a></p>';
}else{
echo '<p align="center"><span class="green">Beim ändern ihrer Einstellungen trat leider ein Fehler auf!<br><br><a href="/chose.php">Zurück</a></p>';}}?></td>
<td width="14"></td>
<td background="/Bilder/darkSilverFooter_06.gif" width="16"></td>
</tr>
<tr height="13">
<td background="/Bilder/darkSilverFooter_01.gif" width="16"></td>
<td colspan="3" background="/Bilder/darkSilverFooter_02.gif"></td>
<td background="/Bilder/darkSilverFooter_04.gif" width="16"></td>
</tr>
</table>
</td>
<td><?php echo $right2; ?></td>
</tr>
</table>
</body>
</html>
errorcode:
Code:
Parse error: parse error, unexpected '=', expecting ',' or ';' in /srv/www/htdocs/web156/html/sg/chose.php on line 34
that is this line:
Code:
<td class="back1"><select name="Rasse" size="1"><?php if ($data['Galaxie']=='1') { echo='<option>Mensch</option><option>Goauld</option><option>Tokra</option><option>Asgard</option><option>Replikator</option>'; } elseif ($data['Galaxie']=='2') { echo='<option>Mensch</option><option>Genii</option><option>Wraith</option><option>Replikator</option>'; } else { echo='<option>FEHLER</option>'; }?></select></td>
|
|
|
|
11-24-2007, 08:36 AM
|
Re: Parse error: parse error, unexpected T_STRING, expecting ',' or ';'
|
Posts: 134
|
echo= should be echo (3 times)
__________________
Please login or register to view this content. Registration is FREE
Check out the Facebook Clone build with Jcow SNS at Please login or register to view this content. Registration is FREE , it is free and it always will be
|
|
|
|
11-24-2007, 05:00 PM
|
Re: Parse error: parse error, unexpected T_STRING, expecting ',' or ';'
|
Posts: 4
Name: Marcel
|
oh yes... thanks very much... I forgot^^ is a long time ago that i coded the last time^^
|
|
|
|
08-01-2008, 01:11 PM
|
Re: Parse error: parse error, unexpected T_STRING, expecting ',' or ';'
|
Posts: 1
|
I have that problem too here is my code
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- Meta Data -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="Short description of your site here." />
<meta name="keywords" content="keywords, go, here, seperated, by, commas" />
<?php include("content/var.php"); ?>
<!-- Site Title -->
<title> <?php echo $title ?> </title>
<!-- Link to Style External Sheet -->
<link href="style.css" type="text/css" rel="stylesheet" />
</head>
<body>
<?php include("content/toppart.php") ?>
<h3>Report A Sighting</h3>
<p>
<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$email = $_REQUEST['email'] ;
$state = $_REQUEST['state'] ;
$time = $_REQUEST['time'] ;
$description = $_REQUEST['description'] ;
mail( "Andy@easternbigfoot.com", "Subject: $subject",
$message, "From: $email" );
echo "Thank you for using our mail form";
}
else
//if "email" is not filled out, display the form
{
echo "<form method='post' action='mailform-sightings.php'>
Email: <input name='email' type='text' /><br />
State:
<select name="state">
<option value="NewYork">New York</option>
<option value="Connecticut">Connecticut</options>
</select>
Time Of Event:
<select name="time", size="1">
<option value="Morning">Morining</option>
<option value="DayTime">Day Time</option>
<option Value="Night">Night Time</option>
</select>
Description Of Event:<br />
<textarea name='description' rows='15' cols='40'>
</textarea><br />
<input type='submit' />
</form>";
}
?>
</p>
</div>
<div id='right_side'>
<?php include("content/right.php") ?>
</div>
<div class='spacer'></div>
</div>
<div id='page_footer'>
<?php include("content/footer.php") ?>
</div>
</div>
</body>
</html>
|
|
|
|
08-01-2008, 01:30 PM
|
Re: Parse error: parse error, unexpected T_STRING, expecting ',' or ';'
|
Posts: 843
Name: Mike
Location: United Kingdom
|
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <!-- Meta Data --> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="description" content="Short description of your site here." /> <meta name="keywords" content="keywords, go, here, seperated, by, commas" /> <?php include("content/var.php"); ?> <!-- Site Title --> <title> <?php echo $title ?> </title> <!-- Link to Style External Sheet --> <link href="style.css" type="text/css" rel="stylesheet" /> </head> <body> <?php include("content/toppart.php") ?> <h3>Report A Sighting</h3> <p> <?php if (isset($_REQUEST['email'])) //if "email" is filled out, send email { //send email $email = $_REQUEST['email'] ; $state = $_REQUEST['state'] ; $time = $_REQUEST['time'] ; $description = $_REQUEST['description'] ; mail( "Andy@easternbigfoot.com", "Subject: $subject", $message, "From: $email" ); echo "Thank you for using our mail form"; } else //if "email" is not filled out, display the form { echo "<form method='post' action='mailform-sightings.php'> Email: <input name='email' type='text' /><br /> State: <select name="state"> <option value="NewYork">New York</option> <option value="Connecticut">Connecticut</options> </select> Time Of Event: <select name="time", size="1"> <option value="Morning">Morining</option> <option value="DayTime">Day Time</option> <option Value="Night">Night Time</option> </select> Description Of Event:<br /> <textarea name='description' rows='15' cols='40'> </textarea><br /> <input type='submit' /> </form>"; } ?> </p> </div> <div id='right_side'> <?php include("content/right.php") ?> </div> <div class='spacer'></div> </div> <div id='page_footer'> <?php include("content/footer.php") ?> </div> </div> </body> </html>
argh! your includes are missing ; and one of your echo's has double quotes in it.
Try this:
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <!-- Meta Data --> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="description" content="Short description of your site here." /> <meta name="keywords" content="keywords, go, here, seperated, by, commas" /> <?php include("content/var.php"); ?> <!-- Site Title --> <title> <?php echo $title; ?> </title> <!-- Link to Style External Sheet --> <link href="style.css" type="text/css" rel="stylesheet" /> </head> <body> <?php include("content/toppart.php"); ?> <h3>Report A Sighting</h3> <p> <?php if (isset($_REQUEST['email'])) //if "email" is filled out, send email { //send email $email = $_REQUEST['email'] ; $state = $_REQUEST['state'] ; $time = $_REQUEST['time'] ; $description = $_REQUEST['description'] ; mail( "Andy@easternbigfoot.com", "Subject: $subject", $message, "From: $email" ); echo "Thank you for using our mail form"; } else //if "email" is not filled out, display the form { ?> <form method='post' action='mailform-sightings.php'> Email: <input name='email' type='text' /><br /> State: <select name="state"> <option value="NewYork">New York</option> <option value="Connecticut">Connecticut</options> </select> Time Of Event: <select name="time", size="1"> <option value="Morning">Morining</option> <option value="DayTime">Day Time</option> <option Value="Night">Night Time</option> </select> Description Of Event:<br /> <textarea name='description' rows='15' cols='40'> </textarea><br /> <input type='submit' /> </form> <?php } ?> </p> </div> <div id='right_side'> <?php include("content/right.php"); ?> </div> <div class='spacer'></div> </div> <div id='page_footer'> <?php include("content/footer.php"); ?> </div> </div> </body> </html>
__________________
My Blog/Site: Please login or register to view this content. Registration is FREE
Last edited by rogem002; 08-01-2008 at 01:31 PM..
|
|
|
|
06-17-2010, 05:37 PM
|
Re: Parse error: parse error, unexpected T_STRING, expecting ',' or ';'
|
Posts: 1
Name: Steve
|
Can anyone look at this for me? I'm a total PHP newb but this is not my code...PHP is spitting an error at me for T_STRING at this line...any help would be great - thanks!
global $submit,$sql_act,$sql_query,$sql_query_result,$sql _confirm,$sql_query_error,$tbl_struct;
if (($submit) and (!$sql_query_result) and ($sql_confirm)) {if (!$sql_query_error) {$sql_query_error = "Query was empty";} echo "<b>Error:</b> <br>".$sql_query_error."<br>";}
|
|
|
|
06-17-2010, 06:59 PM
|
Re: Parse error: parse error, unexpected T_STRING, expecting ',' or ';'
|
Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
|
the error will probably be a missing semicolon in a line ABOVE that the interpreter indicated.
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
|
« Reply to Parse error: parse error, unexpected T_STRING, expecting ',' or ';'
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|