![]() |
|
|
||||
|
||||
Tools:
Apache WebServer PHP MySQL Introduction: In this tutorial, you will learn my way of connecting to a database. Also you will be able to INSERT, SELECT, and INTERACT with the database. db.php [php] <? $db_host = "localhost"; $db_uname = "root"; $db_upass = ""; $db_name = "db"; $connect = mysql_connect($db_host, $db_uname, $db_upass); if(!$connect) { die("Could not connect to MySQL"); } $s_db = mysql_select_db ($db_name); if($s_db) { die("Could not select database"); } ?> [/php] What we just created is the backend code so you are able to connect to the database and create a open connection. Now here we will process the SQL command to get the data from the DB. process.php [php] <?php require_once("db.php"); $query = "SELECT * FROM my_table"; if(!$result = mysql_query ($query)) { die("Query failed"); } $line = mysql_fetch_array($result); ?> <pre> <?=print_r($line);?> </pre> [/php] Now that should display the database information from the table you select. I will update this tutorial with a proper information.
__________________
Xbox 360 - 2 Games - 2 Controllers - 120GB Elite - Dead PS3 - 23 BD Games - 13 PSN Games - 9 Controllers - 320GB - Alive Wii - 6 Games - 4 Wiimotes - Alive PC - Overkill - 3DMark06 [15316]- God like :] PC - New Build - 3DMark06 [32092] ![]() Gaming Generations | XnogarD Production - Soon!!! |
|
|
|||
|
|||
|
awesome
man. u should be proud. |
|
|
|||
|
|||
|
okay i might sound stupid....but, how do i use that code?
|
|
|
||||
|
||||
|
To use this, you need to have a PHP enabled server, you can download my Web Server installer in our download section. It will install everything you need to start a web server, and to start doing your own web programming aswell.
__________________
Xbox 360 - 2 Games - 2 Controllers - 120GB Elite - Dead PS3 - 23 BD Games - 13 PSN Games - 9 Controllers - 320GB - Alive Wii - 6 Games - 4 Wiimotes - Alive PC - Overkill - 3DMark06 [15316]- God like :] PC - New Build - 3DMark06 [32092] ![]() Gaming Generations | XnogarD Production - Soon!!! |
|
|
|||
|
|||
|
Nice Job Good Creation
|
|
|
|||
|
|||
|
Is the script you just provided used on this site for user accounts and passwords
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|