Jump to content

php script not collecting mysql info


Ruko

Recommended Posts

So im testing and making an arcade system that MAY be included in the ezboards system. Im making a "GameInfo" Page and im testing things out and see if theres errors.

 

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>

Link to comment
https://forums.phpfreaks.com/topic/198816-php-script-not-collecting-mysql-info/
Share on other sites

You're not performing any checks on the database. You're trying to get all the information out of the URL with GET ...

 

You need to do a database query. The only thing you want to use GET for is to get the game ID out of the url...

 

sql="SELECT * FROM games WHERE gameid='$_GET['gameid']";

$result=mysql_query($sql, $con);

while ($row=mysql_fetch_array($result))

{

echo "Title: ".$row['gameTitle']."<br>";

echo "Genre: ".$row['genre']."<br>";

}

 

...etc

 

Parse error: syntax error, unexpected '=' in /home/ruko/public_html/ViewGame.php on line 4

<?php
require('mysql.php');
mysql_select_db("ruko_fp", $con);
sql="SELECT * FROM games WHERE gameid='$_GET['gameid']";
$result=mysql_query($sql, $con);
while ($row=mysql_fetch_array($result))
{
echo "Title: ".$row['gametitle']."<br>";
echo "Genre: ""; 
}

 

oh its fine mate :) I got a hold of it now :)

 

Scratch that, im currently writing my SQL code and now im getting confused. >.< It makes me wanna pull my hair out. Maybe someone can give me part of that code pls. I have a REALLY hard time writing out my codes properly.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.