$sql="SELECT * FROM countries"; $result=mysql_query($sql); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $ccode = $row["ccode"]; echo '<h1>'.$row["country"].'</h1>'; sql2="SELECT * FROM `numbers` WHERE `location` = '".$ccode."'"; $result2=mysql_query($sql2); while ($row2 = mysql_fetch_array($result2, MYSQL_ASSOC)) { echo '<table><tr>'; echo '<td><p>'.$row["name"].'</p></td><td><a href="http://'.$row2["url"].'">'.$row2["url"].'</a></td>'; echo '</tr></table>'; } } PHP: getting an error for the line sql2="SELECT * FROM `numbers` WHERE `location` = '".$ccode."'"; PHP: any suggestions. the error says Parse error: parse error in C:\wamp\www\prototype1\index.php on line 42 I basically trying to make a script which will group url's depending on the country origin which is inputted by user. I have tried the string without the ` around the field names of the table. any other suggestions.