Renkia Posted February 26, 2010 Share Posted February 26, 2010 Having abit of trouble with the profile signature. Dont see the problem. GOT FROM [mccode] Profile Signatures PAGE 3 Fatal error: Call to a member function query() on a non-object in /home/chaotic/public_html/preferences.php on line 155 LINE 155: $db->query("UPDATE users SET signature='{$_POST['newsignature']}' WHERE userid=$userid",$c); SQL [mysql]ALTER users ADD `signature` text NOT NULL;[/mysql] #1064 - 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 'users ADD `signature` text NOT NULL' at line 1 MySQL Version: 5.1.40 Any idea how to help? Also mind telling me the problem and try explaining why it isnt working. Could help me on my progress. Cheers :thumbsup: Quote Link to comment Share on other sites More sharing options...
CrazyT Posted February 26, 2010 Share Posted February 26, 2010 Error say's it all :) Fatal error: Call to a member function query() on a non-object in /home/chaotic/public_html/preferences.php on line 155 You need to define $db, global $db; Quote Link to comment Share on other sites More sharing options...
Joshua Posted February 26, 2010 Share Posted February 26, 2010 ALTER users ADD `signature` text NOT NULL; ALTER TABLE helps ;) ALTER TABLE `users` ADD `signature` VARCHAR(255) NOT NULL; Quote Link to comment Share on other sites More sharing options...
Renkia Posted February 26, 2010 Author Share Posted February 26, 2010 Error say's it all :) Quoted Fatal error: Call to a member function query() on a non-object in /home/chaotic/public_html/preferences.php on line 155 You need to define $db, global $db;Ok sorry but i havnt came across the word Define before but im suggesting... $db, global $db->query("UPDATE users SET signature='{$_POST['newsignature']}' WHERE userid=$userid",$c); I Hope its right 8o ?( Cheers immortal. :thumbup: Quote Link to comment Share on other sites More sharing options...
iSOS Posted February 26, 2010 Share Posted February 26, 2010 Nope, At the top of your function add global $db; As for the query maybe you should look these up. :) http://php.net/manual/en/function.mysql-real-escape-string.php http://php.net/manual/en/function.strip-tags.php Quote Link to comment Share on other sites More sharing options...
Renkia Posted February 26, 2010 Author Share Posted February 26, 2010 Ok sorry my bad. global $db; $db->query("UPDATE users SET signature = '".$db->escape($_POST['newsignature'])."' WHERE userid = ".$userid); Fixed by MTG. Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted February 26, 2010 Share Posted February 26, 2010 ALTER TABLE `users` ADD `signature` VARCHAR(255) NOT NULL; why varchar? Quote Link to comment Share on other sites More sharing options...
Renkia Posted February 26, 2010 Author Share Posted February 26, 2010 Its ok Zero. Still works. :) But out of conclution? What did you say that? :huh: Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted February 26, 2010 Share Posted February 26, 2010 im just curious to why he used varchar... Quote Link to comment Share on other sites More sharing options...
Renkia Posted February 26, 2010 Author Share Posted February 26, 2010 Nononon.. XD I Was wondering whats so bad about Varcher. What would you use, and why? Sorry i just need to learn some SQL, :pinch: Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted February 26, 2010 Share Posted February 26, 2010 CHAR( ) A fixed section from 0 to 255 characters long. VARCHAR( ) A variable section from 0 to 255 characters long. TINYTEXT A string with a maximum length of 255 characters. TEXT A string with a maximum length of 65535 characters. BLOB A string with a maximum length of 65535 characters. MEDIUMTEXT A string with a maximum length of 16777215 characters. MEDIUMBLOB A string with a maximum length of 16777215 characters. LONGTEXT A string with a maximum length of 4294967295 characters. LONGBLOB A string with a maximum length of 4294967295 characters. Quote from htmlite Quote Link to comment 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.