Add recordset with CMS made simple
Posted: Thu Apr 02, 2009 9:11 am
Hi, i've a problem with my page. I would like to connect a sql DB. It a success but I've 2 problems :
1 : The page show only the result of the SQL request and note all the page with menu, css, design
2 : the pictures not displayed, it's show, a blank picture with "image not found".
Here, my php code :
I hope you understand my problem.-
Thanks for your help
1 : The page show only the result of the SQL request and note all the page with menu, css, design
2 : the pictures not displayed, it's show, a blank picture with "image not found".
Here, my php code :
Code: Select all
{php} require_once('../Connections/nopixel_bd.php');
require_once('../includes/tng/tNG.inc.php');
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_nopixel_bd, $nopixel_bd);
$query_Recordset1 = "SELECT * FROM clients ORDER BY `date` DESC";
$Recordset1 = mysql_query($query_Recordset1, $nopixel_bd) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
// Show Dynamic Thumbnail
$objDynamicThumb1 = new tNG_DynamicThumbnail("", "KT_thumbnail1");
$objDynamicThumb1->setFolder("../imgupload/");
$objDynamicThumb1->setRenameRule("{Recordset1.image_index}");
$objDynamicThumb1->setResize(150, 101, true);
$objDynamicThumb1->setWatermark(false);
{/php}
<table border="0">
<tr>
{php}
do { // horizontal looper version 3
{/php}
<td><table width="285" border="0" cellspacing="3" cellpadding="2">
<tr>
<td width="150"><div align="center"></div></td>
<td width="120"> </td>
</tr>
<tr>
<td width="150"><a href="realisations_detail.php?id_client={php} echo $row_Recordset1['id']; {/php}"><img src="../{php} echo $objDynamicThumb1->Execute(); {/php}" alt="Vignette" border="0" /></a></td>
<td width="120" valign="top"><div align="left">{php}echo $row_Recordset1['nom'];{/php}<br />
{php} echo $row_Recordset1['description'];{/php}<br />
</div></td>
</tr>
</table></td>
{php}$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (!isset($nested_Recordset1)) {
$nested_Recordset1= 1;
}
if (isset($row_Recordset1) && is_array($row_Recordset1) && $nested_Recordset1++ % 3==0) {
echo "</tr><tr>";
}
} while ($row_Recordset1); //end horizontal looper version 3
{/php}
</tr>
</table>
{php}
mysql_free_result($Recordset1);
{/php}
Thanks for your help