If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Supplied argument is not a valid MySQL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-11-04, 04:02
smartcard smartcard is offline
Registered User
 
Join Date: Jan 2004
Posts: 23
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,
Reply With Quote
  #2 (permalink)  
Old 06-11-04, 07:06
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
1. no idea
2. replace(particularfield,'''','x')
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 06-11-04, 10:05
smartcard smartcard is offline
Registered User
 
Join Date: Jan 2004
Posts: 23
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
Reply With Quote
  #4 (permalink)  
Old 06-11-04, 10:28
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
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 '%''%'
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On