I have got a problem on where to place the looping array into this code, it is for the result of the final query.
<?php
$link = mysql_connect("HOSTNAME","USERNAME", "PASSWORD"); //dont forget the database name on line 9
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully<br>';
mysql_select_db("DATABASE") or die("Could not select database");
echo 'Connected to Database<br>';
/*
select our contact list
*/
$friend = mysql_query("SELECT `contacts` FROM users WHERE `id` = '1'");
while ($row = mysql_fetch_array($friend)) {
$a = $row['contacts'];
/*
convert the data so it can be read by the script
*/
$originalarray = unserialize($a);
$myarray = $originalarray;
/*
get our friends id from the table
*/
foreach( $myarray["Friends"] as $contact){
$select = mysql_query("SELECT `id` FROM users WHERE `id` = '$contact'");
while ($row = mysql_fetch_array($select)) {
$id= $row['id'];
$FriendEventsSelect = mysql_query("SELECT `id`,`date`,`title` FROM `events` WHERE `display`='shared' AND `user`='$contact' ORDER BY `date` ASC LIMIT 5 ");
while ($FriendEventRow = myF($FriendEventsSelect)) {
$FriendEventsReplacementArray[$i]["friendevent.title"] = _fnc("strtrim", = $FriendEventRow["title"];
$FriendEventsReplacementArray[$i]["friendevent.date"] = date($CONF["LOCALE_SHORT_DATE"], $FriendEventRow["date"]);
$FriendEventsReplacementArray[$i]["friendevent.id"] = $FriendEventRow["id"];
}
}
}
}
}
/*
Assign the array to the loop engine
*/
if (isset($FriendEventsReplacementArray))
{
$tpl->Loop("NextFriendEvents", $FriendEventsReplacementArray)
$tpl -> Zone("FriendEvents", "enabled")
}
?>
I need the results of the final query to be passed through this piece of code but the placement is wrong i think. I have run this as a seperate script but when i add the code below everything stops.
while ($FriendEventRow = myF($FriendEventsSelect)) {
$FriendEventsReplacementArray[$i]["friendevent.title"] = _fnc("strtrim", = $FriendEventRow["title"];
$FriendEventsReplacementArray[$i]["friendevent.date"] = date($CONF["LOCALE_SHORT_DATE"], $FriendEventRow["date"]);
$FriendEventsReplacementArray[$i]["friendevent.id"] = $FriendEventRow["id"];
}
}
}
}
}
/*
Assign the array to the loop engine
*/
if (isset($FriendEventsReplacementArray))
{
$tpl->Loop("NextFriendEvents", $FriendEventsReplacementArray)
$tpl -> Zone("FriendEvents", "enabled")
}
?>
thanks in advance.