Can someone figure out what's going wrong with my code here?
Posted: Tue Sep 07, 2010 9:01 am
Hello,
If anyone can help please let me know. The 2 files below are what's used to render the "Frickster's ListRave Posts" at the following URL http://www.listrave.com/member/profile.php?id=24. You can see that under Antiques it lists the same ads under both York and Altoona. The script is identifying all ads posted by User ID 24 but I don't know why it is duplicating those ads in the 2 different cities. There should actually be 2 ads for York and one for Altoona. The code is below. Again, please help
Here's the code to pull the info from the data base (called memberall_listings.php)
Here's the code to display it. Remember, this is just for "Frickster's ListRave Posts"
Any ideas?
Dennis
If anyone can help please let me know. The 2 files below are what's used to render the "Frickster's ListRave Posts" at the following URL http://www.listrave.com/member/profile.php?id=24. You can see that under Antiques it lists the same ads under both York and Altoona. The script is identifying all ads posted by User ID 24 but I don't know why it is duplicating those ads in the 2 different cities. There should actually be 2 ads for York and one for Altoona. The code is below. Again, please help
Here's the code to pull the info from the data base (called memberall_listings.php)
Code: Select all
}
$getAllArray[$zz][$kk]["Titlename"] = "<a href='http://www.listrave.com'>ListRave</a> --> <a href=".$getTableDetails["stateurl"].">".$getTableDetails["state"]."</a> --> <a href=".$getTableDetails["cityurl"].">".mysql_real_escape_string($getTableDetails["city"])."</a> --> <a href=".$getTableDetails["maincaturl"].">".$getTableDetails["maincat"]."</a> --> <a href=".$getTableDetails["caturl"].">".$getTableDetails["cat"]."</a>";
$getAllArray[$zz][$kk]["PostURL"] = $getTableDetails["SitePostUrl"];
$getAllArray[$zz][$kk]["AgeFormat"] = $getTableDetails["DisplayFormat"];
$getAllArray[$zz][$kk]["TableName"] = $site["tablename"][$ww];
$getAllArray[$zz][$kk]["SiteRealPath"] = $getTableDetails["SiteRealPath"];
$lastcity = $getTableDetails["city"];
$laststate = $getTableDetails["state"];
$GetAdlists[$zz]["MainArray"] = GetMemberAdLists($site["tablename"][$ww],$getmemberId);
if($GetAdlists[$zz]["MainArray"]!=""){
$getAllArray[$zz][$kk]["ArrayExist"] = "Yes";
}else{
$getAllArray[$zz][$kk]["ArrayExist"] = "No";
}
for($k=0;$k<count($GetAdlists[$zz]["MainArray"]);$k++) {
$getdate = explode(",",$GetAdlists[$zz]["MainArray"][$k]["Posted_date"]);
$getAllArray[$zz][$kk][$k]['day'] = date("l",strtotime($getdate[0]));
$getAllArray[$zz][$kk][$k]['month'] = date("F",strtotime($getdate[0]));
$getAllArray[$zz][$kk][$k]['date'] = date("d",strtotime($getdate[0]));
$getAllArray[$zz][$kk][$k]['ListArray'] = getMemberAddetails($getdate[0],$site["tablename"][$ww],$getmemberId, $getTableDetails["city"], $getTableDetails["state"]);
for($mn=0;$mn<count($getAllArray[$zz][$kk][$k]['ListArray']);$mn++) {
if($getAllArray[$zz][$kk][$k]['ListArray'][$mn]["Picture0"]!='' || $getAllArray[$zz][$kk][$k]['ListArray'][$mn]["Picture1"]!='' || $getAllArray[$zz][$kk][$k]['ListArray'][$mn]["Picture2"]!='' || $getAllArray[$zz][$kk][$k]['ListArray'][$mn]["Picture3"]!='' || $getAllArray[$zz][$kk][$k]['ListArray'][$mn]["Picture4"]!='' || $getAllArray[$zz][$kk][$k]['ListArray'][$mn]["Picture5"]!='')
$getAllArray[$zz][$kk][$k]['ListArray'][$mn]["ImageArray"] = 'Yes';
else
$getAllArray[$zz][$kk][$k]['ListArray'][$mn]["ImageArray"] = 'No';
}
}
}
}
}
/* if($_SERVER['REMOTE_ADDR'] = '122.165.56.46') {
printArray($getAllArray);
exit;
} */
function SelectQry1($Qry) {
$result = mysql_query($Qry) or die ("QUERY Error:".$Qry."<br>".mysql_error());
$numrows = mysql_num_rows($result);
if ($numrows == 0){
return;
} else {
$row = array();
$record = array();
while ($row = mysql_fetch_array($result)){
$record[] = $row;
}
}
return $record;
}
function getTableDetailsByTableName($tablename, $kk) {
global $global_config;
$Qry = "select * FROM ".$tablename."";
$getListingdetail = SelectQry1($Qry);
return $getListingdetail[$kk];
}
function getTableDetailsByTableName2($tablename) {
global $global_config;
$Qry = "select * FROM ".$tablename."";
$getListingdetail = SelectQry1($Qry);
return $getListingdetail;
}
function GetMemberAdLists($tablename,$getmemberId) {
global $global_config;
$Qry = "select Posted_date FROM ".$tablename." where memberid='".$getmemberId."' group by SUBSTRING_INDEX(Posted_date,',',1) Order by Posted_date DESC";
$getimagedetail = SelectQry1($Qry);
return $getimagedetail;
}
function getMemberAddetails($date,$tablename,$getmemberId) {
global $global_config;
$Qry = "select * from ".$tablename." WHERE `Posted_date` like '%".$date."%' AND ActivationStatus = 'Active' AND PublishedStatus='Active' AND memberid='".$getmemberId."' group by Posted_date Order by Ident DESC";
$getimagedetail = SelectQry1($Qry);
return $getimagedetail;
}
?>Here's the code to display it. Remember, this is just for "Frickster's ListRave Posts"
Code: Select all
<?php
$flag =0;
for($jj=0;$jj<count($getAllArray);$jj++)
for($kk=0;$kk<count($getAllArray[$jj]);$kk++) {
?>
<?php if($getAllArray[$jj][$kk]["ArrayExist"]=='Yes'&& $getAllArray[$jj][$kk]["PostURL"]!='') {
$flag =1;
?>
<?php if($getAllArray[$jj][$kk]["Titlename"]!='') { ?>
<tr>
<td valign="top" style="padding-left:10px; color:#0066ff; font-size:12px;font-style: italic;padding-bottom:-3em;text-align:left">
<b><?php echo stripslashes($getAllArray[$jj][$kk]["Titlename"]); ?></b>
</td>
</tr>
<?php } ?>
<tr>
<td valign="top" style="padding-left:10px;">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<?php
for($mn=0;$mn<count($getAllArray[$jj][$kk]);$mn++) {
if ($getAllArray[$jj][$kk][$mn]['ListArray'] == "")
continue;
?>
<?php
$getdate = substr($getAllArray[$jj][$kk][$mn]["date"], 0, 1);
if($getdate==0)
$date = str_replace("0","",$getAllArray[$jj][$kk][$mn]["date"]);
else
$date = $getAllArray[$jj][$kk][$mn]["date"];
?>Any ideas?
Dennis