aye Posted January 26, 2007 Share Posted January 26, 2007 hey, im designing an RSS indexer for certain web pages. the idea is to store recently used keywords and their matches in a mysql table (the name of the table=search keyword and the matches inside the table) to speed up the search, however ive now come across two errors that i cant get rid of...1. if a search returns many matches (~>20), the php script will exit, saying "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 <INSERT INTO values>".. is there any limit of how many mysql queries one can make under a short session and can i increase this limit somehow?2. when searching for a word containing a number (ie 123), i get the following error "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 '123(id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), link VARCHAR(50), time INT)' at line 1"oh, and i have one more problem.. this ones not about mysql though... when searching for multiple keywords, i get the following error "Warning: fopen(<search directory>/<search query>) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /var/www/html/search.php on line 58.. that is when trying to read the rss feed from other search engines (for example feeds farm would give http://www.feedsfarm.com/s/my search&format=rss, in other words - it seems like fopen can't open path names that has spaces in them.. is there any way you can get around this?)thanks for your help :) Quote Link to comment https://forums.phpfreaks.com/topic/35869-a-couple-of-mysql-problems/ Share on other sites More sharing options...
genericnumber1 Posted January 26, 2007 Share Posted January 26, 2007 When doing fopen with a url with space try passing the url through rawurlencode() first, that might fix it.As for your other problems I cant really see them well in my head, could you post the code? Quote Link to comment https://forums.phpfreaks.com/topic/35869-a-couple-of-mysql-problems/#findComment-170059 Share on other sites More sharing options...
dgiberson Posted January 26, 2007 Share Posted January 26, 2007 Question 1: make sure you have quotes around your data & that info is right for the column you are inserting.Question 2: looks like you are missing a space between the table name and the table definition. Quote Link to comment https://forums.phpfreaks.com/topic/35869-a-couple-of-mysql-problems/#findComment-170064 Share on other sites More sharing options...
aye Posted January 26, 2007 Author Share Posted January 26, 2007 genericnumber: thanks for the tip, got an other error now though: 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 '<last keyword>(id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), link VARCHAR(50), tim' at line 1.dgiberson: tried putting a space between them but there was no change :(here's the code that inserts everything into mysql anyhow:[code]function endElement($parser, $name) { global $insideitem, $link, $conn, $tcount; if ($name == "ITEM") { if(!mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . $_GET["q"] . "'"))) { mysql_query("CREATE TABLE " . $_GET["q"] . " (id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), link VARCHAR(50), time INT)",$conn) or die(mysql_error()); } mysql_query("INSERT INTO `" . $_GET["q"] . "` (link,time) VALUES ('" . $link . "','" . time() . "')",$conn) or die(mysql_error()); $tcount++; $link = ""; $insideitem = false; }}[/code]was some time i did php, so i have probably made some newby mistake :) Quote Link to comment https://forums.phpfreaks.com/topic/35869-a-couple-of-mysql-problems/#findComment-170076 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.