Phyco1312 Posted April 15, 2005 Share Posted April 15, 2005 Quick question for people out there. I'm more of a script kiddie than I am a database programmer, but I know my share of MySQL coding. Here's my question: If I create the table in database "theftus1_fire", how would I define and bring up a variable on a php page without comprimising the database username, and password? I'm trying to make my website completely MySQL and I want to be able to insert data into the MySQL database/table and have it brought up on the website without typing it out into HTML (HTML text, etc.) Thanks to whoever looks into this. Link to comment Share on other sites More sharing options...
x76 Posted April 15, 2005 Share Posted April 15, 2005 You'll have to type the username into plain text but if you do it in a PHP file there's less security risk since PHP isn't viewable like HTML. //config.php <?php $user = 'username'; $pass = 'password'; $db = 'database_name'; $table = 'table_name'; $server = 'localhost'; ?> <?php include('config.php'); mysql_connect($server,$user,$pass) or die('Make sure your server, username and password are correct.'); //rest of code here That should be sufficient. mysql_select_db($db); Link to comment Share on other sites More sharing options...
Phyco1312 Posted April 16, 2005 Author Share Posted April 16, 2005 I know the code to connect to a database, but how do you include variables listed in a table, or just a table alone. Is there an echo or "longtext.vcar" code for it to echo a variable? Link to comment Share on other sites More sharing options...
x76 Posted April 16, 2005 Share Posted April 16, 2005 echo $row['variable']; that should work Link to comment Share on other sites More sharing options...
Hannibal Posted April 16, 2005 Share Posted April 16, 2005 echo $row['variable']; that should work Assuming of course that $row is a valid reference to a row in the table ;) Link to comment Share on other sites More sharing options...
Pyro Posted April 16, 2005 Share Posted April 16, 2005 http://www.freewebmasterhelp.com/tutorials/phpmysql/1 I suggest this guide. It explains inserting and displaying information from a database in detail, and it easy to understand. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now