i have a table full of data in the form of
value_id value_name value_timestamp
The first 5 columns have the same value name (with different id’s and timestamps)
how would i go about producing a conditional statement that went through and only displayed the first name with the same value. Ie i only want to show row 1, not 5 rows. then i want to display the 6th row’s name as its different
Ive had a go but with no luck –
$sql = mysql_query("SELECT * FROM Films_Info")
or die(mysql_error());
while ($row = mysql_fetch_assoc($sql)) {
$name = $row['value_name'];
if ("same as previous"($name)) {
echo $name;
}
else
{
//do nothing
}
}
Thanks guys
Table results –
film_id film_name film_date
1 example Thursday
2 example1 Thursday
3 example3 Thursday
4 example4 Friday
So i want to display film_id 1 and its date, but skip 2 and 3 (film_id) as there the same, then display example 4.
Change your sql statement to be specific.
$sql = mysql_query("SELECT * FROM Films_Info WHERE name='{$name}'") or die(mysql_error());UPDATE: After some chat discussion, this is what you should do:
This will group your same-date movies into an array for you to manipulate.