PHP Coding Help Please (cant describe really)

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   PHP Coding Help Please (cant describe really)
Gareth
CZ Addict
 Codezwiz Site Donator
Gareth has been a member for over 20 year's 20 Year Member
uk.gif
Occupation: Student, Webmaster
Gender: Male
Fav. Sports Team: Liverpool FC
Status: Offline
Joined: May 29, 2004
0.08 posts per day
Posts: 587
Points: 38,220
   
PHP Coding Help Please (cant describe really) < cant describe cause i dont know whats going on haha anyway...

i have this:
<?php
require_once("file.php");
$pagename = "Games";
if (!eregi("games.php?id='$_GET[id]'", $_SERVER['REQUEST_URI'])) {
$query = "SELECT name, url, height, width FROM games WHERE id = '$_GET[id]'";
$result = mysql_query($query);
while($r=mysql_fetch_array($result))
{   
$gamename = $r["name"];
$url = $r["url"];
$height = $r["height"];
$width = $r["width"];
$content  =  "<center><b>$gamename</b></center>";
$content  .= "<embed src=\"$url\" width=\"$width\" height=\"$height\">";
}
}
if (!eregi("games.php", $_SERVER['REQUEST_URI'])) {
    $query = "SELECT id, name FROM games order by name ASC";
    $result = mysql_query($query);
$content  =  "<hr noshade size=\"1\" color=\"#808080\">";
    while($r=mysql_fetch_array($result))   
    {
$content  .= "<center><b><a href=\"games.php?id=$r[id]\">$r[name]</a></b></center>";
$content  .= "<hr noshade size=\"1\" color=\"#808080\">";
}
}
include("header.php");
include("footer.php");
?>


nevermind if you see any of my newb coding lol, i dont think it is but if you think it is you think it is, what im trying to do is so when you go to games.php it shows the bottom piece of coding, and when it has id= on the end it shows the game, this is the easiest possible way i thought to do this, because on the main page i need a list of all the games on the site to show it, which is what the second script does, but i cant seem to get it to use that when you go to games.php, the games.php?id=w/e is ok, shows game and title and everything, just the other im stuck on

any help appreciated, Thanks

Gareth icon_razz.gif



_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#2   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,440
   
icon_scratch.gif




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   re: PHP Coding Help Please (cant describe really)
Gareth
CZ Addict
 Codezwiz Site Donator
Gareth has been a member for over 20 year's 20 Year Member
uk.gif
Occupation: Student, Webmaster
Gender: Male
Fav. Sports Team: Liverpool FC
Status: Offline
Joined: May 29, 2004
0.08 posts per day
Posts: 587
Points: 38,220
   
Is it just me or do you never get what i mean, im begining to think your doing it on purpose now, lol icon_rolleyes.gif only jokin haha

I mean, so when you go to games.php it detects the url from $_SERVER['REQUEST_URI'] , which gets the url, and if it is games.php?id='$_GET[id] , get id thing replaced with the id, it shows the game of that id, which works

but i want it, so when you go to games.php , the below this:

if (!eregi("games.php", $_SERVER['REQUEST_URI'])) {

it checks if the url is games.php , and then shows the code after { and between }

but it doesn't seem to be doing that, ....
i've tried using else and else if but still no result

you get what i mean now? icon_razz.gif (just to let you know you've probably figured this but its not nuke lol)




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#4   re: PHP Coding Help Please (cant describe really)
Gareth
CZ Addict
 Codezwiz Site Donator
Gareth has been a member for over 20 year's 20 Year Member
uk.gif
Occupation: Student, Webmaster
Gender: Male
Fav. Sports Team: Liverpool FC
Status: Offline
Joined: May 29, 2004
0.08 posts per day
Posts: 587
Points: 38,220
   
nevermind icon_mrgreen.gif sorted it by updating my mad coding lol:

<?php
require_once("file.php");
$pagename = "Games";
    $query = "SELECT id, name FROM games order by name ASC";
    $result = mysql_query($query);
$content  =  "<hr noshade size=\"1\" color=\"#808080\">";
    while($r=mysql_fetch_array($result))   
    {
$content  .= "<center><b><a href=\"games.php?id=$r[id]\">$r[name]</a></b></center>";
$content  .= "<hr noshade size=\"1\" color=\"#808080\">";
}
if (!eregi("games.php?id='$_GET[id]'", $_SERVER['REQUEST_URI'])) {
$query = "SELECT name, url, height, width FROM games WHERE id = '$_GET[id]'";
$result = mysql_query($query);
while($r=mysql_fetch_array($result))
{   
$gamename = $r["name"];
$url = $r["url"];
$height = $r["height"];
$width = $r["width"];
$content  =  "<center><b>$gamename</b></center>";
$content  .= "<embed src=\"$url\" width=\"$width\" height=\"$height\">";
}
}
include("header.php");
include("footer.php");
?>




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum