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 -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -