string Sql_concat(string $string1 [, string $string2, ...])
champ SQL | chaine PHP |
---|---|
Code PHP : $champSQL = "id"; |
Code PHP : $strPHP = "'ma chaine'"; |
Code PHP : $champSQL = 'id'; |
Code PHP : $strPHP='\'ma chaine\''; |
$result = $Sql->Query_while("SELECT t.title ".$Sql->Sql_concat("'../forum/topic.php?id='", 't.id', "'#m'", 'msg.id')." AS `link` FROM ".PREFIX."forum_msg msg JOIN ".PREFIX."forum_topics t ON t.id = msg.idtopic"); while( $row = $Sql->Sql_fetch_assoc($result) ) { echo '<a href="'.$row['link'].'">'.$row['title'].'</a><br />'; } $Sql->Close($result); // Affiche un lien vers tous les message du forum // Ici la méthode Sql_concat va renvoyé une chaine de la forme '../forum/topic.php?id=TTT#mMMM' // avec TTT id de topic et MMM id de message.