Joomla! Discussion Forums



It is currently Thu Nov 26, 2009 10:22 am (All times are UTC )

 




Post new topic Reply to topic  [ 2 posts ] 
Author Message
Posted: Tue Aug 26, 2008 8:40 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Jun 07, 2007 4:52 pm
Posts: 40
I want to insert an article into my content via a php script. I can write the SQL query but how I assist it a content_id. How do I know the next available content_id to use or know how to choose the next one?

Is there a way of saying INSERT into jos_content (.... .... ...._) use next available ID?

Thanks,
N


Top
  E-mail  
 
Posted: Tue Aug 26, 2008 10:06 pm 
User avatar
Joomla! Master
Joomla! Master
Online

Joined: Thu Aug 18, 2005 8:55 pm
Posts: 12901
Location: Nijmegen, The Netherlands
[MOD note: moving to Joomla! Coding 101]

Yes, the ID field of jos_content is of autoincrement.
If you INSERT a record of information with ID=0 (ID=NULL)
then the database will automatically assign the next free one (* sort of).

* With INSERT an autoincrement value that is stored in the table will be used,
an not the highest ID stored in the table.
If ID=100 & 101 are the two latest articles and ID=101 gets deleted,
then an INSERT with ID=0 will insert the record as ID=102.

_________________
Kind Regards,
Peter Martin, Global Moderator - Community & Leadership Team
www.db8.nl - Joomla specialist, Nijmegen, Nederland
Joomla 1.5 Quick Reference Guide: www.db8.nl/en/downloads/misc-downloads/ ... glish.html


Top
   
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

Quick reply

 



Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group