Das ist der genutzte code
PHP Code:
<?php
$host = 'xxx';
$dbUser = 'xxx';
$dbPass = 'xxx';
$db = 'xxxx';
mysql_connect("$host", "$dbUser", "$dbPass") or die(mysql_error());
mysql_select_db("$db") or die(mysql_error());
$result = mysql_query("SELECT id,cat,bigimage FROM cp_products order by rand() LIMIT 1" ) or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
print"<center>";
print "<a href=\"http://www.domain.de/shop/showproduct.php?product=" . $row['id'] . "&cat=" . $row['cat'] . "\"><img src=\"http://www.domain.de/shop/data/" . $row['cat'] . "/thumbs/" . $row['bigimage'] . "\" border=\"0\"></a>";
print "</center>";
}
?>
Dieser Code lief als Widget im VB4 CMS einwandfrei
PHP Code:
$host = 'xxxxx';
$dbUser = 'xxxx';
$dbPass = 'xxxxx';
$db = 'xxxxx';
mysql_connect("$host", "$dbUser", "$dbPass") or die(mysql_error());
mysql_select_db("$db") or die(mysql_error());
ob_start();
$result = mysql_query("SELECT id,cat,bigimage FROM cp_products order by rand() LIMIT 1" ) or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
print"<center>";
print "<a href=\"http://www.domain.de/shop/showproduct.php?product=" . $row['id'] . "&cat=" . $row['cat'] . "\"><img src=\"http://www.domain.de/shop/data/" . $row['cat'] . "/thumbs/" . $row['bigimage'] . "\" border=\"0\"></a>";
print "</center>";
}
$output .= ob_get_contents();
ob_end_clean();