The coding below works perfectly when the DO loop only contains an echo statement. As soon as I add the SELECT query to the DO loop it goes wrong. The DO loop performs once correctly and as does the WHILE loop before stopping.
Any ideas?
$query = "SELECT * FROM books";
$result = mysql_query($query)
or die('mysql error ' . mysql_error() . ' in query ' . $query);
WHILE ($row = mysql_fetch_array($result))
{
$splitkeywords1 = $row['keywords'];
$splitkeywords2 = explode(',',$splitkeywords1);
$keyindex = -1;
DO
{
$keyindex++;
$newtab = $splitkeywords2[$keyindex];
echo $newtab;
$query = "SELECT * FROM $newtab";
$result = mysql_query($query)
or
tablecreation($newtab);
}
WHILE ($splitkeywords2[$keyindex] != end($splitkeywords2));
};
PS Where can I find info on the differences and uses of the different brackets - {}
() are also sometimes used for precedence in mathematical functions, as well as conditional statements (if, elseif) to encapsulate (and set precedence) for the conditional tests.
if ($theother && ($this || $that)) { do some stuff }