Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Posts
    25

    Unanswered: Supplied argument is not a valid MySQL

    I am trying a link indexing script CNCat 1.4 that works with PHP and Mysql. I installed the script and everything is working fine, but if there are any links that has a (') in the description field, I am getting the following error within the search result:

    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/dom2/public_html/dir/search.php on line 30

    I need to know:

    1) Is there a way to fix it in the script?
    2) What is the sql command to replace all (') to (x) in a table one particular feilds all records?

    Thank you,

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    1. no idea
    2. replace(particularfield,'''','x')
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jan 2004
    Posts
    25
    When I tried:
    SELECT * FROM `cncat_main` WHERE 1
    replace(description,'''','x')


    I am getting the following error message:

    Database links - Table cncat_main running on localhost

    Error

    SQL-query :

    SELECT *
    FROM `cncat_main`
    WHERE 1
    REPLACE (
    description,
    '''',
    'x'
    )
    LIMIT 0 ,
    30

    MySQL said:

    #1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'REPLACE ( description,
    '''',
    '' ) LIMIT 0, 30' at line 4

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    i should have been more careful in answering

    it's not a "command", it's an expression

    you can use the expression in a SELECT like this --
    Code:
    select description
         , replace(description,'''','x')
      from cncat_main
    you can, if you wish, use it in an UPDATE like this --
    Code:
    update cncat_main
       set description
         = replace(description,'''','x')
     where description like '%''%'
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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