parse error, unexpected T_STRING

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jdimino
Forum Newbie
Posts: 6
Joined: Sat Dec 31, 2005 2:28 pm

parse error, unexpected T_STRING

Post by jdimino »

Hi

I'm getting an, unexpected T_STRING on line 9, can someone tell me what is wrong with this code.
Thanks

Code: Select all

<?PHP
mysql_connect("localhost", "xxxx_xxxx", "xxxx") or die(mysql_error());
mysql_select_db("xxxx_xxx") or die(mysql_error());
$sql = "SELECT * FROM `ihsreg` ORDER BY `Bloom_Name` ASC";
if (!(@ $result = mysql_query($sql))) {
	print "There was an error running your query:<p>\n". $sql . "<p>\n";
}	
print '<select name="Pod_Name, Pollen_Name"
onchange="window.location='SEindex1.php?search.value=this.options[this.selectedIndex].text;"><br>\n';
print '<option value="#">  Choose One   ';
while ($row = mysql_fetch_row($result)) {
	$id   = $row[0];
	$Pod_Name = $row[4];
	$Pollen_Name = $row[5];
    $x= x ;
	$cross = "$Pod_Name $x $Pollen_Name"  ;
	print "<option value=\"$id\"";
	if ($_REQUEST["Pod_Name,Pollen_Name"] == $id) { print " selected"; }

	print "> $cross <br>\n";
}
print '</select>';
 
?>
jabbaonthedais
Forum Contributor
Posts: 127
Joined: Wed Aug 18, 2004 12:08 pm

Post by jabbaonthedais »

You should post this in the "PHP - Code" section to get more response, but try changing this:

Code: Select all

print '<option value="#">  Choose One   ';
to this:

Code: Select all

print "<option value='#'>  Choose One   ";
jdimino
Forum Newbie
Posts: 6
Joined: Sat Dec 31, 2005 2:28 pm

Post by jdimino »

Hi
I made the change, but the error is still on line 9. I've also post it in PHP CODE I hope I will get some answers from them.
Thanks
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

Try this:

Code: Select all

<?PHP 
mysql_connect("localhost", "xxxx_xxxx", "xxxx") or die(mysql_error()); 
mysql_select_db("xxxx_xxx") or die(mysql_error()); 
$sql = "SELECT * FROM `ihsreg` ORDER BY `Bloom_Name` ASC"; 
if (!(@ $result = mysql_query($sql))) { 
        print "There was an error running your query:<p>\n". $sql . "<p>\n"; 
}     
// You can remove this comment for you script but:
// When you have a ' in side of a string your printing with ' around it (or if you have a " inside of a print that you using " around it) you must excape it  but putting a \ in front of it:   
print '<select name="Pod_Name, Pollen_Name" 
onchange="window.location=\'SEindex1.php?search.value=this.options[this.selectedIndex].text;"><br>\n'; 
print '<option value="#">  Choose One   '; 
while ($row = mysql_fetch_row($result)) { 
        $id   = $row[0]; 
        $Pod_Name = $row[4]; 
        $Pollen_Name = $row[5]; 
    $x= x ; 
        $cross = "$Pod_Name $x $Pollen_Name"  ; 
        print "<option value=\"$id\""; 
        if ($_REQUEST["Pod_Name,Pollen_Name"] == $id) { print " selected"; } 

        print "> $cross <br>\n"; 
} 
print '</select>'; 
  
?>
jdimino
Forum Newbie
Posts: 6
Joined: Sat Dec 31, 2005 2:28 pm

Post by jdimino »

Thank you so much for your help
Post Reply