Hello everyone,
I need some help and direction with this code. I am trying to have the same functionality that this forum has with regard to the allowable length of time the post (Or in my case, report) can be edited or deleted.
Here is what I have so far:
[PHP]foreach($report s as $report)
{
$final[] = $report;
foreach($button s as $button)
{
if($button['report_id'] == $report['report_id'])
{
$final[] = "buttons";
}
}
}[/PHP]
This outer loop gets all reports and then if the post is less than 1 hour old, places an edit and delete button in the html for that particular report. (Second loop)
I have 3 files here. The first one is the class which has the sql and returns the results. The second is the body.php file which is where I have the calls to the db and any other stuff I need. I then have the html that gets populated with the results. I simply include() the html in the body.php file and then use any variables inside the html to populate the data.
What I need is to display the results from my foreach loops. Should I use this loop in the body.php or inside of the html file? I was thinking about leaving it inside the body.php file and just using $final inside the html file. would this correct?
Also, I am having an issue with the $final array. I can't seem to get the button to show.
Thanks,
Frank
I need some help and direction with this code. I am trying to have the same functionality that this forum has with regard to the allowable length of time the post (Or in my case, report) can be edited or deleted.
Here is what I have so far:
[PHP]foreach($report s as $report)
{
$final[] = $report;
foreach($button s as $button)
{
if($button['report_id'] == $report['report_id'])
{
$final[] = "buttons";
}
}
}[/PHP]
This outer loop gets all reports and then if the post is less than 1 hour old, places an edit and delete button in the html for that particular report. (Second loop)
I have 3 files here. The first one is the class which has the sql and returns the results. The second is the body.php file which is where I have the calls to the db and any other stuff I need. I then have the html that gets populated with the results. I simply include() the html in the body.php file and then use any variables inside the html to populate the data.
What I need is to display the results from my foreach loops. Should I use this loop in the body.php or inside of the html file? I was thinking about leaving it inside the body.php file and just using $final inside the html file. would this correct?
Also, I am having an issue with the $final array. I can't seem to get the button to show.
Thanks,
Frank
Comment