Dynadot — .com Registration $8.99

Mysql Database display

Spaceship Spaceship
Watch

NetworkTown.Net

Account Closed
Impact
2
Hi

I have a database the database name is arcade and the table name is games

in this table i have:

Field

Name
Info
image
Swf
Width
Height
Plays

and so on... what i want to do is display the Name on my site how would i do this? what code do i use to display the info in the DB. i want it to select random ones from the DB

then i have the same Fields bit with a extra one called CatId now i want to be able to select which CatId to get the infos from.

Thank you.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
0
•••
Modified example from Dan's link.

PHP:
<?php
// Connecting, selecting database
$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')
   or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('my_database') or die('Could not select database');

// Performing SQL query
$query = 'SELECT `Name` FROM `arcade`';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());

// Printing results in HTML
echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
   echo "\t<tr>\n";
   foreach ($line as $col_value) {
       echo "\t\t<td>$col_value</td>\n";
   }
   echo "\t</tr>\n";
}
echo "</table>\n";

// Free resultset
mysql_free_result($result);

// Closing connection
mysql_close($link);
?>
 
0
•••
Thank you i got the hang of it now.
 
0
•••

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back