April 15, 200521 yr 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.
April 15, 200521 yr 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);
April 16, 200521 yr Author 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?
April 16, 200521 yr echo $row['variable']; that should work Assuming of course that $row is a valid reference to a row in the table ;)
April 16, 200521 yr 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.
Create an account or sign in to comment