Hi all,
I'm getting the "unexpected T_STRING" parse error in the following code at line 12:
<?PHP
include 'connection.php';
$norm = $_POST['norm'];
$rare = $_POST['rare'];
$fine = $_POST['fine'];
$q = '"';
echo'Results:<br>';
echo'<table border="1">';
echo'<tr><th>Name</th><th>Level</th><th>Location</th><th>Material searched for</th></tr>';
if( $norm !== "Select")
{
$sql = "SELECT mob_name, mob_level, mob_location, FROM gather_mob WHERE gather_mob.drop_id1 = (SELECT drop_id from gather_material WHERE gather_material.drop_name1 = ".$q.$norm.$q.");";
$nresult = mysql_query($sql, $con);
if(!$nresult)
{
die("Search Fialed!".mysql_error());
}
while ($row = mysql_fetch_assoc($nresult))
{
echo'<tr><td>'.$row['mob_name'].'</td><td>'.$row['mob_level'].'</td><td>'.$row['mob_location'].'</td><td>'.$norm.'</td></tr>';
}
}
if( $rare !== "Select")
{
$sql = "SELECT mob_name, mob_level, mob_location, FROM gather_mob WHERE gather_mob.drop_id2 = (SELECT drop_id from gather_material WHERE gather_material.drop_name2 = ".$q.$rare.$q.");";
$rresult = mysql_query($sql, $con);
if(!$rresult)
{
die("Search Fialed!".mysql_error());
}
while ($row = mysql_fetch_assoc($rresult))
{
echo'<tr><td>'.$row['mob_name'].'</td><td>'.$row['mob_level'].'</td><td>'.$row['mob_location'].'</td><td>'.$rare.'</td></tr>';
}
}
if( $fine !== "Select")
{
$sql = "SELECT mob_name, mob_level, mob_location, FROM gather_mob WHERE gather_mob.drop_id3 = (SELECT drop_id from gather_material WHERE gather_material.drop_name3 = ".$q.$fine.$q.");";
$fresult = mysql_query($sql, $con);
if(!$fresult)
{
die("Search Fialed!".mysql_error());
}
while ($row = mysql_fetch_assoc($fresult))
{
echo'<tr><td>'.$row['mob_name'].'</td><td>'.$row['mob_level'].'</td><td>'.$row['mob_location'].'</td><td>'.$fine.'</td></tr>';
}
}
echo'</table></br>';
echo'<a href"http://guildlr.com/maretialSrc.php">Return</a>';
?>
As you can see, I'm only just getting into PHP and it's all a bit convoluted.
I have been working on the assumption that it's somthing to do with the syntax of the $sql= statement, the use of the $q is an old habbit I picked up in my pascal days, I have tried it with absolout quotes aswell and it's still the same. Have also tried switching from double quotes to single and back again, nothing's making a difference.
All help gratefully recieved
I can't see where the string error is myself