Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // SERVER VARIABLES
- // include.php
- <?php
- $server = "server name e.g. localhost"
- $database = "database name"
- $db_user = "database username"
- $db_pass = "database password"
- $table = "database table to connect to"
- ?>
- // OPENING DATABASE
- // opendb.php
- <?php
- $link = mysql_connect($server, $db_user, $db_pass)
- or die ("Could not connect to database because ".mysql_error());
- mysql_select_db($database)
- or die ("Could not select database because ".mysql_error());
- ?>
- // COLLECTING DATA
- // collect.php
- <?php
- SESSION_START();
- include("include.php");
- include("opendb.php");
- $query_find_details = "SELECT * FROM table WHERE tablerow \"". $_SESSION ['data to store']."\"";
- $result_find_details = mysql_query($query_find_details);
- $count_find_details = mysql_num_rows($result_find_details);
- $row_find_details = mysql_fetch_array($result_find_details);
- ?>
- // INSERTING DATA INTO THE DATABASE
- <?php
- SESSION_START();
- include("include.php");
- include("opendb");
- $insert = mysql_query("insert into $table values ('NULL', '".$_POST['column name']."' , '".$_POST['column name']."' , '".md5($_POST['password']."')")
- or die ("Could not insert data because ".mysql_error());
- ?>
- // ECHOING DATA FROM DATABASE
- <?php
- include("collect.php");
- echo "".$row_find_details['name']." <br> ".$row_find_details['name']." <br> ".$row_find_details['name'].";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement