todayme Posted March 5, 2007 Share Posted March 5, 2007 I have this error below, anyone got any ideas, I am sure it is a simple syntax error. Parse error: syntax error, unexpected T_LOGICAL_OR in /home/admin/domains/sold.au.com/public_html/getlocation.php on line 16 <? //set the variables as required $dbhost = "localhost"; $dbuser = "admin_sex"; $dbpass = "sex"; $dbname = "admin_sex"; $db = mysql_pconnect($dbhost,$dbuser,$dbpass); mysql_select_db($dbname) or die(mysql_error()); $data = mysql_query("SELECT * FROM _Industries WHERE Industry = '$dbIndustry'"); or die(mysql_error()); $info = mysql_fetch_array( $data ); $locationtype = $info['Location_Type']; ?> <select name="Location" ><?php $query=mysql_query("("SELECT '$dbState' FROM '$locationtype'"); while ($fetch=mysql_fetch_assoc($query)) { echo '<option value="'.$fetch['$dbState'].'">'.$fetch['$dbState'].'</option>'; } mysql_close($db);?></select> Quote Link to comment Share on other sites More sharing options...
r-it Posted March 5, 2007 Share Posted March 5, 2007 the extra brackets in your query, the 2nd query Quote Link to comment Share on other sites More sharing options...
monk.e.boy Posted March 5, 2007 Share Posted March 5, 2007 $query=mysql_query("("SELECT '$dbState' FROM '$locationtype'"); This line looks like it has a syntax error $query=mysql_query("SELECT '$dbState' FROM '$locationtype'"); monk.e.boy Quote Link to comment Share on other sites More sharing options...
todayme Posted March 5, 2007 Author Share Posted March 5, 2007 I found that one, and removed it but it still has the same error. Anyone else got a idea! Have I passed those variables into the second query correctly? Quote Link to comment Share on other sites More sharing options...
redarrow Posted March 5, 2007 Share Posted March 5, 2007 <?php //set the variables as required $dbhost = "localhost"; $dbuser = "admin_sex"; $dbpass = "sex"; $dbname = "admin_sex"; $db = mysql_pconnect($dbhost,$dbuser,$dbpass); mysql_select_db($dbname) or die(mysql_error()); $data ="SELECT * FROM _Industries WHERE Industry = '$dbIndustry' "; $result1=mysql_query($data)or die("mysql_error()"); $info = mysql_fetch_array( $result1); $locationtype = $info['Location_Type']; ?> <select name="Location" > <?php $query="SELECT '$dbState' FROM '$locationtype'"; $result2=mysql_query($query) or dir("mysql_error()"); while ($fetch=mysql_fetch_assoc($result2)) { echo '<option value="'.$fetch['$dbState'].'">'.$fetch['$dbState'].'</option>'; } mysql_close($db);?></select> Quote Link to comment Share on other sites More sharing options...
todayme Posted March 5, 2007 Author Share Posted March 5, 2007 Geting closer now I have this error after trying your code. I am looking looking looking ha ha. Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/admin/domains/sold.au.com/public_html/getlocation.php on line 19 Quote Link to comment Share on other sites More sharing options...
monk.e.boy Posted March 5, 2007 Share Posted March 5, 2007 $result2=mysql_query($query) or dir("mysql_error()"); or die? monk.e.boy Quote Link to comment Share on other sites More sharing options...
redarrow Posted March 5, 2007 Share Posted March 5, 2007 what? sorry corrected. <?php //set the variables as required $dbhost = "localhost"; $dbuser = "admin_sex"; $dbpass = "sex"; $dbname = "admin_sex"; $db = mysql_pconnect($dbhost,$dbuser,$dbpass); mysql_select_db($dbname) or die(mysql_error()); $data ="SELECT * FROM _Industries WHERE Industry = '$dbIndustry' "; $result1=mysql_query($data)or die("mysql_error()"); $info = mysql_fetch_array( $result1); $locationtype = $info['Location_Type']; ?> <select name="Location" > <?php $query="SELECT '$dbState' FROM '$locationtype'"; $result2=mysql_query($query) or die("mysql_error()"); while ($fetch=mysql_fetch_assoc($result2)) { echo '<option value="'.$fetch['$dbState'].'">'.$fetch['$dbState'].'</option>'; } mysql_close($db);?></select> Quote Link to comment Share on other sites More sharing options...
todayme Posted March 5, 2007 Author Share Posted March 5, 2007 No errors coming up but the code doesnt work !............Thanks heaps for trying I am grrrrrrrrrr frustrated and going for a smoke............ Be back in 5 minutes, anyone else got an idea? Quote Link to comment Share on other sites More sharing options...
todayme Posted March 5, 2007 Author Share Posted March 5, 2007 Havent gone for smoke yet just tried the second last lot of code again and it executed with no errors but no data in the drop down box.............I am going to look at this further after I have a smoke ha ha Quote Link to comment Share on other sites More sharing options...
redarrow Posted March 5, 2007 Share Posted March 5, 2007 $query="SELECT '$dbState' << this is wrong ok? FROM '$locationtype'"; Quote Link to comment Share on other sites More sharing options...
todayme Posted March 5, 2007 Author Share Posted March 5, 2007 Why is it wrong cant i pass a variable there instead of its value statically ? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted March 5, 2007 Share Posted March 5, 2007 Please post your current code between tags. Ken Quote Link to comment Share on other sites More sharing options...
todayme Posted March 5, 2007 Author Share Posted March 5, 2007 Here is the correct code incase anyone wants it. <?php //set the variables as required $dbhost = "localhost"; $dbuser = "admin_sex"; $dbpass = "sex"; $dbname = "admin_sex"; $db = mysql_pconnect($dbhost,$dbuser,$dbpass); mysql_select_db($dbname) or die(mysql_error()); $data ="SELECT * FROM _Industries WHERE Industry = '$dbIndustry' "; $result1=mysql_query($data)or die("mysql_error()"); $info = mysql_fetch_array( $result1); $locationtype = $info['Location_Type']; ?> <select name="Location" > <?php $query=mysql_query("SELECT $dbState FROM $locationtype"); while ($fetch=mysql_fetch_assoc($query)) { echo '<option value="'.$fetch[$dbState].'">'.$fetch[$dbState].'</option>'; } mysql_close($db);?></select> [code/] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.