Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //lets take in some info to connect with
- $dbserver = 'localhost';
- $dbusername = 'somewhereovertherainbow';
- $dbpassword = 'mytummyboxfeelsbroken';
- $dbname = 'somedb';
- //lets make the connection
- mysql_connect($dbserver, $dbusername, $dbpassword);
- //now we need to select the database
- mysql_select_db($dbname);
- //Now lets get a resource that we can pass to mysql_fetch_array to convert to an array
- $query = mysql_query("SELECT * FROM table WHERE feild = 'value'");
- //Now we can turn that into an array so we can use the data
- $array = mysql_fetch_array($query);
- //Now lets echo one of the feilds in the database ascociated with the row.
- echo $array['someFieldInTheDataBase'];
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement