Need help with PHP syntax error

I fight with this error message ""Parse error: syntax error, unexpected T_IF ' for the 66 line that I get. " Here is the code that I use that I got with the help of the users of this site, which is supposed to launch a search for multiple parameters on a mysql database. The red text is the line 66. I just starting to learn PHP and I can not know what to do with it. Is it possible to have two if statements following each other like this? In addition, as I said, I was given this code from the help of this forum, but I don't understand what the purpose is of the $where variable. This code will work also without it? Thanks in advance for any help.

$query_rsMainItems = ' SELECT * FROM mainitems; $where = false; If (isset($_GET['category']) & &! empty($_GET['category'])) {$. query_rsMainItems = 'category WHERE ='.} GetSQLValueString ($_GET ['category'], 'text');      $where = true; } If (isset($_GET['price']) & &! empty($_GET['price'])) {if ($where) {$query_rsMainItems. = 'AND';}}   } else {$. query_rsMainItems = "WHERE";}     $where = true;   } $query_rsMainItems. = 'price ='. GetSQLValueString ($_GET ['price'], 'text'); } If (isset($_GET['time1']) & &! empty($_GET['time1'])) {if ($where) {$query_rsMainItems. = 'AND';}}   } else {$. query_rsMainItems = "WHERE";}     $where = true;   } $query_rsMainItems. = '(EDT) 1 ='. GetSQLValueString ($_GET ['time 1'], 'text'); } If (isset($_GET['time2']) & &! empty($_GET['time2'])) {if ($where) {$query_rsMainItems. = 'AND';}}   } else {$. query_rsMainItems = "WHERE";}     $where = true;   } $query_rsMainItems. is 'time2 ='. GetSQLValueString ($_GET ['time2'], 'text'); } If (isset($_GET['city']) & &! empty($_GET['city'])) {if ($where) {$query_rsMainItems. = 'AND';}}   } else {$. query_rsMainItems = "WHERE";}     $where = true;   } $query_rsMainItems. = 'city ='. GetSQLValueString ($_GET ['city'], 'text'); } If (isset($_GET['zip']) & &! empty($_GET['zip'])) {if ($where) {$query_rsMainItems. = 'AND';}}   } else {$. query_rsMainItems = "WHERE";}     $where = true;   } $query_rsMainItems. = 'zip ='. GetSQLValueString ($_GET ['zip'], 'text'); } If (isset($_GET['neighborhood']) & &! empty($_GET['neighborhood'])) {if ($where) {$query_rsMainItems. = 'AND';}}   } else {$. query_rsMainItems = "WHERE";}   } $query_rsMainItems. = 'quarter ='. GetSQLValueString ($_GET ['suburb'], 'text');

I copied and pasted the code in a local page. Aside from a missing brace after the last line ($query_rsMainItems. = 'quarter ='.) GetSQLValueString($_GET['neighborhood'], 'text');), it works perfectly.

The error message is a unexpected T_IF in line 66. This means that the PHP engine is not expected a conditional clause at this time here. In all likelihood, there is an error at an early stage in the code, which resulted in an unmatched brace.

The code I provided works. I tested completely before posting originally and tested again. The problem is that I tested it in isolation from the rest of the code in your page. Without seeing the whole page, it is impossible to determine where the error is located.

Tags: Dreamweaver

