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> Link to comment https://forums.phpfreaks.com/topic/41246-t_logical_or-parse-error-help-is-appreciated/ 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 Link to comment https://forums.phpfreaks.com/topic/41246-t_logical_or-parse-error-help-is-appreciated/#findComment-199807 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 Link to comment https://forums.phpfreaks.com/topic/41246-t_logical_or-parse-error-help-is-appreciated/#findComment-199809 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? Link to comment https://forums.phpfreaks.com/topic/41246-t_logical_or-parse-error-help-is-appreciated/#findComment-199811 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> Link to comment https://forums.phpfreaks.com/topic/41246-t_logical_or-parse-error-help-is-appreciated/#findComment-199815 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 Link to comment https://forums.phpfreaks.com/topic/41246-t_logical_or-parse-error-help-is-appreciated/#findComment-199817 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 Link to comment https://forums.phpfreaks.com/topic/41246-t_logical_or-parse-error-help-is-appreciated/#findComment-199818 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> Link to comment https://forums.phpfreaks.com/topic/41246-t_logical_or-parse-error-help-is-appreciated/#findComment-199819 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? Link to comment https://forums.phpfreaks.com/topic/41246-t_logical_or-parse-error-help-is-appreciated/#findComment-199822 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 Link to comment https://forums.phpfreaks.com/topic/41246-t_logical_or-parse-error-help-is-appreciated/#findComment-199825 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'"; Link to comment https://forums.phpfreaks.com/topic/41246-t_logical_or-parse-error-help-is-appreciated/#findComment-199834 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 ? Link to comment https://forums.phpfreaks.com/topic/41246-t_logical_or-parse-error-help-is-appreciated/#findComment-199847 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 Link to comment https://forums.phpfreaks.com/topic/41246-t_logical_or-parse-error-help-is-appreciated/#findComment-199866 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/] Link to comment https://forums.phpfreaks.com/topic/41246-t_logical_or-parse-error-help-is-appreciated/#findComment-199915 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.