joecooper Posted February 27, 2006 Share Posted February 27, 2006 <?phpRequire("db.php");$username = $_POST['s_name'];$h_from = $_POST['h_from'];$h_to = $_POST['h_to'];$hop = $_POST['s_radio'];$map1 = $_POST['s_map1'];$map2 = $_POST['s_map2'];$map3 = $_POST['s_map3'];$nomap = "No Map";$honor = "> $h_from < $h_to"; //if a username wasnt entered, then search all the other crap if ($username == ''){ $sql = "SELECT * FROM AAForm WHERE Favourite_map_1 IN ('$map1', '$map2', '$map3') AND Favourite_map_2 IN ('$map1', '$map2', '$map3') AND Favourite_map_3 IN ('$map1', '$map2', '$map3') ORDER BY Honor_Level ASC"; $query=mysql_query($sql); // show the collected data // a table showing results echo "Here are the results matching your request:<br>"; echo "<table border='.1'><tr><td><b>Username</b></td><td><b>Honour Level</b></td><td><b>Map 1</b></td><td><b>Map 2</b></td><td><b>Map 3</b></td></tr>";}while ($row=mysql_fetch_array($query)){echo "<tr><td>{$row['AA_Username']}</td><td>{$row['Honor_Level']}</td><td>{$row['Favourite_Map_1']}</td><td>{$row['Favourite_Map_1']}</td><td>{$row['Favourite_Map_1]}</td></tr>";}echo "</table>";?>i cannot under stand why im getting "Parse error: parse error, unexpected $ in /home/essexrac/public_html/joe/other/search.php on line 26"line 26 is the ?>ive changed it around many many times, and checked to see if all the { and } were in right places and all the ; are on ends of lines... Link to comment https://forums.phpfreaks.com/topic/3672-parse-error-on/ Share on other sites More sharing options...
glenelkins Posted February 27, 2006 Share Posted February 27, 2006 can you show the db.php code please Link to comment https://forums.phpfreaks.com/topic/3672-parse-error-on/#findComment-12716 Share on other sites More sharing options...
joecooper Posted February 27, 2006 Author Share Posted February 27, 2006 <?phpmysql_real_escape_string($input);error_reporting(E_ERROR | E_PARSE);$db_host="--";$db_name="--";$db_user="--";$db_pass="--";$dbc=mysql_connect($db_host,$db_user,$db_pass) OR DIE (mysql_error());$dbs=mysql_select_db($db_name) OR DIE (mysql_error());?>never had a problem with this code. Link to comment https://forums.phpfreaks.com/topic/3672-parse-error-on/#findComment-12717 Share on other sites More sharing options...
glenelkins Posted February 27, 2006 Share Posted February 27, 2006 [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]if ($username == '')[/quote]Try changing this line ^ to: if ($username == "")[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]$honor = "> $h_from < $h_to";[/quote]and this line ^ to: $honor = "> " . $h_from . " < " . $h_to;let me know if it works Link to comment https://forums.phpfreaks.com/topic/3672-parse-error-on/#findComment-12720 Share on other sites More sharing options...
joecooper Posted February 27, 2006 Author Share Posted February 27, 2006 made no diffrence :(.Parse error: parse error, unexpected $ in /home/essexrac/public_html/joe/other/search.php on line 26with db.php, i have it linked to another server, but that server is a bit messed up, it dont work proply. when i load the server from my IE, it crashes it... could that be the problem?www.think-gaming.com Link to comment https://forums.phpfreaks.com/topic/3672-parse-error-on/#findComment-12721 Share on other sites More sharing options...
glenelkins Posted February 27, 2006 Share Posted February 27, 2006 i doubt it. a parse error usually happens if you misspell something, or miss something out for example: you could miss out $, ;, "" anythingTo be honest i think your coding is all messed up. there is no structure to it. you should just re-write it or i could do it for a small fee for you and get the whole thing working Link to comment https://forums.phpfreaks.com/topic/3672-parse-error-on/#findComment-12722 Share on other sites More sharing options...
joecooper Posted February 27, 2006 Author Share Posted February 27, 2006 ive kinda narrowed it down..while ($row=mysql_fetch_array($query)){echo "<tr><td>{$row['AA_Username']}</td><td>{$row['Honor_Level']}</td><td>{$row['Favourite_Map_1']}</td><td>{$row['Favourite_Map_1']}</td><td>{$row['Favourite_Map_1]}</td></tr>";}echo "</table>";doesnt like that Link to comment https://forums.phpfreaks.com/topic/3672-parse-error-on/#findComment-12723 Share on other sites More sharing options...
joecooper Posted February 27, 2006 Author Share Posted February 27, 2006 thanks for your help Link to comment https://forums.phpfreaks.com/topic/3672-parse-error-on/#findComment-12726 Share on other sites More sharing options...
kenrbnsn Posted February 27, 2006 Share Posted February 27, 2006 The problem is in this line:[code]<?phpecho "<tr><td>{$row['AA_Username']}</td><td>{$row['Honor_Level']}</td><td>{$row['Favourite_Map_1']}</td><td>{$row['Favourite_Map_1']}</td><td>{$row['Favourite_Map_1]}</td></tr>";?>[/code]You are missing a single quote at the end of the second "Favorite_map_1".I think it's much better to break up long lines like this into many shorter lines in PHP. It's much easier to debug and paste into this forum.[code]<?php$tmp = "<tr><td>{$row['AA_Username']}</td>";$tmp .= "<td>{$row['Honor_Level']}</td>";$tmp .= "<td>{$row['Favourite_Map_1']}</td>";$tmp .= "<td>{$row['Favourite_Map_1']}</td>";$tmp . = "<td>{$row['Favourite_Map_1']}</td></tr>"; // added missing single quoteecho $tmp;?>[/code]Ken Link to comment https://forums.phpfreaks.com/topic/3672-parse-error-on/#findComment-12728 Share on other sites More sharing options...
joecooper Posted February 27, 2006 Author Share Posted February 27, 2006 Ohhhh thanks!! Link to comment https://forums.phpfreaks.com/topic/3672-parse-error-on/#findComment-12731 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.