Hello everyone,
I have created a php file to run a mysql command to pull information regarding a promotion that I am running. I am looking for the php to establish a product_id association for the day that I run my promotion. The promotion is a deal of the day promotion, which you can see the specifics here:
[URL=“http://forum.cs-cart.com/showthread.php?t=15752&page=7”]http://forum.cs-cart.com/showthread.php?t=15752&page=7[/URL]
I established {include file=‘DOD.php’} in my main.tpl file.
Here is the code for DOD.php file
[QUOTE]{literal}
FileName=“Connection_php_mysql.htm”
Type=“MYSQL”
HTTP=“true”
$hostname_DOD = “xxxxxxxx”;
$database_DOD = “xxxxxxxxxxxxxxxxxxxx”;
$username_DOD = “xxxxxxxxxxxxxxxxxxx”;
$password_DOD = “xxxxxxxxxxxxxxxxx”;
$DOD = mysql_pconnect($hostname_DOD, $username_DOD, $password_DOD) or trigger_error(mysql_error(),E_USER_ERROR);
if (!function_exists(“GetSQLValueString”)) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = “”, $theNotDefinedValue = “”)
{
if (PHP_VERSION < 6) {
$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_DOD, $DOD);
$query_Recordset1 = “SELECT product_id FROM cscart_product_features_values WHERE value_int = CURDATE()”;
$Recordset1 = mysql_query($query_Recordset1, $DOD) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
[COLOR=“Red”]$product = $row_Recordset1[‘product_id’];[/COLOR]
?>{/literal}
{literal}
mysql_free_result($Recordset1);
?>{/literal} [/QUOTE]
I am trying to pass the variable $product to javascript so that I can establish a link association with my promotion on my home page.
Can anyone see what I am doing wrong here. I am not familiar with smarty syntax, so I’m guessing that is where I am going wrong.
Thanks in advance,
Jeff