LDMartin1959 Posted December 2, 2013 Share Posted December 2, 2013 I am trying to add some logic to an existing page (WordPress template) and I am not an experienced PHP person. The logic I am trying to introduce is this: If the current date is after a specific date (pulled from the database) then display a message, otherwise display a table with a form which can be completed and submitted. I can add most of the logic (if/else) code without any errors, but as soon as I add the last else{}, enclosing the table between the else statements opening "{" and closing "}" I get error messages. And frankly, they are not making sense to me: DreamWeaver (which I am using simply because it makes working with the tables a bit easier for me than a straight-forward code editor) says the change I make of enclosing the table in else{} is creating a syntax error on line 1 even though the changes I am making are on about line 55; the PHP error log says line 26 which is a self-contained PHP tag set. I have checked and I have no unclosed PHP tags -- quite literally simply adding the {} surrounding the table seems to cause the error. What am I missing here? Thank you in advance for your help. The code in question (including the PHP involved is as follows: else { ?> <table width="100%" border="0" cellspacing="1" cellpadding="5"> <tr> <td width="83%"><div class="events_body_text"> <?php the_content('Read the rest of this entry »'); ?> <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?> <?php endwhile; endif; ?> </div> <hr> <br /> <form method="post" enctype="multipart/form-data" target="_self" id="form1" action="<?php bloginfo('siteurl'); ?>/do_event.php"> <input name="event" value="<?=$row->city?>, <?=$row->state?>" type="hidden"> <input name="eventdate" value="<?=$row->evtdate?>" type="hidden"> <input name="eventid" value="<?=$_GET['id']?>" type="hidden"> <input name="nav_title" value="<?=$row->navigationtitle?>" type="hidden"> <table id="eventRegistration" class="basic" style="width: 100%; margin: 0pt auto;"> <tbody> <tr> <td width="10%"></td> <td align="center" valign="top" width="35%"><table class="basic"> <tbody> <tr> <td class="formLabel"><label for="role" style="font-weight: bold;"> <span style="font-weight: bold; color: #cc3300;"> *</span> Registration Type : </label></td> <td align="left" valign="middle" class="formField"> <select name="registration_type" class="medium" id="registration_type"> <option selected="selected" value="">Please select one...</option> <option value="Sponsor" >Sponsor</option> <option value="Attendee">Guest</option> </select></td> </tr> <tr> <td class="formLabel"><label for="fname" style="font-weight: bold;"> <span style="font-weight: bold; color: #cc3300;"> * </span> First Name: </label></td> <td class="formField"><input class="medium" id="fname" name="fname" type="text"></td> </tr> <tr> <td class="formLabel"><label for="lname" style="font-weight: bold;"> <span style="font-weight: bold; color: #cc3300;"> * </span> Last Name: </label></td> <td class="formField"><input class="medium" id="lname" name="lname" type="text"></td> </tr> <tr> <td class="formLabel"><label for="company" style="font-weight: bold;"> <span style="font-weight: bold; color: #cc3300;"> * </span> Company: </label></td> <td class="formField"><input class="medium" id="company" name="company" type="text"></td> </tr> <tr> <td class="formLabel"><label for="email" style="font-weight: bold;"> <span style="font-weight: bold; color: #cc3300;"> * </span> Email: </label></td> <td class="formField"><input class="medium" id="email" name="email" type="text"></td> </tr> <tr> <td class="formLabel"><label for="email2" style="font-weight: bold;"> <span style="font-weight: bold; color: #cc3300;"> * </span> Verify Email: </label></td> <td class="formField"><input class="medium" id="email2" name="email2" type="text"></td> </tr> <tr> <td class="formLabel"><label for="title" style="font-weight: bold;"> <span style="font-weight: bold; color: #cc3300;"> * </span> Professional Title: </label></td> <td class="formField"><input class="medium" id="title" name="title" type="text"></td> </tr> <tr> <td class="formLabel"><label for="address" style="font-weight: bold;"> <span style="font-weight: bold; color: #cc3300;"> * </span> Mailing Address: </label></td> <td class="formField"><input class="medium" id="address" name="address" type="text"></td> </tr> <tr> <td class="formLabel"><label for="address2" style="font-weight: bold;"> Mailing Address 2: </label></td> <td class="formField"><input class="medium" id="address2" name="address2" type="text"></td> </tr> <tr> <td class="formLabel"><label for="city" style="font-weight: bold;"> <span style="font-weight: bold; color: #cc3300;"> * </span> City: </label></td> <td class="formField"><input class="medium" id="city" name="city" type="text"></td> </tr> <tr> <td class="formLabel"><label for="state" style="font-weight: bold;"> <span style="font-weight: bold; color: #cc3300;"> * </span> State/Province: </label></td> <td class="formField"><select name="state" size="true" class="medium" id="state"> <option selected="selected" value="Other">Other</option> <!-- - Other --> <option value="Alabama">Alabama</option> <!-- - Alabama --> <option value="Alaska">Alaska</option> <!-- - Alaska --> <option value="Arizona">Arizona</option> <!-- - Arizona --> <option value="Arkansas">Arkansas</option> <!-- - Arkansas --> <option value="California">California</option> <!-- - California --> <option value="Colorado">Colorado</option> <!-- - Colorado --> <option value="Connecticut">Connecticut</option> <!-- - Connecticut --> <option value="Delaware">Delaware</option> <!-- - Delaware --> <option value="Florida">Florida</option> <!-- - Florida --> <option value="Georgia">Georgia</option> <!-- - Georgia --> <option value="Hawaii">Hawaii</option> <!-- - Hawaii --> <option value="Idaho">Idaho</option> <!-- - Idaho --> <option value="Illinois">Illinois</option> <!-- - Illinois --> <option value="Indiana">Indiana</option> <!-- - Indiana --> <option value="Iowa">Iowa</option> <!-- - Iowa --> <option value="Kansas">Kansas</option> <!-- - Kansas --> <option value="Kentucky">Kentucky</option> <!-- - Kentucky --> <option value="Louisiana">Louisiana</option> <!-- - Louisiana --> <option value="Maine">Maine</option> <!-- - Maine --> <option value="Maryland">Maryland</option> <!-- - Maryland --> <option value="Massachusetts">Massachusetts</option> <!-- - Massachusetts --> <option value="Michigan">Michigan</option> <!-- - Michigan --> <option value="Minnesota">Minnesota</option> <!-- - Minnesota --> <option value="Mississippi">Mississippi</option> <!-- - Mississippi --> <option value="Missouri">Missouri</option> <!-- - Missouri --> <option value="Montana">Montana</option> <!-- - Montana --> <option value="Nebraska">Nebraska</option> <!-- - Nebraska --> <option value="Nevada">Nevada</option> <!-- - Nevada --> <option value="New Hampshire">New Hampshire</option> <!-- - New Hampshire --> <option value="New Jersey">New Jersey</option> <!-- - New Jersey --> <option value="New Mexico">New Mexico</option> <!-- - New Mexico --> <option value="New York">New York</option> <!-- - New York --> <option value="North Carolina">North Carolina</option> <!-- - North Carolina --> <option value="North Dakota">North Dakota</option> <!-- - North Dakota --> <option value="Ohio">Ohio</option> <!-- - Ohio --> <option value="Oklahoma">Oklahoma</option> <!-- - Oklahoma --> <option value="Oregon">Oregon</option> <!-- - Oregon --> <option value="Pennsylvania">Pennsylvania</option> <!-- - Pennsylvania --> <option value="Puerto Rico">Puerto Rico</option> <!-- - Puerto Rico --> <option value="Rhode Island">Rhode Island</option> <!-- - Rhode Island --> <option value="South Carolina">South Carolina</option> <!-- - South Carolina --> <option value="South Dakota">South Dakota</option> <!-- - South Dakota --> <option value="Tennessee">Tennessee</option> <!-- - Tennessee --> <option value="Texas">Texas</option> <!-- - Texas --> <option value="Utah">Utah</option> <!-- - Utah --> <option value="Vermont">Vermont</option> <!-- - Vermont --> <option value="Virginia">Virginia</option> <!-- - Virginia --> <option value="Washington">Washington</option> <!-- - Washington --> <option value="Washington DC">Washington DC</option> <!-- - Washington DC --> <option value="West Virginia">West Virginia</option> <!-- - West Virginia --> <option value="Wisconsin">Wisconsin</option> <!-- - Wisconsin --> <option value="Wyoming">Wyoming</option> <!-- - Wyoming --> <optgroup label=" "></optgroup> <optgroup label="Canada" style=" font-style:normal;"></optgroup> <option value="Alberta">Alberta</option> <!-- - Alberta --> <option value="British Columbia">British Columbia</option> <!-- - British Columbia --> <option value="Manitoba">Manitoba</option> <!-- - Manitoba --> <option value="New Brunswick">New Brunswick</option> <!-- - New Brunswick --> <option value="Newfoundland">Newfoundland</option> <!-- - Newfoundland --> <option value="Northwest Territories">Northwest Territories</option> <!-- - Northwest Territories --> <option value="Nova Scotia">Nova Scotia</option> <!-- - Nova Scotia --> <option value="Nunavut">Nunavut</option> <!-- - Nunavut --> <option value="Ontario">Ontario</option> <!-- - Ontario --> <option value="Prince Edward Island">Prince Edward Island</option> <!-- - Prince Edward Island --> <option value="Quebec">Quebec</option> <!-- - Quebec --> <option value="Saskatchewan">Saskatchewan</option> <!-- - Saskatchewan --> <option value="Yukon Territory">Yukon Territory</option> <!-- - Yukon Territory --> </select></td> </tr> <tr> <td class="formLabel"><label for="zip" style="font-weight: bold;"> <span style="font-weight: bold; color: #cc3300;"> * </span> Zip: </label></td> <td align="left" valign="middle" class="formField"><input class="medium" id="zip" name="zip" type="text"></td> </tr> <tr> <td width="146" valign="middle" class="formLabel"><label for="country" style="font-weight: bold;"> <span style="font-weight: bold; color: #cc3300;"> * </span> Country: </label></td> <td width="342" align="left" valign="middle" class="formField"><select name="country" size="true" class="medium" id="country"> <option selected="selected" value="United States">United States</option> <option value="Afghanistan">Afghanistan</option> <option value="Albania">Albania</option> <option value="Algeria">Algeria</option> <option value="American Samoa">American Samoa</option> <option value="Andorra">Andorra</option> <option value="Angola">Angola</option> <option value="Anguilla">Anguilla</option> <option value="Antarctica">Antarctica</option> <option value="Antigua And Barbuda">Antigua And Barbuda</option> <option value="Argentina">Argentina</option> <option value="Armenia">Armenia</option> <option value="Aruba">Aruba</option> <option value="Australia">Australia</option> <option value="Austria">Austria</option> <option value="Azerbaijan">Azerbaijan</option> <option value="Bahamas">Bahamas</option> <option value="Bahrain">Bahrain</option> <option value="Bangladesh">Bangladesh</option> <option value="Barbados">Barbados</option> <option value="Belarus">Belarus</option> <option value="Belgium">Belgium</option> <option value="Belize">Belize</option> <option value="Benin">Benin</option> <option value="Bermuda">Bermuda</option> <option value="Bhutan">Bhutan</option> <option value="Bolivia">Bolivia</option> <option value="Bosnia And Herzegovina">Bosnia And Herzegovina</option> <option value="Botswana">Botswana</option> <option value="Bouvet Island">Bouvet Island</option> <option value="Brazil">Brazil</option> <option value="British Indian Ocean Territory">British Indian Ocean Territory</option> <option value="Brunei Darussalam">Brunei Darussalam</option> <option value="Bulgaria">Bulgaria</option> <option value="Burkina Faso">Burkina Faso</option> <option value="Burundi">Burundi</option> <option value="Cambodia">Cambodia</option> <option value="Cameroon">Cameroon</option> <option value="Canada">Canada</option> <option value="Cape Verde">Cape Verde</option> <option value="Cayman Islands">Cayman Islands</option> <option value="Central African Republic">Central African Republic</option> <option value="Chad">Chad</option> <option value="Chile">Chile</option> <option value="China">China</option> <option value="Christmas Island">Christmas Island</option> <option value="Cocos (keeling) Islands">Cocos (keeling) Islands</option> <option value="Colombia">Colombia</option> <option value="Comoros">Comoros</option> <option value="Congo">Congo</option> <option value="Congo - The Democratic Republic Of The">Congo - The Democratic Republic Of The</option> <option value="Cook Islands">Cook Islands</option> <option value="Costa Rica">Costa Rica</option> <option value="Cote D'ivoire">Cote D'ivoire</option> <option value="Croatia">Croatia</option> <option value="Cuba">Cuba</option> <option value="Cyprus">Cyprus</option> <option value="Czech Republic">Czech Republic</option> <option value="Denmark">Denmark</option> <option value="Djibouti">Djibouti</option> <option value="Dominica">Dominica</option> <option value="Dominican Republic">Dominican Republic</option> <option value="East Timor">East Timor</option> <option value="Ecuador">Ecuador</option> <option value="Egypt">Egypt</option> <option value="El Salvador">El Salvador</option> <option value="Equatorial Guinea">Equatorial Guinea</option> <option value="Eritrea">Eritrea</option> <option value="Estonia">Estonia</option> <option value="Ethiopia">Ethiopia</option> <option value="Falkland Islands (malvinas)">Falkland Islands (malvinas)</option> <option value="Faroe Islands">Faroe Islands</option> <option value="Fiji">Fiji</option> <option value="Finland">Finland</option> <option value="France">France</option> <option value="French Guiana">French Guiana</option> <option value="French Polynesia">French Polynesia</option> <option value="French Southern Territories">French Southern Territories</option> <option value="Gabon">Gabon</option> <option value="Gambia">Gambia</option> <option value="Georgia">Georgia</option> <option value="Germany">Germany</option> <option value="Ghana">Ghana</option> <option value="Gibraltar">Gibraltar</option> <option value="Greece">Greece</option> <option value="Greenland">Greenland</option> <option value="Grenada">Grenada</option> <option value="Guadeloupe">Guadeloupe</option> <option value="Guam">Guam</option> <option value="Guatemala">Guatemala</option> <option value="Guinea">Guinea</option> <option value="Guinea-bissau">Guinea-bissau</option> <option value="Guyana">Guyana</option> <option value="Haiti">Haiti</option> <option value="Heard Island And Mcdonald Islands">Heard Island And Mcdonald Islands</option> <option value="Holy See (vatican City State)">Holy See (vatican City State)</option> <option value="Honduras">Honduras</option> <option value="Hong Kong">Hong Kong</option> <option value="Hungary">Hungary</option> <option value="Iceland">Iceland</option> <option value="India">India</option> <option value="Indonesia">Indonesia</option> <option value="Iran - Islamic Republic Of">Iran - Islamic Republic Of</option> <option value="Iraq">Iraq</option> <option value="Ireland">Ireland</option> <option value="Israel">Israel</option> <option value="Italy">Italy</option> <option value="Jamaica">Jamaica</option> <option value="Japan">Japan</option> <option value="Jordan">Jordan</option> <option value="Kazakstan">Kazakstan</option> <option value="Kenya">Kenya</option> <option value="Kiribati">Kiribati</option> <option value="Korea - Democratic People's Republic Of">Korea - Democratic People's Republic Of</option> <option value="Korea - Republic Of">Korea - Republic Of</option> <option value="Kosovo">Kosovo</option> <option value="Kuwait">Kuwait</option> <option value="Kyrgyzstan">Kyrgyzstan</option> <option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option> <option value="Latvia">Latvia</option> <option value="Lebanon">Lebanon</option> <option value="Lesotho">Lesotho</option> <option value="Liberia">Liberia</option> <option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option> <option value="Liechtenstein">Liechtenstein</option> <option value="Lithuania">Lithuania</option> <option value="Luxembourg">Luxembourg</option> <option value="Macau">Macau</option> <option value="Macedonia - The Former Yugoslav Republic Of">Macedonia - The Former Yugoslav Republic Of</option> <option value="Madagascar">Madagascar</option> <option value="Malawi">Malawi</option> <option value="Malaysia">Malaysia</option> <option value="Maldives">Maldives</option> <option value="Mali">Mali</option> <option value="Malta">Malta</option> <option value="Marshall Islands">Marshall Islands</option> <option value="Martinique">Martinique</option> <option value="Mauritania">Mauritania</option> <option value="Mauritius">Mauritius</option> <option value="Mayotte">Mayotte</option> <option value="Mexico">Mexico</option> <option value="Micronesia - Federated States Of">Micronesia - Federated States Of</option> <option value="Moldova - Republic Of">Moldova - Republic Of</option> <option value="Monaco">Monaco</option> <option value="Mongolia">Mongolia</option> <option value="Montserrat">Montserrat</option> <option value="Montenegro">Montenegro</option> <option value="Morocco">Morocco</option> <option value="Mozambique">Mozambique</option> <option value="Myanmar">Myanmar</option> <option value="Namibia">Namibia</option> <option value="Nauru">Nauru</option> <option value="Nepal">Nepal</option> <option value="Netherlands">Netherlands</option> <option value="Netherlands Antilles">Netherlands Antilles</option> <option value="New Caledonia">New Caledonia</option> <option value="New Zealand">New Zealand</option> <option value="Nicaragua">Nicaragua</option> <option value="Niger">Niger</option> <option value="Nigeria">Nigeria</option> <option value="Niue">Niue</option> <option value="Norfolk Island">Norfolk Island</option> <option value="Northern Mariana Islands">Northern Mariana Islands</option> <option value="Norway">Norway</option> <option value="Oman">Oman</option> <option value="Pakistan">Pakistan</option> <option value="Palau">Palau</option> <option value="Palestinian Territory - Occupied">Palestinian Territory - Occupied</option> <option value="Panama">Panama</option> <option value="Papua New Guinea">Papua New Guinea</option> <option value="Paraguay">Paraguay</option> <option value="Peru">Peru</option> <option value="Philippines">Philippines</option> <option value="Pitcairn">Pitcairn</option> <option value="Poland">Poland</option> <option value="Portugal">Portugal</option> <option value="Puerto Rico">Puerto Rico</option> <option value="Qatar">Qatar</option> <option value="Reunion">Reunion</option> <option value="Romania">Romania</option> <option value="Russian Federation">Russian Federation</option> <option value="Rwanda">Rwanda</option> <option value="Saint Helena">Saint Helena</option> <option value="Saint Kitts And Nevis">Saint Kitts And Nevis</option> <option value="Saint Lucia">Saint Lucia</option> <option value="Saint Pierre And Miquelon">Saint Pierre And Miquelon</option> <option value="Saint Vincent And The Grenadines">Saint Vincent And The Grenadines</option> <option value="Samoa">Samoa</option> <option value="San Marino">San Marino</option> <option value="Sao Tome And Principe">Sao Tome And Principe</option> <option value="Saudi Arabia">Saudi Arabia</option> <option value="Senegal">Senegal</option> <option value="Serbia">Serbia</option> <option value="Seychelles">Seychelles</option> <option value="Sierra Leone">Sierra Leone</option> <option value="Singapore">Singapore</option> <option value="Slovakia">Slovakia</option> <option value="Slovenia">Slovenia</option> <option value="Solomon Islands">Solomon Islands</option> <option value="Somalia">Somalia</option> <option value="South Africa">South Africa</option> <option value="South Georgia And The South Sandwich Islands">South Georgia And The South Sandwich Islands</option> <option value="Spain">Spain</option> <option value="Sri Lanka">Sri Lanka</option> <option value="Sudan">Sudan</option> <option value="Suriname">Suriname</option> <option value="Svalbard And Jan Mayen">Svalbard And Jan Mayen</option> <option value="Swaziland">Swaziland</option> <option value="Sweden">Sweden</option> <option value="Switzerland">Switzerland</option> <option value="Syrian Arab Republic">Syrian Arab Republic</option> <option value="Taiwan - Province Of China">Taiwan - Province Of China</option> <option value="Tajikistan">Tajikistan</option> <option value="Tanzania - United Republic Of">Tanzania - United Republic Of</option> <option value="Thailand">Thailand</option> <option value="Togo">Togo</option> <option value="Tokelau">Tokelau</option> <option value="Tonga">Tonga</option> <option value="Trinidad And Tobago">Trinidad And Tobago</option> <option value="Tunisia">Tunisia</option> <option value="Turkey">Turkey</option> <option value="Turkmenistan">Turkmenistan</option> <option value="Turks And Caicos Islands">Turks And Caicos Islands</option> <option value="Tuvalu">Tuvalu</option> <option value="Uganda">Uganda</option> <option value="Ukraine">Ukraine</option> <option value="United Arab Emirates">United Arab Emirates</option> <option value="United Kingdom">United Kingdom</option> <option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option> <option value="Uruguay">Uruguay</option> <option value="Uzbekistan">Uzbekistan</option> <option value="Vanuatu">Vanuatu</option> <option value="Venezuela">Venezuela</option> <option value="Viet Nam">Viet Nam</option> <option value="Virgin Islands - British">Virgin Islands - British</option> <option value="Virgin Islands - U.S.">Virgin Islands - U.S.</option> <option value="Wallis And Futuna">Wallis And Futuna</option> <option value="Western Sahara">Western Sahara</option> <option value="Yemen">Yemen</option> <option value="Zambia">Zambia</option> <option value="Zimbabwe">Zimbabwe</option> </select></td> </tr> <tr> <td class="formLabel"><label for="phone" style="font-weight: bold;"> <span style="font-weight: bold; color: #cc3300;"> * </span> Phone: </label></td> <td align="left" valign="middle" class="formField"><input class="medium" id="phone" name="phone" type="text"></td> </tr> </tbody> </table></td> <td align="center" valign="top"><table width="500" class="basic"> <tbody> <tr> <td class="formLabel"><strong>If you have been issued a <br> registration code, please enter it here</strong></td> <td align="left" valign="middle" class="formField"><input class="medium" id="registercode" name="registercode" type="text"></td> </tr> <tr> <td class="formLabel"><label for="role" style="font-weight: bold;"> <span style="font-weight: bold; color: #cc3300;"> </span>Your Role in Purchasing: </label></td> <td align="left" valign="middle" class="formField"><select name="role" class="medium" id="role"> <option selected="selected" value="">Please select one...</option> <option value="No Role">No Role</option> <option value="Recommend Solution">Recommend Solution</option> <option value="Final Decision">Final Decision</option> <option value="Evaluate/Specify">Evaluate/Specify</option> <option value="Determine Need">Determine Need</option> </select></td> </tr> <tr> <td class="formLabel"><label for="company_size" style="font-weight: bold;"> <span style="font-weight: bold; color: #cc3300;"> </span>Company Size: </label></td> <td align="left" valign="middle" class="formField"><select name="company_size" class="medium" id="company_size"> <option selected="selected" value="">Please select one...</option> <option value="Under 100">Under 100</option> <option value="100-499">100-499</option> <option value="500-999">500-999</option> <option value="1000-4999">1000-4999</option> <option value="5000+">5000+</option> </select></td> </tr> <tr> <td class="formLabel"><label for="industry_type" style="font-weight: bold;"> <span style="font-weight: bold; color: #cc3300;"> </span>Industry Type: </label></td> <td align="left" valign="middle" class="formField"><select name="industry_type" class="medium" id="industry_type"> <option selected="selected" value="">Please select one...</option> <option value= "Retail_Manufacturing">Retail/Manufacturing</option> <option value= "Public_Government">Public/Government</option> <option value= "Financial">Financial</option> <option value= "Technology">Technology</option> <option value= "Education">Education</option> <option value= "Healthcare">Healthcare</option> <option value= "Insurance">Insurance</option> <option value= "Services">Services</option> <option value= "Other">Other</option> </select></td> </tr> <tr> <td valign="middle" class="formLabel"><strong>Which technologies<br>would you like to see?</strong></td> <td align="left" valign="middle" class="formField"><input class="medium" id="technology" name="technology" type="text"></td> </tr> <tr> <td valign="middle" class="formLabel"><strong>Which vendors<br/>would you like to see?</strong></td> <td align="left" valign="middle" class="formField"><input class="medium" id="vendors" name="vendors" type="text"></td> </tr> <tr> <td valign="middle" class="formLabel"><strong>To which technology<br/>associations do you belong?</strong></td> <td align="left" valign="middle" class="formField"><input class="medium" id="tech_associations" name="tech_associations" type="text"></td> </tr> <tr> <td class="formLabel"><input value="1" id="speaker" name="speaker" type="checkbox"></td> <td align="left" valign="middle" class="formField">I may be interested in speaking opportunities</td> </tr> <tr> <td class="formLabel"><input value="1" id="offers" name="offers" checked="checked" type="checkbox"></td> <td align="left" valign="middle" class="formField">I wish to receive up-to-date offers (via email) from sponsors</td> </tr> <tr> <td class="formLabel"><input value="1" id="newsletter" name="newsletter" checked="checked" type="checkbox"></td> <td align="left" valign="middle" class="formField">I wish to subscribe to The IT Summit Newsletter<br> (Includes a complimentary drink ticket at the event)</td> </tr> <tr> <td class="formLabel"><input value="1" id="updates" name="updates" checked="checked" type="checkbox"></td> <td align="left" valign="middle" class="formField"><label for="updates">Please keep me informed about this and future events.</label></td> </tr> <?php if($row->organizations==1) {?> <tr style="display:none;"> <td class="formLabel"><input value="1" id="part_organizations" name="part_organizations" checked="checked" type="checkbox"></td> <td align="left" valign="middle" class="formField"><label for="part_organizations">Include in Participating Organizations.</label></td> </tr> <?php } ?> </tbody> </table></td> <td valign="top" width="15%"></td> </tr> <tr> <td class="formFooter" colspan="4"><input class="save" name="submitTest" value="Submit" type="submit"></td> </tr> </tbody> </table> </form> <script language="JavaScript" type="text/javascript"> var frmvalidator = new Validator("form1"); frmvalidator.addValidation("fname","req","Please enter your First Name."); frmvalidator.addValidation("lname","req","Please enter your Last Name."); frmvalidator.addValidation("company","req","Please enter your Company."); frmvalidator.addValidation("email","req","Please enter your Email."); frmvalidator.addValidation("email","email","Please enter valid Email."); frmvalidator.addValidation("email2","req","Please enter valid Verify Email."); frmvalidator.addValidation("email2","email","Please enter valid Verify Email."); frmvalidator.addValidation("title","req","Please enter your Professional Title."); frmvalidator.addValidation("address","req","Please enter your Address."); frmvalidator.addValidation("city","req","Please enter your City."); frmvalidator.addValidation("state","req","Please enter your State/Province."); frmvalidator.addValidation("zip","req","Please enter your Zip."); frmvalidator.addValidation("country","req","Please enter your Country."); frmvalidator.addValidation("phone","req","Please enter your Phone."); frmvalidator.addValidation("registration_type","req","Please enter your Registration Type."); frmvalidator.addValidation("role","req","Please select Your Role in Purchasing."); frmvalidator.addValidation("company_size","req","Please select your Company Size."); frmvalidator.addValidation("industry_type","req","Please select your Industry Type."); </script> </td> </tr> </table> <?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/284459-newbie-needing-help-table-causes-syntax-error/ Share on other sites More sharing options...
Ch0cu3r Posted December 2, 2013 Share Posted December 2, 2013 Can you post the PHP error messages in full here. Ignore what your editor says. Quote Link to comment https://forums.phpfreaks.com/topic/284459-newbie-needing-help-table-causes-syntax-error/#findComment-1461005 Share on other sites More sharing options...
LDMartin1959 Posted December 2, 2013 Author Share Posted December 2, 2013 The error message is: [02-Dec-2013 02:50:27 UTC] PHP Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /mnt/stor11-wc2-dfw1/504042/www.theitsummit.com/web/content/wp-content/themes/theitsummit/denver2012registration.php on line 26 Code beginning on line 26 looks like this: <?php $row = mysql_fetch_object(mysql_query("select * from wp_posts where ID=".$_GET['id'])); if($row->evtdate=="") { wp_redirect(home_url()); exit; } $originalDate = $row->evtdate ; $newDate = date("F j, Y", strtotime($originalDate)); ?> I was gonna try to post the code from the entire page but it runs too long. However, the file can be viewed here: https://dl.dropboxusercontent.com/u/107754695/denver2012registration.php Quote Link to comment https://forums.phpfreaks.com/topic/284459-newbie-needing-help-table-causes-syntax-error/#findComment-1461006 Share on other sites More sharing options...
Ch0cu3r Posted December 2, 2013 Share Posted December 2, 2013 You are getting that error due to your query not returning any results. Change <?php $row = mysql_fetch_object(mysql_query("select * from wp_posts where ID=".$_GET['id'])); if($row->evtdate=="") { wp_redirect(home_url()); exit; } to <?php $result = mysql_query("select * from wp_posts where ID=".$_GET['id']); if(mysql_num_rows($result)) { $row = mysql_fetch_object($result); if($row->evtdate=="") { wp_redirect(home_url()); exit; } } Quote Link to comment https://forums.phpfreaks.com/topic/284459-newbie-needing-help-table-causes-syntax-error/#findComment-1461007 Share on other sites More sharing options...
LDMartin1959 Posted December 2, 2013 Author Share Posted December 2, 2013 It looks like the principle change you made was the addition of the line: if(mysql_num_rows($result)) But I also see that you eliminated one of the ")"'s after $_GET['id']. I'm guessing that "extra" ")" was causing part of the problem...but why did it work correctly in the original code without error? Any idea? Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/284459-newbie-needing-help-table-causes-syntax-error/#findComment-1461008 Share on other sites More sharing options...
Ch0cu3r Posted December 2, 2013 Share Posted December 2, 2013 No the the extra ) belonged to the mysql_fetch_object function. All I did was separate the mysql_query() on to its own line and then checked to make sure the query returned any results before using mysql_fetch_object. The problem was the query was not returning any results. When mysql_fetch_* functions are given an empty result set then you will get this type of error PHP Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in... Quote Link to comment https://forums.phpfreaks.com/topic/284459-newbie-needing-help-table-causes-syntax-error/#findComment-1461011 Share on other sites More sharing options...
LDMartin1959 Posted December 2, 2013 Author Share Posted December 2, 2013 Okay. And how did this cause the error message in DW? Or was DW just flipping out? Quote Link to comment https://forums.phpfreaks.com/topic/284459-newbie-needing-help-table-causes-syntax-error/#findComment-1461012 Share on other sites More sharing options...
Ch0cu3r Posted December 2, 2013 Share Posted December 2, 2013 (edited) Or was DW just flipping out? Probably. I see Dreamweaber as a WYSIWYG editor for HTML/CSS with a premium price tag, not a IDE for programming. Take notice of what PHP says not your editor. Edited December 2, 2013 by Ch0cu3r Quote Link to comment https://forums.phpfreaks.com/topic/284459-newbie-needing-help-table-causes-syntax-error/#findComment-1461015 Share on other sites More sharing options...
LDMartin1959 Posted December 2, 2013 Author Share Posted December 2, 2013 And as an additional question, what happened that the change I was making would case the fetch to fail when it had worked correctly (apparently) previously? Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/284459-newbie-needing-help-table-causes-syntax-error/#findComment-1461016 Share on other sites More sharing options...
LDMartin1959 Posted December 2, 2013 Author Share Posted December 2, 2013 Probably. I see Dreamweaber as a WYSIWYG editor for HTML/CSS with a premium price tag, not a IDE for programming. Take notice of what PHP says not your editor. I got CS5 cheap with my computer as a student. And since that package was/is used extensively by the school I was attending at the time, it seemed like a reasonable purchase. Quote Link to comment https://forums.phpfreaks.com/topic/284459-newbie-needing-help-table-causes-syntax-error/#findComment-1461021 Share on other sites More sharing options...
mac_gyver Posted December 2, 2013 Share Posted December 2, 2013 (edited) The problem was the query was not returning any results. When mysql_fetch_* functions are given an empty result set then you will get this type of error that's an incorrect statement. the query is failing due to an error (probably because the numerical $_GET variable is empty, but could be a half dozen other things.) a query that runs but matches zero rows does not produce errors like this when you call the fetch functions. edit: of the mysql_ functions, only mysql_result() will produce an error when there are no rows in the result set due to the data seek it performs. Edited December 2, 2013 by mac_gyver Quote Link to comment https://forums.phpfreaks.com/topic/284459-newbie-needing-help-table-causes-syntax-error/#findComment-1461024 Share on other sites More sharing options...
LDMartin1959 Posted December 3, 2013 Author Share Posted December 3, 2013 The presence of the {} around the form is still killing the page. The page displays when the form is not enclosed in the else{} -- although incorrectly since the logic statements are not excluding the form when it is not appropriate -- when the form is wrapped in else{} the page dies: nothing displays. I don't get it: What is there within the form code that can not handle being enclosed in the else{} function? Quote Link to comment https://forums.phpfreaks.com/topic/284459-newbie-needing-help-table-causes-syntax-error/#findComment-1461114 Share on other sites More sharing options...
LDMartin1959 Posted December 3, 2013 Author Share Posted December 3, 2013 I've sorta narrowed the problem to the table that begins at about line 97. I've eliminated the entire contents of the table and left it with two cells in a single row and THAT seems to be enough to break the PHP when enclosed with the else{}, yet the OTHER table doesn't give any problem when surrounded by the else{} statement. What am I missing? Quote Link to comment https://forums.phpfreaks.com/topic/284459-newbie-needing-help-table-causes-syntax-error/#findComment-1461119 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.