View Single Post
  #73 (permalink)  
Old 04-12-2008, 07:01 PM
Relative0 Relative0 is offline
New Pligger
 
Join Date: Sep 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by ivytony View Post
It's probably in the link.php file. check whether your WHERE clause is empty or not. I had the same problem but solved.
Thanks kindly for the idea, I am guessing that you are right and that I am still doing something wrong. Here is what I have for a few lines of code in store_basic() in the libs/link.php:

Code:
if($this->id===0) {
			$sql = "INSERT INTO " . table_links . " (link_author, link_status, $link_type, link_randkey, link_category,  link_date, link_published_date, link_votes, link_karma, link_title, link_content) VALUES ($link_author, '$link_status', '$link_type', $link_randkey, $link_category, FROM_UNIXTIME($link_date), FROM_UNIXTIME($link_published_date),$link_votes, $link_karma)";
			if($this->debug == true){echo '<hr>store_basic:Insert:' . $sql . '<hr>';}
			$db->query($sql);
			$this->id = $db->insert_id;
		} else {
		// update
			$sql = "UPDATE " . table_links . " set `link_reports`=$link_reports, `link_comments`=$link_comments, link_author=$link_author, link_status='$link_status', link_randkey=$link_randkey, link_category=$link_category, link_modified=NULL, link_date=FROM_UNIXTIME($link_date), link_published_date=FROM_UNIXTIME($link_published_date), link_votes=$link_votes, link_karma=$link_karma, link_field1='$link_field1', link_field2='$link_field2' WHERE link_id=$this->id";

			// Brian had originally Added this ,link_field1='$link_field1', link_field2='$link_field2' WHERE link_id=$this->id"  But it is changed bacl now.
			// In place of  WHERE link_id=$this->id";

			if($this->debug == true){echo '<hr>store_basic:Update:' . $sql . '<hr>';}
			$db->query($sql);
		}
The error that I get is such:

Warning: 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 'AND `link_author` = 1 ORDER BY `link_date` DESC LIMIT 1' at line 1 in /home/content/html/Pligg98/libs/db.php on line 233


Any ideas? Thanks much,

Brian

Last edited by Relative0; 04-12-2008 at 07:04 PM.. Reason: I wanted to insert the error that I got
Reply With Quote