Help please with PHP...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Help please with PHP...

Post by Jonah Bron »

The row with the ID you got from $_GET['game'].

Code: Select all

// ...
$id = intval($_GET['game']);
$result = mysql_query("SELECT * FROM games_table WHERE id = $id");
// ...
makisoustas
Forum Newbie
Posts: 12
Joined: Sat Dec 18, 2010 5:11 pm

Re: Help please with PHP...

Post by makisoustas »

Jonah Bron wrote:The row with the ID you got from $_GET['game'].

Code: Select all

// ...
$id = intval($_GET['game']);
$result = mysql_query("SELECT * FROM games_table WHERE id = $id");
// ...
Apart from these must I put something in the game page? And can I use the html <a href></a> and not the php echo on the homepage?
makisoustas
Forum Newbie
Posts: 12
Joined: Sat Dec 18, 2010 5:11 pm

Re: Help please with PHP...

Post by makisoustas »

makisoustas wrote:
Jonah Bron wrote:The row with the ID you got from $_GET['game'].

Code: Select all

// ...
$id = intval($_GET['game']);
$result = mysql_query("SELECT * FROM games_table WHERE id = $id");
// ...
Apart from these must I put something in the game page? And can I use the html <a href></a> and not the php echo on the homepage?
And why is this code in the game.php page wrong?

Code: Select all

<html>

<body>
<?php
mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("games") or die(mysql_error());
$id = intval($_GET['game']);
$result = mysql_query("SELECT * FROM online WHERE id = $id");
		
		
		echo "$code";
		
	    
		
		
?>

</body>

</html>
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Help please with PHP...

Post by Jonah Bron »

mysql_query() doesn't create variables for you. Read that tutorial I gave you.
makisoustas
Forum Newbie
Posts: 12
Joined: Sat Dec 18, 2010 5:11 pm

Re: Help please with PHP...

Post by makisoustas »

Jonah Bron wrote:mysql_query() doesn't create variables for you. Read that tutorial I gave you.
Ok I'll read the tutorial to learn it but what I must put to work?
makisoustas
Forum Newbie
Posts: 12
Joined: Sat Dec 18, 2010 5:11 pm

Re: Help please with PHP...

Post by makisoustas »

Thank you very much the tutorial and you helped me very much!!! Thank you! I done it! Yeah!
Post Reply