Skippy
03-09-2010, 04:34 PM
Hey,
My code is below:
<?php
$cat = $_GET['offers'];
if($cat == ""){
$SearchResult = mysql_query("SELECT * from offers ORDER BY `title` ASC LIMIT " . ($page-1)*$Limit . ",$Limit") or die(mysql_error());
}else{
$SearchResult = mysql_query("SELECT * FROM offers WHERE categoryID = '$cat' LIMIT " . ($page-1)*$Limit . ",$Limit") or die(mysql_error());
}
while($list = mysql_fetch_array( $SearchResult )){
$textotemplate = new TextOfferReplace;
$textotemplate->load("template/includes/offershtml.php");
$textotemplate->replace("oid", $list['id']);
$textotemplate->replace("uid", file_get_contents ("template/includes/userid.php"));
$textotemplate->replace("title", $list['title']);
$textotemplate->replace("link", $list['link']);
$textotemplate->replace("offercredit", $list['amount']);
$textotemplate->replace("image", $list['image']);
$textotemplate->replace("credittime", $list['credittime']);
$textotemplate->replace("description", $list['description']);
$textotemplate->replace("requirements", $list['requirements']);
$textotemplate->publish();
}
?>
I would it so that when offercredit is called it uses the code below instead of $list['amount'].
<?php
$data = mysql_fetch_array($SearchResult);
$amount = $data['amount'];
switch ($amount) {
case "1.00":
echo "1";
break;
case "0.50":
echo "1/2";
break;
case "0.30":
echo "1/3";
break;
case "0.25":
echo "1/4";
break;
case "0.20":
echo "1/5";
break;
case "0.16":
echo "1/6";
break;
case "0.14":
echo "1/7";
break;
case "0.12":
echo "1/8";
break;
case "0.10":
echo "1/9";
break;
}
?>
How could I do this?
I've tried using $textotemplate->replace("offercredit", include('offerweights.php')); with the code above in offerweights.php. It works however it includes it on the actual file rather than replacing #offercredit#
Thanks.
My code is below:
<?php
$cat = $_GET['offers'];
if($cat == ""){
$SearchResult = mysql_query("SELECT * from offers ORDER BY `title` ASC LIMIT " . ($page-1)*$Limit . ",$Limit") or die(mysql_error());
}else{
$SearchResult = mysql_query("SELECT * FROM offers WHERE categoryID = '$cat' LIMIT " . ($page-1)*$Limit . ",$Limit") or die(mysql_error());
}
while($list = mysql_fetch_array( $SearchResult )){
$textotemplate = new TextOfferReplace;
$textotemplate->load("template/includes/offershtml.php");
$textotemplate->replace("oid", $list['id']);
$textotemplate->replace("uid", file_get_contents ("template/includes/userid.php"));
$textotemplate->replace("title", $list['title']);
$textotemplate->replace("link", $list['link']);
$textotemplate->replace("offercredit", $list['amount']);
$textotemplate->replace("image", $list['image']);
$textotemplate->replace("credittime", $list['credittime']);
$textotemplate->replace("description", $list['description']);
$textotemplate->replace("requirements", $list['requirements']);
$textotemplate->publish();
}
?>
I would it so that when offercredit is called it uses the code below instead of $list['amount'].
<?php
$data = mysql_fetch_array($SearchResult);
$amount = $data['amount'];
switch ($amount) {
case "1.00":
echo "1";
break;
case "0.50":
echo "1/2";
break;
case "0.30":
echo "1/3";
break;
case "0.25":
echo "1/4";
break;
case "0.20":
echo "1/5";
break;
case "0.16":
echo "1/6";
break;
case "0.14":
echo "1/7";
break;
case "0.12":
echo "1/8";
break;
case "0.10":
echo "1/9";
break;
}
?>
How could I do this?
I've tried using $textotemplate->replace("offercredit", include('offerweights.php')); with the code above in offerweights.php. It works however it includes it on the actual file rather than replacing #offercredit#
Thanks.