Hey, i'm new to PHP coding and my knowledge of php is increasing. I have a problem though.

Im currently making a flash game site and I want to make urls like "Domain.com/Play.php?gid=34823"

And when guests or users are on that page (with ID "34823"), I want it to show some information about that certain game info with that certain ID. How do I do that?

My play.php code(its not done yet!)

<?php
require_once('global_setting.php');
require('mysql.php')
mysql_select_db("my_db", $con)

// Define the information of that game
$gametitle = ???
$gamedescription = ???
$gamerating = ???
$gamereview = ???
$gameid = ???
?>

Recommended Answers

All 8 Replies

<?php
require_once('global_setting.php');
require('mysql.php')
mysql_select_db("my_db", $con)

// Define the information of that game
$gametitle = $_GET['gametitle'];
$gamedescription = $_GET['gamedescription'];
$gamerating = $_GET['gamerating '];
$gamereview = $_GET['gamereview'];
$gameid = $_GET['gameid'];
?>

what that is is when you subbmit a form with the GET option it does that so that you can get the data from the url

How about the URL? When people are on a certain id (like "domain.com/play.php?gid=18267") page, then it gets the information from that row on a database.

$gid = $_GET;
in your code then query the db for $gid

The problem is that the script is not picking up a certain from that ID. When I go to "domain.com/ViewGame?gid=34283", it doesn't pick up the gaming info from that ID in the mySQL.

Help anyone?

<?php
require('mysql.php');
mysql_select_db("ruko_fp", $con);

// Define the variables
$gid = $_GET['gid'];
$gametitle = $_GET['gametitle'];
$gamedescription = $_GET['gamedescription'];
$gamerating = $_GET['gamerating'];
$gamereview = $_GET['gamereview'];
$gameid = $_GET['gid'];
?>

TEST:

<h3><? $gametitle ?></h3>

Heres what is displayed on a certain ID:

TEST:

<game title supposed to be here>

The problem is that the script is not picking up a certain from that ID. When I go to "domain.com/ViewGame?gid=34283", it doesn't pick up the gaming info from that ID in the mySQL.

Help anyone?

<?php
require('mysql.php');
mysql_select_db("ruko_fp", $con);

// Define the variables
$gid = $_GET['gid'];
$gametitle = $_GET['gametitle'];
$gamedescription = $_GET['gamedescription'];
$gamerating = $_GET['gamerating'];
$gamereview = $_GET['gamereview'];
$gameid = $_GET['gid'];
?>

TEST:

<h3><? $gametitle ?></h3>

Heres what is displayed on a certain ID:

TEST:

<game title supposed to be here>

put like this
<?=$gametitle;?>

^ Still not working, shows the same result

You have no Select statement so of course you are getting nothing...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.