|
|
| |||||||
| Databases Help and discussions about databases (MySQL, PostgreSQL, Oracle, SQL Server etc.) |
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Junior Member Join Date: Jul 2008
Posts: 4
Rep Power: 0 ![]() | Hi I have an article directory that is functioning great except for one problem. If an author submits an article it is accepted into the database OK. He/she then gets an email as shown below......... Hello Christopher Phillips, Your Article, Article Testing has been accepted into our directory. You can view it at cothivalebooks.com/artdir?a=articles&p=230 Thanks again, cothivalebooks.com/artdir *The actual link text has been changed because of link moderation in forum, the two links have the normal http etc Great so far, until you click on the view link, then you 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 ')' at line 4 --- SELECT count(*) AS allcount FROM ams_articles, ams_categories WHERE article_categoryid = category_id AND article_state = 1 AND (category_id = '' OR category_parentid = ) --- Unable to get articlesYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 4 Now I am no programmer but if you take the 'amp;' out of the link it will then take you straight to the article as desired. I have scoured all the files and the MySQL but I cannot find where the amp; is being inserted. Is this possibly a conflict with php4 and php5? Any help would be appreciated!! Chris |
| | |
| Sponsored Ads | #1.5 |
| Sponsored posting Join Date: The beginning
Posts: lots
| Sponsored by... WM Media - Sell Your Website at above market prices!
|
| |
| | #3 (permalink) |
| Junior Member Join Date: Jul 2008
Posts: 4
Rep Power: 0 ![]() | Hi Carrod I think this is the code error syntax is referring to. I tried to post the whole file but moderator won't allow...too many symbols. Hope this helps. Cheers Chris $result = $this->db->query("SELECT count(*) AS allcount FROM {$this->pre}articles, {$this->pre}categories WHERE article_categoryid = category_id AND article_state = 1 AND (category_id = '".$Category->id."' $sub_query)"); if (!$result){ exit('Unable to get articles'.mysql_error()); |
| | |
| | #4 (permalink) | |||
| Junior Member Join Date: May 2008
Posts: 13
Rep Power: 0 ![]() | Ok, lets see if I got your question correct. Quote:
Quote:
Quote:
(category_id = '".$Category->id."' $sub_query)"); = line 4? | |||
| | |
| | #5 (permalink) |
| Junior Member Join Date: Jul 2008
Posts: 4
Rep Power: 0 ![]() | You are spot on so far.. If you take out the amp; there is no error. My problem is to stop the amp; being inserted just in the email that goes to the author. The trouble is that I have been through all relevant files and amp; appears hundreds of times so it is not just a question of deleting it as I am sure it will foul up the smooth running of the program. I just cannot find where the amp; is being inserted. It is the amp; that is bringing up the SQL fault if I can get rid of it just for that link then problem is solved. The sub_query I just don't understand |
| | |
| | #6 (permalink) |
| Junior Member Join Date: May 2008
Posts: 13
Rep Power: 0 ![]() | Ok so lets work with the creation of the link parameters. When the user adds their article, the email grabs the a=articles p=230 from somewhere, whats the code for the generation of the link? Where are the results for a and p coming from? |
| | |
| | #7 (permalink) |
| Junior Member Join Date: Jul 2008
Posts: 4
Rep Power: 0 ![]() | In my core.php file I have...... $Article->url = $Article->Category->url.$Article->urltitle.'.'.$this->settings['url_extension']; for ($i=0; $i < sizeof($this->Url->articleviews);$i++){ $Article->view[$this->Url->articleviews[$i]] = $this->relpath.$this->settings['url_articleview'].'/'.$this->Url->articleviews[$i].'-'.$Article->id.'.'.$this->settings['url_extension']; } } else{ $Article->url = '?a=articles&p='.$Article->id; for ($i=0; $i < sizeof($this->Url->articleviews);$i++){ $Article->view[$this->Url->articleviews[$i]] = $this->relpath.'?a='.urlencode($this->settings['url_articleview']).'&p='.urlencode($this->Url->articleviews[$i].'-'.$Article->id); I took out the amp; in core.php on website and then submitted article but the email still had the amp; |
| | |
| | #8 (permalink) | |
| Junior Member Join Date: May 2008
Posts: 13
Rep Power: 0 ![]() | Quote:
| |
| | |