Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: error message

  1. #1
    Regular Coder
    Join Date
    Jun 2003
    Location
    Australia
    Posts
    528
    Thanks
    8
    Thanked 8 Times in 8 Posts

    error message

    Cans someone tell me why this would be happening:

    Here is the script:
    PHP Code:
    <?
    $eresult 
    mysql_db_query($url"SELECT * FROM tstyles WHERE sid>0");
    while (
    $erow mysql_fetch_array($eresult)) {
    $title $erow["title"];
    $rule $erow["rule"];
    echo 
    " - $title / $rule - <br>";
    mysql_db_query($database"INSERT INTO tstyles (title, rule, url) VALUES ('$title', '$rule', '$url')") or die ("ERROR: "mysql_error());
    }
    ?>
    Now, on the first attempt - $rule has a value of:

    Rated & Protected Tables. Double 6's, 5's Up with All Options up to 100 points.

    And this is the error message I get:

    ERROR: You have an error in your SQL syntax near 's, 5's Up with All Options up to 100 points.', 'drdoms')' at line 1

    Is this being caused because $rule has ' in it. If so, why? Never has before - I have over 50 tables with about 10 records each that I am trying to move into the one table, so really dont want to do it manually just because it has ' in it.

    Any advice would be greatly appreciated.

    Thanks in advance

  • #2
    Regular Coder
    Join Date
    Jun 2003
    Location
    Australia
    Posts
    528
    Thanks
    8
    Thanked 8 Times in 8 Posts
    Okay - I added "addslashes()" in order to get the $message in the database, what I don't understand is why did it allow it in there in the first place? EG. When someone put the message into my original table, why does it allow it to go in and yet now it wont for me!!!???


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •