Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("Content-type: image/jpeg");
- $host="localhost"; // Host name
- $username="root"; // Mysql username
- $password=""; // Mysql password
- $db_name="fb"; // Database name
- $tbl_name="users"; // Table name
- mysql_connect("$host", "$username", "$password")or die("cannot connect");
- mysql_select_db("$db_name")or die("cannot select DB");
- error_reporting(E_ALL);
- $regemail = $_SESSION['email'];
- $sql = "SELECT image
- FROM pictures JOIN users ON pictures.image_name = users.id AND
- users.id = (SELECT id FROM users WHERE email = '$regemail') LIMIT 1; ";//$regemail
- // the result of the query
- $result = mysql_query("$sql");//die("Invalid query: " . mysql_error());
- if(!$result){
- echo '<a href="#">Upload Image</a>';echo $result;
- }else{
- // echo mysql_result($result, 0);
- $row = mysql_fetch_assoc($result);
- $imagebytes = $row['imgdata'];
- print $imagebytes;
- // echo mysql_result($result, 0);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement