I have been teaching myself code for the past 3 months now and I am working on a project that is outside my level of knowledge. So on the site we're creating, we have a page where the user creates a profile and anyone who visits the site see's that information, the information they input is stored in a database table. What I am trying to do is only display that information for that specific user. Right now I have created three different users and when I login to each one it displays the same information for each user. I am sure this question has been answered i just dont know how to word it. Below is the input form and .php file i am currently using.
<div class="modal-body">
<form action="edit_profile.php" method="post">
<input type="text" class="form-control" id="exampleInputEmail1" placeholder="Name" name="name" required="">
<br>
<textarea class="form-control" name="about_me" rows="3" placeholder="About Me (300 Characters Max)"></textarea></textarea>
<br>
<input type="text" class="form-control" id="exampleInputEmail" placeholder="My Specialties" name="specialty" required="">
<br>
<input type="text" class="form-control" id="exampleInputEmail" placeholder="City" name="city" required="">
<br>
<input type="text" class="form-control" id="exampleInputEmail" placeholder="State" name="state" required="">
<br>
<input type="email" class="form-control" id="exampleInputEmail" placeholder="Email" name="email" required="">
<br>
<input type="text" class="form-control" id="exampleInputEmail" placeholder="Website" name="website" required="">
<br>
<input type="email" class="form-control" id="exampleInputEmail" name="facebook" placeholder="Facebook Link">
<br>
<input type="email" class="form-control" id="exampleInputEmail" name="instagram" placeholder="Instagram Link">
<br>
<input type="email" class="form-control" id="exampleInputEmail" name="twitter" placeholder="Twitter Link">
<br>
<input type="email" class="form-control" id="exampleInputEmail" name="google" placeholder="Google+ Link">
<br>
<input type="submit" class="btn btn-primary" value="submit">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Edit Profile Modal -->
<h4><strong>About Me: </strong></h4>
<?php echo $row['about_me'];?>
<h4><strong>My Specialties: </strong></h4>
<?php echo $row['specialty'];?>
<h4><strong>Location: </strong> </h4>
<?php echo $row['city'];?>, <?php echo $row['state'];?>
<h4><strong>Get Connected: </strong></h4>
<h5><strong>Email:</strong> <?php echo $row['email'];?> </h5>
<h5><strong>Website:</strong> <?php echo $row['website'];?></h5>
<h5><strong>Facebook:</strong> <?php echo $row['facebook'];?></h5>
//DATABASE CONNECT
<?php
$host="localhost";
$username="XXXXXXX";
$password="XXXXXXX";
$db_name="photographer_directory";
$tbl_name="qls3_profile";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$result = mysql_query("SELECT * FROM qls3_profile");
$row = mysql_fetch_array($result);
?>
<?php
include_once('includes/db_connect.php');
$name=$_POST['name'];
$about_me=$_POST['about_me'];
$specialty=$_POST['specialty'];
$city=$_POST['city'];
$state=$_POST['state'];
$email=$_POST['email'];
$website=$_POST['website'];
$facebook=$_POST['facebook'];
$instagram=$_POST['instagram'];
$twitter=$_POST['twitter'];
$google=$_POST['google'];
// Insert data into mysql
$sql="INSERT INTO $tbl_name(name, about_me, specialty, city, state, email, website, facebook, instagram, twitter, google)VALUES('$name', '$about_me', '$specialty', '$city', '$state', '$email', '$website', '$facebook', '$instagram', '$twitter', '$google')";
$result=mysql_query($sql);
// if successfully insert data into database, displays message "Successful".
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='insert.php'>Back to main page</a>";
}
else {
echo "ERROR";
}
header( 'Location: userprofile.php' ) ;
?>
<?php
// close connection
mysql_close();
?>