html - Using & Filtering Data with PHP -


i'm coding simple website , i'm working on user system. coded login & register , want show saved data specific user. example: id when log-in, want receive data saved in db on own id. don't have idea how , appreciate every little help. i'm able show user id because it's saved in sessions, no other data.

everything got @ moment, script shows me whole db.

<?php  $db = new pdo( 'mysql:host=localhost;dbname=betaddicted', 'root', '' ); $sql = "select * users"; $query = $db->prepare( $sql ); $query->execute(); $results = $query->fetchall( pdo::fetch_assoc );  foreach( $results $row ){   print_r( $row ); } 

thanks guys!

<?php  $db = new pdo( 'mysql:host=localhost;dbname=betaddicted', 'root', '' ); $sql = "select * users id = ?"; $query = $db->prepare( $sql ); $query->bindvalue(1,$_session['id']); $query->execute(); $results = $query->fetchall( pdo::fetch_assoc );  foreach( $results $row ){   print_r($row ); } 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

Laravel mail error `Swift_TransportException in StreamBuffer.php line 269: Connection could not be established with host smtp.gmail.com [ #0]` -

c# SetCompatibleTextRenderingDefault must be called before the first -