Search found 7 matches
- Sun Dec 23, 2007 3:37 pm
- Forum: Joomla! Coding 101
- Topic: How to Joomla-ize this MySQL/PHP code
- Replies: 12
- Views: 2281
Re: How to Joomla-ize this MySQL/PHP code
Not sure that I followed all of the steps in this thread but I have to ask 3 questions. One for my benefit and another 2 hopefully for your benefit. Would a query of select max(id) from `#__my_table` not get you the last inserted auto_increment value prior to your insert? You may have t...
- Fri Dec 14, 2007 9:03 pm
- Forum: Joomla! Coding 101
- Topic: How to Joomla-ize this MySQL/PHP code
- Replies: 12
- Views: 2281
Re: How to Joomla-ize this MySQL/PHP code
so all you need is the incremented record id? Try $database->insertid() right after you run the INSERT query, and you should receive the last auto_increment of that table. You also get the last insert id using the 3rd argument of: $database->insertObject( $table, &$object, $keyName) I just n...
- Fri Dec 14, 2007 5:42 pm
- Forum: Joomla! Coding 101
- Topic: How to Joomla-ize this MySQL/PHP code
- Replies: 12
- Views: 2281
Re: How to Joomla-ize this MySQL/PHP code
Why it won't work with #__content is beyond me, but it won't. Some weird stuff here. It will however work with: $query = "SHOW TABLE STATUS LIKE '%_content'"; I just brought in the database prefix variable as a global and ran with: $query = "SHOW TABLE STATUS LIKE '" . $mosConfig_dbprefix . "...
- Fri Dec 14, 2007 5:35 pm
- Forum: Joomla! Coding 101
- Topic: How to Joomla-ize this MySQL/PHP code
- Replies: 12
- Views: 2281
Re: How to Joomla-ize this MySQL/PHP code
CirTap wrote:just saw loadRow(), loadResultArray() and many others. Use the one that suits your need -- I suppose loadRow() is more appropriate for this particular statement.
loadRow wouldn't work. Neither would loadResultArray. Only loadAssocList would work. Weird.
- Fri Dec 14, 2007 5:33 pm
- Forum: Joomla! Coding 101
- Topic: How to Joomla-ize this MySQL/PHP code
- Replies: 12
- Views: 2281
Re: How to Joomla-ize this MySQL/PHP code
Hi, in 1.0.x it's called loadAssocList() As the name load Object List() may imply, it returns a list of objects , however in this case the list ( = array) contains a single entry (object(stdClass)) only: $rows[0]->Auto_increment You should be able to use "#__content" with setQuery(). No idea...
- Fri Dec 14, 2007 5:02 pm
- Forum: Joomla! Coding 101
- Topic: How to Joomla-ize this MySQL/PHP code
- Replies: 12
- Views: 2281
Re: How to Joomla-ize this MySQL/PHP code
$rows = $database->loadObjectList(); instead of mysql_fetch_assoc() use this above line and then do a var_dump for $rows variable to see what it has. The code now looks like this: $query = "SHOW TABLE STATUS LIKE 'jos_content'"; $newid = $database->setQuery($query); $rows = $database->loadObjectLis...
- Fri Dec 14, 2007 5:34 am
- Forum: Joomla! Coding 101
- Topic: How to Joomla-ize this MySQL/PHP code
- Replies: 12
- Views: 2281
How to Joomla-ize this MySQL/PHP code
Can someone tell me how to Joomla-ize this code: $tablename = "jos_content"; $next_increment = 0; $qShowStatus = "SHOW TABLE STATUS LIKE '$tablename'"; $qShowStatusResult = mysql_query($qShowStatus) or die ( "Query failed: " . mysql_error() . "<br/>" . $qShowStatus ); $row = mysql_fetch_assoc($qShow...