PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
session_start();
include ("secure/db.php");
// Get email id of the player
$email = $_SESSION['email'];
// Get all user post
$query = mysql_query("SELECT * FROM post WHERE email = '$email'");
//Calculate total number of rows
$row=mysql_num_rows($query);
$post = mysql_fetch_array($query);
$serial_number = $post['serial_number'];
$oneword = $post['oneword'];
$post = $post['post'];
// If there is no previous post
if ($row == 0){
$row = 1;
$serial_number = 1;
$oneword = "You have no words";
$post = "You have no post";
}
?>
I have two post bearing the same email ID. My codes prints one of this post twice. Some one please tell me what, where I am going wrong? I would like to print all post in the database matching the email, one after another.
Thank you for replying. Lets say, I have 10 posts submitted by a particular user. I am trying to print all the post of the user in this order
post 1
post 2
post 3
....
post 10
but my codes does this, since there are a total of 10 post of that user, it picks up the first post and prints it 10 times, like this
post 1
post 1
post 1
.....
post 1
gimpact wrote:Thank you for replying. Lets say, I have 10 posts submitted by a particular user. I am trying to print all the post of the user in this order
post 1
post 2
post 3
....
post 10
but my codes does this, since there are a total of 10 post of that user, it picks up the first post and prints it 10 times, like this
post 1
post 1
post 1
.....
post 1