help with variable
Posted on
16th Feb 2014 07:03 pm by
admin
I've got a problem, i want to echo some images depending on the $id, however for me to get that id i have to extract it from a query. So i've done that, but i want to extract all id's (not just 1), so i can echo images for all them ids (not just echo the images based on 1 id), so I did a while() loop, however doesnt seem to work
My code:
Did you know?Explore Trending and Topic pages for more stories like this.
Code: <?php
include "connect.php";
$user = "Peter";
$sql = mysql_query("select * from game_main where user = '$user'");
while($row = mysql_fetch_array($sql)){
$id = $row['id'];
}
//do i have to do foreach $id as something??
$views = mysql_num_rows(mysql_query("SELECT userip FROM game_views WHERE sub_id = '$id'"));
$sql3 = mysql_query("select monthstamp from game_monthlyfeatured where first = '$id'");
$num3 = mysql_num_rows($sql3);
$sql4 = mysql_query("select weekstamp from game_weeklyfeatured where first = '$id'");
$num4 = mysql_num_rows($sql4);
$sql5 = mysql_query("select daystamp from game_dailyfeatured where first = '$id'");
$num5 = mysql_num_rows($sql5);
$sql6 = mysql_query("select date from site_featured where id = '$id'");
$num6 = mysql_num_rows($sql6);
if($num3 == 1) {
?>
<img src="../images2/game/game_awards_1monthly.gif" width="20" height="20" />
<?php
}
if($num4 == 1) {
?>
<img src="../images2/game/game_awards_topweekly.gif" width="20" height="20" />
<?php
}
if($num5 == 1) {
?>
<img src="../images2/game/game_awards_topdaily.gif" width="20" height="20" />
<?php
}
if ($views > 1000) {
?>
<img src="../images2/game/game_awards_1000views.gif" width="20" height="20" />
<?php
}
if ($views > 25000) {
?>
<img src="../images2/game/game_awards_25000views.gif" width="20" height="20" />
<?php
}
if ($num6 > 0) {
?>
<img src="../images2/game/game_awards_modpick.png" width="16" height="16" />
<?php
}
?>
Hope someone can help, thanks
No comments posted yet
Your Answer:
Login to answer
140
26
Other forums
Multiple PHP errors when clicking a link..and..removing a ghost..
Hi - I have 2 problems with a new website - homeswapvacations.com, which I need help solving.
Splitting Attributes
SQL> SELECT I_NAME, substr(I_NAME,1,instr(I_NAME,'O')) "First part",
substr(I_NAME, IN
send message to the java application
Oracle 10g with Windows platform.
I have a java application that periodically pings the d
dynamic table with forms
I have a table that is populated with mysql data and in teh first column there is a raido button tha
Select all entries from database that include a phrase
I have a database of clubs - one of the categories is meeting time and place
I would like to have
add text and number image
hi guys ..
ok see i want the user to add their name and pick a number then click get it and i
unserialize help, getting errors
hi all ,
I got a form with 6 fields (2 input and 4 select box), when the page loads one block is
Log $_POST
How would i log submits on a form, by everyone? I want to then echo the number of submissions.
Any help with my email script?
I have an email script, I have not tested it, although someone tested it for me and said it worked f
quotes changing
hi all
in my content
opening quotes " changes to “
close qu