Page 1 of 1

Retrieving mySQL data with PHP, Multiple pages with one page

Posted: Thu Feb 12, 2009 10:51 am
by tomsace
Hi,

Its hard to explain, but...
I have started my own online games website. I wish to load hundreds of different games but all powered from just one php file. I started the same online games website last year without mysql and I ended up with hundreds of php files each for a different game. Now I want to load it from just one.

I understand that I can load data from the mySQL database with a code along the lines of:

Code: Select all

<?php
include 'config.php';
include 'opendb.php';
 
$query  = "SELECT name, subject, message FROM contact";
$result = mysql_query($query);
 
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
    echo "Name :{$row['name']} <br>" .
         "Subject : {$row['subject']} <br>" .
         "Message : {$row['message']} <br><br>";
}
 
include 'closedb.php';
?>
 
But how can I load 100's of games with this script? I have setup my mySQL database to locate each game with a unique ID for each game (e.g. 1, 2, 3, 4, etc...) so I suppose that I can assign the data to be loaded by its ID.

Thanks,
Tom.

Re: Retrieving mySQL data with PHP, Multiple pages with one page

Posted: Thu Feb 12, 2009 11:34 am
by killingbegin
i think you must explain better what you want
i dont know what you mean dude

Re: Retrieving mySQL data with PHP, Multiple pages with one page

Posted: Thu Feb 12, 2009 3:03 pm
by Dynex
Try:

Code: Select all

$query  = "SELECT * FROM `contact`"; 
or/and

Code: Select all

echo "Name :" . $row['name'] . " <br>" .
echo "Subject : " . $row['subject'] . " <br>" .
echo "Message : " . $row['message'] . " <br>
<br>";
assuming your table is `contact`

Re: Retrieving mySQL data with PHP, Multiple pages with one page

Posted: Thu Feb 12, 2009 5:46 pm
by tomsace
Hi,

Ok what I want to do is run multiple pages from one php file, but not including other pages but incluiding mysql data...