I tried to insert a record into mySQL. I know the following error message must came from the URL insertion
------------------------------------
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/public_html/catalog/admin/includes/functions/database.php on line 45
INSERT INTO products_description(products_id, language_id, products_name, products_description, products_url, extra_value2, extra_value3) VALUES ('452','1','Ji suan ji gai lun','form:BA
language:chi
[TEP STOP]
-------------------------------------
Therefore, I used urlencode and mysql_real_escape_string
$url=mysql_real_escape_string(urlencode(str_replace('http://','',$book['url'][0])));
The URL string after modification by var_dump is
string(51) "www.worldcat.org%2Foclc%2F276913176%3Freferer%3Dxid"
but still got te above error message.
The full insertion command is
================================
tep_db_query("INSERT INTO " . TABLE_PRODUCTS_DESCRIPTION .
"(products_id, language_id, products_name,
products_description, products_url,
extra_value2, extra_value3)
VALUES ('". $products_id . "','" . $language_id . "','" . $book['title'] .
"','form:" . $book['form'][0] . '<br> language:' . $book['lang'] , "'<br>,'" . $url . "','" .
$book['author'] . "','" . $book['year'] . "')
");
================================
The tep_db_query is OSC function. But it simply generate a SQL command.
So, how should I modify it?
insert a URL? what is wrong with my insertion?
Moderator: General Moderators
Re: insert a URL? what is wrong with my insertion?
It's complaining about what you provided for the $link_identifier parameter, not the query.Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/public_html/catalog/admin/includes/functions/database.php on line 45