NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Mysql Database display

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 08-30-2006, 04:18 PM THREAD STARTER               #1 (permalink)
Account Closed
Join Date: Oct 2005
Location: United Kingdom
Posts: 1,554
NetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really nice
 



Mysql Database display


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.
NetworkTown.Net is offline  
Old 08-30-2006, 05:03 PM   #2 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,796
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
 


Autism Autism Autism Autism Autism Autism Autism
http://us3.php.net/mysql
Dan is offline  
Old 08-30-2006, 07:51 PM   #3 (permalink)
NamePros Regular
 
Tree's Avatar
Join Date: Feb 2006
Location: Atlanta, GA, USA
Posts: 335
Tree will become famous soon enoughTree will become famous soon enough
 



Modified example from Dan's link.

PHP Code:
<?php
????: NamePros.com http://www.namepros.com/programming/233190-mysql-database-display.html
// 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";
????: NamePros.com http://www.namepros.com/showthread.php?t=233190
while (
$line mysql_fetch_array($resultMYSQL_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);
?>
Tree is offline  
Old 08-31-2006, 02:50 AM THREAD STARTER               #4 (permalink)
Account Closed
Join Date: Oct 2005
Location: United Kingdom
Posts: 1,554
NetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really nice
 



Thank you i got the hang of it now.
NetworkTown.Net is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 09:19 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger