|
-
Apr 18th, 2002, 07:11 PM
#1
Thread Starter
Fanatic Member
another SQL question
ive got
PHP Code:
$sql="SELECT gamename FROM reviews WHERE id='$id'";
$result = mysql_query($sql);
while ($row = mysql_fetch_row($result)) {
$gamename=$row['gamename'];
}
$sql="SELECT * FROM reviews WHERE gamename='$gamename'";
$result = mysql_query($sql);
while ($row = mysql_fetch_row($result)) {
//outputs the results into a table
//new table for every review
}
any problems with that? i want to get one id, but pull up reviews for multiple entries for that game.
also, i'm a bit confused. suppose i have multiple reviews for the game x. wouldnt it pull up the first review it finds?
Last edited by nabeels786; Apr 18th, 2002 at 07:18 PM.
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Apr 18th, 2002, 07:21 PM
#2
PowerPoster
it might be better to assign each game a unique ID rather than relying on the game name.
Provided you use the while statement like you are, you'll get all rows that match, it's then up to you within the while statement to output each row to the browser.
It does require a little modification though in it's current form, try this
PHP Code:
$sql="SELECT gamename FROM reviews WHERE id='$id'";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
$gamename=$row['gamename'];
$reviewsql="SELECT * FROM reviews WHERE gamename='$gamename'";
$reviewresult = mysql_query($reviewsql);
while ($reviewrow = mysql_fetch_array($reviewresult)) {
//outputs the results into a table
//new table for every review
}
}
Last edited by chrisjk; Apr 18th, 2002 at 07:26 PM.
-
Apr 18th, 2002, 07:40 PM
#3
Thread Starter
Fanatic Member
hmm maybe i could do that. but the people can add games on...so id have another table which sotres the name and the id.
then have a column in the reviews for "gameid"?
which method would be more effecient? i have almost everything setup, except for editing and this one part done, with it relying on gamename
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Apr 18th, 2002, 07:42 PM
#4
Thread Starter
Fanatic Member
thinking about it now, that might be easier
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Apr 18th, 2002, 08:57 PM
#5
Thread Starter
Fanatic Member
okay, i got it working, thanks for your help
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|