|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Need some simple help
My data base is like setup like so:
database - videogames table - games gameID | title | genre | platform | summary | rating | review I have this code that displays the GameID | title| Genre | platform in table using this code. <?php /* This should show off all the tables with games included */ echo "<h2>Video games you have</h2>n" . "<table cellspacing=15>n" . "<tr><td colspan=5><hr></td></tr>n"; while ($row = mysql_fetch_array($query)) { extract($row); echo "<tr>n" ."<td>$gameID</td>n" ."<td>$title</td>n" ."<td>$genre</td>n" ."<td>$platform</td>n" ."<td><a href=?show=$gameID>review</a></td>n" ."</tr>n"; echo "<tr><td colspan=5><hr></td></tr>n"; } echo "</table>n"; ?> Now what I want to be able to do is to make the review text or any link go to the reivew part of the database without showing the other info. I would like also maybe be able to change the other links to show things according to platform | genre etc.. But I want to start off being able t show off the review. I know this is similar to a weblog but in the books I have it's all date based and I want it ot be ID based. |
|
#2
|
|||
|
|||
|
RE: Need some simple help
u want something like this?
http://gmflp.l33t.ca/album.php |
|
#3
|
|||
|
|||
|
RE: Need some simple help
Yeah similar to that..
|
|
#4
|
|||||
|
|||||
|
RE: Need some simple help
First of all you might be better off if you had a ssecond table called review with three fields id - gameid - review, but this is a different matter.
To do what you are trying to do all you need to do is put your main content in an if statement php Code:
|
|
#5
|
|||
|
|||
|
RE: Need some simple help
I'm still not understanding it. Let me play with it to see. I'm sure I'm just a moron. Oh yea and I created another table like you suggested.
|
|
#6
|
||||
|
||||
|
RE: Need some simple help
What I was trying to show you was how to display the review once a link has been clicked. The first time you go to the page $show is NULL and/or not set so the code will display your table full of games. Once you click a link the link would set $show and the main content would not be displayed only the review section. The if statement just determines what content to display. Either the main content or a specific review depending on whether or not show is set.
If you have a second table then you would bring back the review with a different query. Hope this helps, B |
|
#7
|
|||
|
|||
|
RE: Need some simple help
I got a better understanding. I'll try it out..
|
|
#8
|
|||||
|
|||||
|
RE: Need some simple help
ok this is what I did. Using the old 1 table method i coded it like so:
php Code:
Is this correct? My understanding is this. If the Show value isn't set then it should set it so it makes the link. Then after you click it it should have the value set then go to the else portion in the new page displaying the review part of the table as request. I have the actual queris in a conifg file separate but I tried both ways and recieved the same result. Which was when you click the link it displays the tables and everything correctly (in the source code) just no text comes up. So pretty much a blank page. Any input? |
|
#9
|
||||
|
||||
|
RE: Need some simple help
You are calling the variable $show in the URL but looking for the variable $gameid in the SQL. Change the SQL to $sql2 = "SELECT review FROM games WHERE gameID = '$show'";
|
|
#10
|
|||
|
|||
|
RE: Need some simple help
I had figured it out before. I do have another question? Why is it better, to have 2 tables as opposited to 1? What are the benefits?
|
|
#11
|
|||
|
|||
|
RE: Need some simple help
i understand that, just want hear about people that have had full on experience with MySQL. Sometimes books can be not too practical
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Need some simple help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|