Jump to content

MySQL Query Problem Please i need your help...


gunesahmet

Recommended Posts

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...

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.