1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Parse error in PHP

Discussion in 'Web Development & Web Hosting' started by twizzle, Mar 17, 2009.

  1. twizzle

    twizzle Gigabyte Poster

    1,838
    33
    104
    Can anyone with some PHP expericence help with the below code? I'ce copied it out of a book as a tutorial but ever time i run it i get Parse error: parse error, expecting `','' or `';'' in C:\wamp\www\test.php on line 19
    Now line 19 is the forth line in the below segment and i've tried placing ; or , where i think it should go but always get the error


    mysql_select_db($_POST[‘database’]);
    $query = stripSlashes($_POST[‘query’]);
    $result = mysql_query($query);
    echo “Database Selected: <b>{$_POST[‘database’]}, </b><br>
    Query: <b>$query</b><h3>Results</h3><hr>”;
    if($result == 0)
    echo “<b>Error “.mysql_errno().”: “.mysql_error().
    “</b>”;
     
    Certifications: Comptia A+, N+, MS 70-271, 70-272
    WIP: Being a BILB,
  2. supernova

    supernova Gigabyte Poster

    1,422
    21
    80
    Its the double quotes .

    Delete the “ ” and replace with " " (shift + 2)

    They are different codes, did you cut n paste from the web?
    Depending on your fonts you can see a difference,
    there's also different single quotes out there that can mess up SQL statements.

    Andi
     
    Certifications: Loads
    WIP: Lots
  3. twizzle

    twizzle Gigabyte Poster

    1,838
    33
    104
    Thanks for that Andi, comming from a background where text formats are important i had thought of the quotes but didnt realise the wrong ones were being used. I was concentrating on trying to find where ; was supposed to go.

    And yes it was copied from a for dummies book but it was an old one. Knowing this though, i can go through the rest of the code and change all my quotes to " for now.
     
    Certifications: Comptia A+, N+, MS 70-271, 70-272
    WIP: Being a BILB,
  4. supernova

    supernova Gigabyte Poster

    1,422
    21
    80
    No problem

    if you know or find out what they're called if they are named differently , please let us know.
     
    Certifications: Loads
    WIP: Lots
  5. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,623
    115
    224
    A useful tool for Firefox is the "Character Identifier" extension. My copy says "Left Double Quotation Mark" for the “ character.

    Harry.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+

Share This Page

Loading...