Similar Questions

  • Need help with PHP Muse (JavaScript error... by e-mail)

    Hey all the...

    I searched and did not see an answer to this:

    I exported my Muse file in HTML format and receive this error for my page contact us (email question):

    "JavaScript: PHP Script error form is missing from the web server or PHP is not configured correctly or your web hosting provider."  Check if the script PHP form as been downloaded correctly, then contact your provider for hosting on the configuration of PHP".

    What PHP version support MUSE... 5.1?  I contacted HostGator and they have just updated my PHP to 5.5 and asked me what needs PHP MUSE. Said HostGator 5.1 is old and they don't support 5.1. Can someone help me?

    Also, when I try to check PHP with: http://my-site.com/scripts/form_check.php , I just get an "oops" of the screen, but does not check my PHP. ???

    Thank you

    I don't see a page of Muse generated with a form to www.dancetx.com, or pages that links? Where can I find the page with the form that does not work? Thank you.

    If you Muse site doesn't have a form, which would explain why there is no file "form_check.php" on your site. This file (and the other for a form) are generated only when there is a form within the site uploaded/exported.

  • Need help with the Blue error screen.

    I'm having problems with the Blue error screen at startup which said "less than or equal Driver_IRQL_not. He entered the State of memory dump & black screen after that.  Nothing was abnormal after checking all the drivers in windows 7 Edition Device Manager Home premium. I'm really lost as to what causes it? My computer is a toshiba satellite laptop computer P840 pourrait-someone ' a please advise me on this matter. Thanks in advance for your patience.

    Dear Zigzag3143,

    I finally managed to fix the problem by the chance. I had discovered that this problem was caused by the sypnatics of the laptop touchpad driver. Uninstalled A & reinstall it with the correct driver from the laptop manufacturer websites. Did not expect that it is the cause of all the problems. Thank you for your valuable advice.

  • Need help with incorrect syntax for an update error

    I get the error message below, but I can't understand what I'm doing wrong.

    Run database query error.

    [Macromedia] [SQLServer JDBC Driver] [SQL Server] Incorrect syntax near the keyword 'WHERE '.

    The error occurred in C:\ColdFusion9\wwwroot\Intranet\DM\Admin\Maintenance-BulbBaseType.cfm: line 23

    21: UPDATE [bulb Type of basic table]

    22: SET [BulbBaseTypeDesc] = "#TxtBulbBaseTypeDesc #",.

    23: WHERE ([BulbBaseTypeID] = #TxtID #)

    24: < / cfquery >

    25: < cfset TxtID = 0 >

    I put my cfparam as:

    < name cfparam = 'Submit' default = "" >

    < cfparam name = "TxtID' default = 0 >

    < name cfparam = default "TxtBulbBaseTypeDesc" = "" >

    Thank you. I'm new to ColdFusion and it's someone other code. I appreciate the help.

  • Help with Javascript syntax error

    Hello

    I'm very new to all this. I have manged to write a script that will change the text in the field based on the text of another field. It sometimes "works", but the form freezes and crashes which I assume is because there is something wrong with my script. Any help would be appreciated.

    I put the script in the calculate-> custom calculation script box

    If ((this.getField("Email_Type").value == 'RSVP Reminder')) {}

    Event.Value = "Date:";

    }

    else if ((this.getField("Email_Type").value == 'Login Webinar')) {}

    Event.Value = "Date:";

    }

    else {}

    Event.Value = "";

    }

    I think I solved my problem. It looks like the place to check for each line, I need to declare the variable.

    If ((this.getField("Email_Type").value == 'RSVP Reminder')) {}

    Event.Value = "Date:";

    }

    else if ((this.getField("Email_Type").value == 'Login Webinar')) {}

    Event.Value = "Date:";

    }

    else {}

    Event.Value = "";

    }

  • Need help with PHP form with checkboxes, radio buttons and file as an attachment

    Hi guys,.

    I'm having a nightmare with this PHP form where a user can fill it out, attach a doc/pdf and submit. After trying to sort out with the previous code, I used, I have stripped try and think that I should start again just in the hope that you geniuses can help!

    Here is the HTML code of the contact.php:

    <form action="" method="post" name="contact" id="contact">
    
        <p>Job Title:*<br />
        <input name="position" type="text" /></p>
    
        <p>Nationality:*<br />
        <select name="nationality">
          <option value="">-- select one --</option>
          <option value="Afghan">Afghan</option>
          <option value="Albanian">Albanian</option>
          <option value="Algerian">Algerian</option>
          <option value="Zambian">Zambian</option>
          <option value="Zimbabwean">Zimbabwean</option>
        </select>
        </p>
        
        <p>Which country are you currently living in?*<br />
        <select name="country">
        <option value="">-- select one --</option>
        <option value="United Kingdom">United Kingdom</option>
        <option value="Afghanistan">Afghanistan</option>
        <option value="Africa">Africa</option>
        <option value="Zambia">Zambia</option>
        <option value="Zimbabwe">Zimbabwe</option>
        </select>
        </p>
        
        <label class="radio" for="checkRight">Yes/No question?</label><br />
        <input class="radio" type="radio" name="right" value="Yes" /> Yes
        <input class="radio" type="radio" name="right" value="No" /> No
        <input class="radio" type="radio" name="right" value="N/A" /> Not applicable
        
        <p>Yes/No question?<br />
        <select name="continue">
        <option value="">-- select one --</option>
        <option value="Yes">Yes</option>
        <option value="No">No</option>
        </select>
        </p>
        
        <p>Select your resorts:<br />
        Resort 1<input name="res1" type="checkbox" value="Resort 1" />
        Resort 2<input name="res2" type="checkbox" value="Resort 2" />
        Resort 3<input name="res3" type="checkbox" value="Resort 3" />
        Resort 4<input name="res4" type="checkbox" value="Resort 4" />
        Resort 5<input name="res5" type="checkbox" value="Resort 5" />
        Resort 6<input name="res6" type="checkbox" value="Resort 6" />    
        </p>
        
        <p>Don't send form unless this is checked:* <input type="checkbox" name="parttime" value="Yes" /></p>
        
        <p>Date of arrival: <input name="arrive" id="datepick" /><br />
        Date of departure: <input name="depart" id="datepick2" /></p>
        
        <script type="text/javascript" src="assets/scripts/datepickr/datepickr.js"></script>
        <link href="assets/scripts/datepickr/datepickr.css" rel="stylesheet">
        
        <script type="text/javascript">
        new datepickr('datepick');
        new datepickr('datepick2', {
        });
        </script>
        
        
        <p>Name:*<br />
        <input name="name" type="text" /></p>
        
        <p>E-mail:*<br />
        <input name="email" type="text" /></p>
        
        <p>Telephone:*<br />
        <input name="telephone" type="text" class="ctextField" /></p>
        
        <p>Upload CV (Word of PDF formats only):<br />
        <input type="file" name="cv" class="textfield"></p>
        
        <p><input name="submit" value="Submit Enquiry" class="submitButton" type="submit" /><div style="visibility:hidden; width:1px; height:1px"><input name="url" type="text" size="45" id="url" /></div></p>
    
    </form>
    

    Furthermore, the work of date boxes so excuse Javascript in there!

    To avoid SPAM, I used something where there is a hidden URL field that should be left blank for the form to submit you see in PHP.

    Here's where I am with the PHP which is placed above the heading of contact.php...

    <?php
    
    if (array_key_exists('submit', $_POST)) {
        $position = $_POST['position'];
        $arrive = $_POST['arrive'];
        $nationality = $_POST['nationality'];
        $parttime = $_POST['parttime'];
        $depart = $_POST['depart'];
        $name = $_POST['name'];
        $email = $_POST['email'];
        $telephone = $_POST['telephone'];
    
    $to = "[email protected]";
    $subject = "Recruitment Application";
    
    $message = $headers;
    $message .= "Name: " . $_POST["name"] . "\r\n";
    $message .= "E-mail: " . $_POST["email"] . "\r\n";
    
    $headers  = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "Reply-To: " . $_POST["email"] . "\r\n";
    $headers .= 'From: My Website <[email protected]>' . "\r\n";
    
    
    
    $message= "
    ";
    
    $url = stripslashes($_POST["url"]);
    if (!empty($url)) {
    header( 'Location: http://www.go-away-spam-robots.com' );
    exit();
    }
    
    if (!isset($warning)) {
    mail($to, $subject, $message, $headers);
    header( 'Location: http://www.mywebsite.co.uk/sent.php' );
    }
    
    }
    
    ?>
    

    I would like to make virtually all of the mandatory field so if a field is left empty (other than the hidden URL field), a warning message is displayed next to this field.

    Also, I would like that the file upload field to attach to the e-mail address that is sent to me and the results come through me in a table.

    Can someone help me get my form to work?

    Thank you and I hope to hear from you!

    SM

    Either way, the url of your custom success page must go inside the thanks_page variable:

    $thanks_page [0] = "Success.php";

    Nancy O.

  • Hi guys I need help with php

    Hi guys this is my problem, my site is cybid.host56.com and the page I'm having problems with is the registration page. the page is http://cybid.host56.com/register.php. all my pages are the plants but this one I can't find focus. I looked at the style sheets. global PHP. Enroll in php. but can't find the code. I've been on this 2 days but still can not find it. Help, please

    Thanks Robbie

    Everything was made a companion

    Thank you so much my friend for all your work, you're a star

    Robbie

  • I need help with a 404 error

    Firefox has developed a 404 error.
    Yes Internet Explorer has it as well.

    Thank you

    With certain web sites? A lot, some?

    Some problems occurs when your Internet security program has been implemented.
    trust the previous version of Firefox, but not more acknowledges your
    update as being approved. Now how do I solve the problem: to allow
    Firefox to connect to the Internet

    • Make sure your Internet security software is up-to-date (for example, you are using the latest version).
    • Delete Firefox to list your program of programs approved or recognized. For detailed instructions, see

    Configure the firewall so that Firefox can access the Internet. {web link}

  • need help with windows media error center "content is blocked and the PlayReady is not updated" and cannot watch television.

    recently, I get an error massage and cannot watch television. its residue content is blocked and PlayReady is not updated. tried a few online solutions, but nothing works. Help, please.

    so that's it. just another update. odd that it came 4 days after the first update

  • Need help with the CSS error or incorrect

    HI - hope someone can help me.  I'll put up a mega menu in Dreamweaver and then will export the code of WordPress.  First of all, to get all this work, here's the menu in HTML; I basically just put it all in DW to operate:

    http://designerandpublisher.com/MegaMenu/2/index7.html

    Then, I went to the end back to the WordPress site and pasted the code menu on the inside.  The final result was not working so I got rid of the 'th, one' in the code CSS #mainmenubar and when I did, it's good but the menu text color is green.  I need to do this and only this white text.  Here is a screenshot (I can't show you the actual location because it has restricted):

    white.jpg

    So I need to do text links in the white bar.  I know it must be a kind of class that I have to do the #mainmenubar and I read up on this subject, but just does not know how to write it to make it work.  Here is the CSS for the menu bar:

    #mainmenubar

    {

    color: #FFFFFF;

    text-decoration: none;

    border: 0px solid #a1a1a1;

    height: 40px;

    background-image: url ("http://gulfspilldemo.imsg.com/wp-content/uploads/blackgradient.jpg");

    background-repeat: repeat-x;

    border-radius: 10px 10px 10px 10px;

    }

    Any help is appreciated.  Thank you - Guy deaf

    Michael Walton wrote:

    My #mainmenubar code is not in this file yet but in thewhile I'm the test. Once I have run, I intend to add it to the main CSS file below:

    Are you sure the #mainmenubar of the css styles in the head section of the page come AFTER the link to the main css file?

    Try adding:

    #mainmenubar a {}

    color: #fff;

    }

    OR

    The page has a wrapper

    ?

    Very often, you may need to do something like:

    #wrapper #mainmenubar

  • Need help with PHP query

    When I run the following queries

    $result is mysql_query ("SELECT word_id FROM word WHERE word_word = '$gold [$i]'");.

    $row = mysql_fetch_array ($result);

                                     If ($row ['word_id'])

                                {

                                          $word_id = $row ['word_id'];

                                }

                                else

                                {

    mysql_query ("INSERT INTO Word (word_word) VALUES (\"$gold[$i]\ "") ");

    $word_id = mysql_insert_id();

                                    }

                             

    mysql_query ("INSERT INTO occurrence (word_id, page_id)

    (" VALUES ($word_id, $page_id) ');

    The insert in this case - double counts. For example, if the table contains the following:

    Time, peace, hope, heart. -It must insert these whenever one. But it does not work. It seems to insert them once in order - then repeats.

    So I have the time, peace, hope, heart, time, peace, hope, heart.

    I tried many, many things and cannot get this to stop. I lived this code and logic does not show why he repeats.

    Please help point me in the right direction!

    Sorry, I had a look at your code. It seems that you're trying to scrape the contents of web pages, but without comment, it would take several hours just to work on what the script is trying to do. The particular section of the code you are saying that you are having problems with is not in a loop, so I don't know how many values are inserted into the database. When you build a complex script like this, it is essential to comment your code so that you remember what made each section.

    If you are looking for details of my books, you can find them on my Web site at http://foundationphp.com/.

  • Need help with the syntax for default message.

    I want to display by default in the layout of lead for Feild "owner of lands":

    IIf (< plRegion_ITAG > = "South", "SG",
    IIf (< plRegion_ITAG > = "North", "AT",
    IIf (< plRegion_ITAG > = "East", "GK",
    IIf (< plRegion_ITAG > = "West" "BM", "Other than thesis it should be NULL")))

    ("Other than these we NULL"-> to do this, I tried a different name)

    SG, THE, BM, GK (little) are my managers society of sales/Terriotory.
    I did not miss anything, the above syntax doesnot work for me.

    Thanks in advance.

    Kind regards
    Ratan N

    Hi Ratan,

    A few notes:
    (A) you are missing a comma between "West" and "BM".
    (B) you must use "and not"
    (C) I'm not sure that you can have a drop down list remain NULL by using the IIf function. Even if you can it won't probably work with "other than these, it must be NULL.
    (D) I suggest that you actually add a value called NULL for the list of choices and after writing the syntax you can disable it to prevent your users from accidentally choose it.
    (E) should look like this:

    IIf (= 'South', 'SG',
    IIf (= 'North', 'AT',
    IIf (= 'Is', 'GK',
    IIf (= 'West', 'NULL', 'WB')))

  • Need help with Windows Update, error

    Whenever I try to run Windows Update, I get an error Code 80070490.  Any suggestions?

    Hi Claire,
     
    The error you receive occurs if there is corruption in the manifest of component maintenance base.  The only way to fix this is to do a "repair" of Windows Vista installation.

    http://support.Microsoft.com/kb/958044/en-us
    The 'repair' installation (upgrade on-site) will not affect your installed programs or data.  Just make sure that you are already connected to your computer when you start the installation.  Do not boot from the DVD .

    If the installation does not start automatically when you insert the DVD, run setup.exe from your DVD player.

    • When the Setup program starts and the install now screen, click install now .
    • Note When you receive the important Get updates for installation message, click go online .
    • Click upgrade when the which type of installation you want? appears

    Please let us know if this solves the problem for you.

    Matt
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Need help with the Oracle error table

    Hello

    I'm procedures for migration from SQL server to Oracle.

    In SQL server there is a reference to the table * master.dbo.sysmessages * is there any table in oracle, which equals master.dbo.sysmessages table of SQL server.

    Thanks in advance.

    Hello

    In sql server, the view is not containing error details.., I think that there is no such a table in oracle... To do this use the SQLERRM function in oracle...

  • [Help] Need help with php, Sql variables

    I have a users table contain fiedls "old, new and total."

    When file, update user DEFINED total is $total


    where $total = old + $nouveau

    I did it, I used echo to make sure it's ok, but it's not:

    / * Variable total Count * /.
    $old = ['old'] $row_rs_users;
    $new = $row_rs_users ['new'];
    $total = $vieux + $new;
    echo $total;
    If ((isset($_POST["MM_update"])) & & ($_POST ["MM_update"] == "doit_form")) {}
    $updateSQL = sprintf ("UPDATE users SET total = WHERE id = %s %s",)
    $total,
    GetSQLValueString ($_POST ['id'], "int"));

    Thank you

    As a part of your code, it is impossible to debug.

    However, your approach is bad anyway. All you need to do is add the new value to the old in the SQL query.

    $updateSQL = sprintf("UPDATE users SET total=(total+%s) WHERE id=%s",
                           GetSQLValueString($_POST['fieldName'], "double"),
                           GetSQLValueString($_POST['id'], "int"));
    

    $_POST ['fieldName'] is the new value. Use the 'double' if the value contains a decimal point. If it is an integer, replace 'double' 'int '.

Maybe you are looking for

  • Safari on iPhone OS

    How can I remove a category that is unwanted on the homepage of iPhone Safari? I click on "Safari" and popular, new, Google Maps, Yahoo, Wikipedia are still there. Now another site, I have visited is also displayed. How can I get rid of him?

  • Satellite M30: where can I download the drivers for my laptop

    Hello I recently formatted my laptop and did not stop to think that I need to backup my drivers. The OS is XP Home Edition, but Ive installed XP Pro. I lost my drivers in Device Manager, where theres an exclamation mark under other devices:Base devic

  • former driver pixelink cannot be used in labview2009

    I use pixlink SDK 4.2 driver in Labview 8.5 (8.2 ft samples). but there is always the .ctl errors in Labview2009 like the screenshot below. is there a new Pixelink dri for labview 2009 to download or how can I do with this problem? Thank you

  • Cannot install XP-cannot select drive to install on

    I can't install XP on a computer with a new hard drive. I can only find XP Home Upgrade and 95 upgrade to use CD. I can boot from the XP CD, and he comes to the point where there is no previous version, so he asks to have a previous version in that C

  • Vista not completely loading. Solved w / system restore, BUT...

    I am running Vista 32 bit Ultimate (Sony Vaio laptop). This morning, Windows is not load correctly on startup.  I did not entirely the error message before she closed, but several things did not work: my computer is not connected to my Internet Servi