send foreach row to page

Hello everyone,

I posted and i got a message that is was already posted but i coudnt see any up so i tried again, if i happen to double post i’m sorry.

Im new to php and only been doing it for a few weeks but im making fast progress and recently finished a loginscript. Now im trying to build a CMS but i ran into a problem that i cant seem the fix.

The problem:

I got a CMS that displays all posts i got in the table. It displays title, date created, a edit button and a delete button. I’m using a foreach statement to show each row in the table.

Wanted to include a picture but it wasnt allowed.

Atm im using GET to send the article_id (which is the primary key that keeps the posts seperate from eachother) to the update page where it gets the value of GET to call the post from the database.

this is the form you see on the screenshot:
[php]

<?php foreach ($conn->query($sql) as $row) { ?> <?php } ?>
aangemaakt op Titel    
<?php echo $row['created']; ?> <?php echo $row['title']; ?> EDIT DELETE
[/php] The only thing that is done before the table is call the info from the database.

The problem im having is that when i import it into my template the page stops working because i use url manipulation to include pages in my index.php (every page i have looks like: index.php?p=page. For every folder lvl i add a ?something so i know at what level im working) making the GET function fail whenever the value changes.

Now ive been trying to find out how to get this to work and i thought i would place the row value in a session.
i have been scouting the internet trying to find out how i put this in a session but was unable to find it.

What i want to achieve is that when i press edit on post 2 (or any other post) it opens that post in the update page.

i achieved what i wanted using $_GET but i am hoping there is a other way to get the row id to my update page.

I’m hoping you can point me in the right direction.

Thanks in advance,

Feint

i noticed i had an error in my code from when i was still testing, and i apparently arent able to edit my own post so the code:

[php]

<?php foreach ($conn->query($sql) as $row) { ?> <?php } ?>
aangemaakt op Titel    
<?php echo $row['created']; ?> <?php echo $row['title']; ?> EDIT DELETE

[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service