gunesahmet Posted August 21, 2010 Share Posted August 21, 2010 Senseis, I give nothing error. But mysql query dont put in to the table. I am using variables... $ara = '/Public Game - /'; $degistir = ''; $seo_var=preg_replace( $ara, $degistir, $yeni_title ); $ara2 = '/\s+/'; $degistir2 = ''; $seo_var2=preg_replace( $ara2, $degistir2, $seo_var ); $seo_link = tr_converter($seo_var); $makalequery = "INSERT INTO `jos_content` (`id`, `title`) VALUES (NULL, '$seo_link')"; $makaleekle = mysql_query($makalequery) or die("Problem with the query: $q<br>" . mysql_error()); Thank you for help... Note: I'm dealing with this problem for three days.. Best Regards... Quote Link to comment https://forums.phpfreaks.com/topic/211347-mysql-query-problem-please-i-need-your-help/ Share on other sites More sharing options...
karimali831 Posted August 21, 2010 Share Posted August 21, 2010 You can try: $makalequery = "INSERT INTO `jos_content` (`title`) VALUES ('$seo_link')"; If col `id` is the auto_increment there is no need to insert it. Quote Link to comment https://forums.phpfreaks.com/topic/211347-mysql-query-problem-please-i-need-your-help/#findComment-1101989 Share on other sites More sharing options...
gunesahmet Posted August 21, 2010 Author Share Posted August 21, 2010 when i run from console dont give any error and put in to table. But i dont run with php... Quote Link to comment https://forums.phpfreaks.com/topic/211347-mysql-query-problem-please-i-need-your-help/#findComment-1101992 Share on other sites More sharing options...
mikosiko Posted August 23, 2010 Share Posted August 23, 2010 - check if you are really connected to the DB. - check the value of $seo_link before the query - what is $q... the one that you are using in your die() call? Quote Link to comment https://forums.phpfreaks.com/topic/211347-mysql-query-problem-please-i-need-your-help/#findComment-1102635 Share on other sites More sharing options...
DWilliams Posted August 23, 2010 Share Posted August 23, 2010 In any sane database setup you a. shouldn't be allowed to have a NULL id (assuming ID is your PK, that's the name most people use for every table's PK) and b. shouldn't need to specify an ID with auto increment on So check your database design and see if it even allows a null value in the id field. If not, give it a value. Actually, give it a value anyway Quote Link to comment https://forums.phpfreaks.com/topic/211347-mysql-query-problem-please-i-need-your-help/#findComment-1102688 Share on other sites More sharing options...
kickstart Posted August 23, 2010 Share Posted August 23, 2010 Hi I would suggest you echo out $makalequery to check it is what you are expecting. There is nothing apparent with the SQL or the PHP. If Id is an auto increment then I would do the same as you and specify NULL for it. Works fine in MySql and triggers the auto increment, but in some flavours of SQL it is essential to do it this way. All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/211347-mysql-query-problem-please-i-need-your-help/#findComment-1102717 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.