EminTugcu Posted July 10, 2008 Share Posted July 10, 2008 writing a article lister for mainly Joomla but im struck deeply.. i need to change the $artid dynamicly with actual article id's, which resides in jos_content / id it will be glad if i can get help or guidence, thanks. function makaleler($kim) { global $database; $sql = "SELECT jos_content.title, jos_categories.title AS section FROM jos_content, jos_categories WHERE jos_content.created_by = '$kim' AND jos_content.catid=jos_categories.id"; $database->setQuery( $sql ); $rows = $database->loadObjectList(); foreach ( $rows as $row ) { $artid = ??????????? echo " <a href='index.php?option=com_content&view=article&id=$artid'>$row->title</a>/$row->section<br>"; } } makaleler(65); Link to comment https://forums.phpfreaks.com/topic/114032-struck-with-code/ Share on other sites More sharing options...
fenway Posted July 10, 2008 Share Posted July 10, 2008 Change dynamically? What does that mean? Link to comment https://forums.phpfreaks.com/topic/114032-struck-with-code/#findComment-586916 Share on other sites More sharing options...
EminTugcu Posted July 11, 2008 Author Share Posted July 11, 2008 i mean getting the id for for each article in the "foreach" query Link to comment https://forums.phpfreaks.com/topic/114032-struck-with-code/#findComment-587156 Share on other sites More sharing options...
fenway Posted July 11, 2008 Share Posted July 11, 2008 Well, you're not getting back jos_content.id... Link to comment https://forums.phpfreaks.com/topic/114032-struck-with-code/#findComment-587459 Share on other sites More sharing options...
adam84 Posted July 11, 2008 Share Posted July 11, 2008 like this? $sql = "SELECT jos_content.id, jos_content.title, jos_categories.title AS section FROM jos_content, jos_categories WHERE jos_content.created_by = '$kim' AND jos_content.catid=jos_categories.id"; $results = mysql_query( $sql ); while( $row = mysql_fetch_array( $results ) ){ echo " <a href='index.php?option=com_content&view=article&id=".$row['id']."'>".$row['title']."</a>/".$row['section']."<br>"; } Link to comment https://forums.phpfreaks.com/topic/114032-struck-with-code/#findComment-587886 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.