arunkr Posted December 1, 2010 Share Posted December 1, 2010 Help me plaese - i am getting error in the line $query = "SELECT * \r\n FROM `ad` "; Quote Link to comment https://forums.phpfreaks.com/topic/220317-parse-error-syntax-error-unexpected-expecting-t_variable-or-in/ Share on other sites More sharing options...
JakeTheSnake3.0 Posted December 1, 2010 Share Posted December 1, 2010 Please show the lines of code preceding that statement. It's just a syntax error somewhere in your code where you missed a semicolon or whatever. Quote Link to comment https://forums.phpfreaks.com/topic/220317-parse-error-syntax-error-unexpected-expecting-t_variable-or-in/#findComment-1141669 Share on other sites More sharing options...
arunkr Posted December 1, 2010 Author Share Posted December 1, 2010 { $select = "selected='selected'"; } echo "<option value='0'>AM</option>"; echo "<option value='12' ".$select.">PM</option>"; echo " </select></td>\r\n </tr>\r\n \r\n <tr>\r\n <td align=\"right\">Total Views Allowed:</td>\r\n <td><input type=\"text\" id=\"ad_total_views\" style=\"width:50px;\" value=\"\" disabled=\"disabled\" /> <label><input type=\"checkbox\" checked=\"checked\" onclick=\"if(this.checked==true){$('#ad_total_views').val('');$('#ad_total_views').attr('disabled','disabled');}else{$('#ad_total_views').val('');$('#ad_total_views').removeAttr('disabled');$('#ad_total_views').focus()}\" />Unlimited</label></td>\r\n </tr>\r\n \r\n <tr>\r\n <td align=\"right\">Total Clicks Allowed:</td>\r\n <td><input type=\"text\" id=\"ad_total_clicks\" style=\"width:50px;\" value=\"\" disabled=\"disabled\" /> <label><input type=\"checkbox\" checked=\"checked\" onclick=\"if(this.checked==true){$('#ad_total_clicks').val('');$('#ad_total_clicks').attr('disabled','disabled');}else{$('#ad_total_clicks').val('');$('#ad_total_clicks').removeAttr('disabled');$('#ad_total_clicks').focus()}\" />Unlimited</label></td>\r\n </tr>\r\n </table></td>\r\n </tr>\r\n <tr bgcolor=\"#FFFFFF\">\r\n <td class=\"td_th\" align=\"center\">Smarty Code (Developer)</td>\r\n <td>{\$ads->getAdCode(<span id=\"smartycode\">1</span>)}</td>\r\n </tr>\r\n <tr bgcolor=\"#FFFFFF\">\r\n <td class=\"td_th\" align=\"center\"> </td>\r\n <td><input type=\"button\" value=\"Create New Campaign\" onclick=\"new_ad()\" /></td>\r\n </tr>\r\n </TBODY></TABLE>\r\n<br />\r\n\r\n<TABLE cellSpacing=1 cellPadding=4 width=\"100%\" border=0>\r\n <TBODY>\r\n <TR class=\"td_title\">\r\n <TD colSpan=7>Ad Campaigns</TD></TR>\r\n <TR bgColor=#ffffff>\r\n \r\n <TD width=\"10%\" align=\"center\" class=\"td_th\"> </TD>\r\n <TD width=\"4%\" align=\"center\" class=\"td_th\">ID</TD>\r\n <TD width=\"29%\" align=\"center\" class=\"td_th\">Campaign Name</TD>\r\n <TD width=\"12%\" align=\"center\" class=\"td_th\">Start Date</TD>\r\n <TD width=\"11%\" align=\"center\" class=\"td_th\">End Date</TD>\r\n <TD width=\"17%\" align=\"center\" class=\"td_th\">Viewed / Views Allowed</TD>\r\n <TD width=\"17%\" align=\"center\" class=\"td_th\">Clicked / Clicks Allowed</TD>\r\n </TR>\r\n "; $query = "SELECT * \r\n FROM `ad` "; Quote Link to comment https://forums.phpfreaks.com/topic/220317-parse-error-syntax-error-unexpected-expecting-t_variable-or-in/#findComment-1141689 Share on other sites More sharing options...
Pikachu2000 Posted December 1, 2010 Share Posted December 1, 2010 wellgeezidontknowtheproblemcouldbeanywhereinthatcodereallybutwithitalljammedtogetherlikethatitskindofhardtomakeheadsortailsofitCanyoupleaseformatitsoitsactuallyreadablebyhumanspleasektxhbai Quote Link to comment https://forums.phpfreaks.com/topic/220317-parse-error-syntax-error-unexpected-expecting-t_variable-or-in/#findComment-1141804 Share on other sites More sharing options...
litebearer Posted December 1, 2010 Share Posted December 1, 2010 Pika, I thought you read Vulcan Quote Link to comment https://forums.phpfreaks.com/topic/220317-parse-error-syntax-error-unexpected-expecting-t_variable-or-in/#findComment-1141805 Share on other sites More sharing options...
PFMaBiSmAd Posted December 1, 2010 Share Posted December 1, 2010 Actually, the error message occurs in the line that starts echo " </select></td>\r\n ..., not in the $query = "SELECT * \r\n FROM `ad` "; line. You must have miss counted. Oh, and no one is really going to help you troubleshoot that mess the way it is written, there's no reason for any code to be written that way. Where did you get that code? Quote Link to comment https://forums.phpfreaks.com/topic/220317-parse-error-syntax-error-unexpected-expecting-t_variable-or-in/#findComment-1141815 Share on other sites More sharing options...
PFMaBiSmAd Posted December 1, 2010 Share Posted December 1, 2010 I can give you a hint. Because someone removed most of the white space from that HTML/Javascript, the parts of it that look like {$...} are being parsed by php as a php variable within a string. However, the leading {'s are actually part of some Javascript if(){}else{} statements and are not part of php's {$...} syntax. Format that HTML/Javscript with some white-space/new-lines so that the Javascript does not look like php syntax and the php parser errors will be fixed. Quote Link to comment https://forums.phpfreaks.com/topic/220317-parse-error-syntax-error-unexpected-expecting-t_variable-or-in/#findComment-1141834 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.