Some MySQL and PHP examples where multiple tables are used
$myquery = 'SELECT * FROM HashTagTable, SocialTable
WHERE HashTagTable.postid = SocialTable.postid AND hashtag = "'.$hashtag.'"
ORDER by SocialTable.date DESC LIMIT '.$maxp;
foreach ($dbh->query($myquery) as $row)
{
$res = $res.$row['postid'];
}
and where SQL commands are executed in a single line:
$deleteTable = "DELETE FROM HashTagTable";
$count1 = $dbh->exec($deleteTable);
Cleanup multi-byte characters (somewhat) - i.e. for author names
Note that in the file php.ini, you might need to uncomment the line:
extension=php_mbstring.dll
because multi-byte operations are not by default enabled.
$authors = mb_convert_encoding($authors, "HTML-ENTITIES", "UTF-8");
|