Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $requested_user = $_GET['id'];
- $db = new PDO('mysql:host=localhost;dbname=testdb;charset=utf8', 'root', 'MyPassword');
- try {
- $stmt = $db->prepare("SELECT * FROM c_userpage WHERE id = ?");
- $stmt->execute(array($requested_user));
- $mydata = $stmt->fetch();
- } catch (Exception $e) {
- //error with mysql
- die();
- }
- echo "Hello! my name is {$mydata['username']}!\n";
- echo "About Me: {$mydata['custom_data']}";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement