PHP loop


Posted on 16th Feb 2014 07:03 pm by admin

Okay so I have several "articles" stored in a mysql database and am attempting to echo those onto a PHP page.
so on index.php I have
Code: <?php article_layout();?> (yes there is a require one to get the function but that works)

then page_layout is this
Code: <?php
function article_layout(){
$uri = $_GET['uri'];
if($uri == ""){
$uri = "home";
} else {
$uri = $uri;
};
$mysqli = db_connect();
$qry = "SELECT * FROM `articles` WHERE `uri`='$uri'";
$result = $mysqli->query($qry, MYSQLI_STORE_RESULT);
while ($row = mysqli_fetch_array($result)){
$layout = $row['layout'];
require_once('http://'.$_SERVER['HTTP_HOST'].'/themes/default/layouts/'.$layout.'.php?uri='.$uri.'');
};
};?>
which calls the relevant layout page (so the contents it layed out correctly)
now my problem is how to make this cope with more than one article, so far it is only display one article even if it should be display two. Any ideas?

No comments posted yet

Your Answer:

Login to answer
97 Like 22 Dislike
Previous forums Next forums
Other forums

Save username into DB
OkaY so I got my blog to actually save the posts and whatever, all I need now is for it to keep the

date function help
i need help with date function

Code: [Select]<!DOCTYPE HTML PUBLIC "-//W3C//DTD H

Error: SQL Syntax; Line 1
Code:

<?php require "global_settings.php"; ?>
<title&g

Problem with an browser game.
Hello,i just joined that great forum and i got php prob,its kinda freaky...anyway i got browser game

Comment Mod System Effects all rows...
Sorry if its confusing but here is whats going on: I have a table in a database called comments and

quick question about System Change Number(SCN) in FlashBack Query topic
i know tht we can get the SCN of the database using flashback concept as follows

SQL>

Scene graph using Direct3D?
There are several C++ scene graph based packages available for OpenGl, like say OSG,

http://w

Move array index to end
Hey guys,
Quick question:

I have an array that looks like this:
Code: [Select]$var =

i want run some web server under the ip sharer
hello i want run some web server under the ip sharer
my ip is floating ip but it doesnt matter

mail()
Hi all. I have a problem with emails. I am trying to set up a mail system where customers can subscr

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash