Hello Guys!
I'd like to insert Google Adsense to be appeared in the first data cell <td> of my table which is generated dynamically, but encounter some difficulties how to do that. Please help.
I guessed that I have to write something like that
into the following code's snippetPHP Code:if ($count == 1){
echo("<td>Adsense JavaScript Goes Here</td>");
PHP Code:$query = "SELECT image FROM mydata ORDER BY image ASC";
$result = @mysql_query ($query); // Run the query.
$count=0;
$number_of_columns=2; //The required number of columns
$ImageRow = '';
while ($row = mysql_fetch_array($result)) {
$count++;
$ImageRow .= '<td><img "' . $row['image'] . '" /></td>';
if ($count == $number_of_columns)
{
echo " <tr>$ImageRow</tr>\n";
$count=0;
$ImageRow = '';
}
}
// if count > 0, there is still some data to be displayed
if ($count > 0)
{
// add empty cells to reach the required number of columns
for ($i = $count + 1; $i <= $number_of_columns=2; $i++)
{
$ImageRow .= '<td></td>';
}
// display the last two lines
echo "<tr>$ImageRow</tr>\n";
}





Bookmarks