php - How to output information in a Database specific to a user -


i have been teaching myself code past 3 months , working on project outside level of knowledge. on site we're creating, have page user creates profile , visits site see's information, information input stored in database table. trying display information specific user. right have created 3 different users , when login each 1 displays same information each user. sure question has been answered dont know how word it. below input form , .php file 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 * 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 mysql  $sql="insert $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 insert data database, displays message "successful".  if($result){ echo "successful"; echo "<br>"; echo "<a href='insert.php'>back main page</a>"; }  else { echo "error"; }  header( 'location: userprofile.php' ) ; ?>  <?php  // close connection  mysql_close(); ?> 

you want use sql select ... ... where clause. best if learn if yourself: http://www.w3schools.com/sql/sql_where.asp


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -