Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Problem when trying to read the Name collumn ...

edited October 2006 in Vanilla 1.0 Help
Hi all ,

i am getting an encoding error when trying to read the Name collumn from LUM_Discussion table like this :
$query='SELECT Name,DiscussionID FROM `LUM_Discussion` ORDER BY `DiscussionID` DESC LIMIT 0 , 10'; $result=mysql_query($query); while($row=mysql_fetch_array($result)){ echo '<li><a href="http://myvanillaforum.com/vanilla/comments.php?DiscussionID='.$row['DiscussionID'].'/">'.$row['Name'].'</a></li>'; }

Can anyone help me ?

Thanks !

Comments

  • edited October 2006
    Use the SqlBuilder:
    $s = $Context->ObjectFactory->NewContextObject($Context, 'SqlBuilder'); $s->SetMainTable('Discussion', 'd'); $s->AddSelect(array('Name', 'DiscussionID'), 'd'); $s->AddOrderBy('DiscussionID', 'd', 'desc'); $s->AddLimit(0, 10); $ResultSet = $Context->Database->Select($s, 'ExtensionName', 'CurrentFunction', 'Your error message here'); while ($Row = $Context->Database->GetRow($ResultSet)) { echo '<li><a href="http://myvanillaforum.com/vanilla/comments.php?DiscussionID='. $Row['DiscussionID']. '/">'. $Row['Name']. '</a></li>'; }
  • Thanks for your reply . But sorry i want to call this piece of code from another php script ( out of vanilla ) , so how to do ? Thanks ! Bouazza .
  • It would probably be more useful if you told us the error you were getting...
  • Ok i only forgot to to a utf_decode :p
This discussion has been closed.