Hi everyone,
I have a kind of news bit on my website, the news is kept in the sql database with various rows… headline, story, url etc. I want to show 4 stories from the database randomly. I can do this if i do a simple picture with text next to it and set it to count 4. But what im trying to do is have a main story, with Pic on the left story on the right, then under that the other 3 stories, pic on top with headline under it.
Where ive got to is that everything works except all 4 places are showig the same pic/story and not the 4 different ones that I would like it to.
For an example of what im trying to do see http://www.wanadoo.co.uk/ the section “on wanadoo today”
Any help would be great, and please be gentle with me )
I have included the code below.
Thanks
Lee
[code]
<?php //connect to your database ** EDIT REQUIRED HERE ** mysql_connect("XXX","XXX","XXX"); //(host, username, password)//specify database ** EDIT REQUIRED HERE **
mysql_select_db(“XXX”) or die(“Unable to select database”); //select which database we’re using
// Build SQL Query
$query = “SELECT * FROM gznews ORDER by rand() LIMIT 0, 4;”;
$numresults=mysql_query($query);
$result = mysql_query($query) or die(“X Couldn’t execute query”);
// now you can display the results returned
while ($row= mysql_fetch_array($result)) {
$headline = $row[“headline”];
$story = $row[“story”];
$url = $row[“url”];
$pic = $row[“pic”];
}?>
On the scene | |||||
|
|||||
|