xvoyance Posted June 10, 2012 Share Posted June 10, 2012 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 the 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'] . "') "); ================================ So, how should I modify it? Link to comment Share on other sites More sharing options...
♥FWR Media Posted June 10, 2012 Share Posted June 10, 2012 You are misreading the error. It is not complaining about the query it is stating that there is no valid MySQL connection resource. I would hazard a guess that you are running this query externally from osCommerce and without the inclusion of the bootstrapper ( includes/application_top.php ) Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work. Link to comment Share on other sites More sharing options...
xvoyance Posted June 11, 2012 Author Share Posted June 11, 2012 You are misreading the error. It is not complaining about the query it is stating that there is no valid MySQL connection resource. I would hazard a guess that you are running this query externally from osCommerce and without the inclusion of the bootstrapper ( includes/application_top.php ) I indeed wrote a separate program to do the job. However, I indeed has included that line. Anyway, the problem has been solve. It is indeed not that string problem. It is that ....''''""""...""..'..'''... mixed up. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.