0

How would i upload image files to a database and then display them using

<?php
$query = "SELECT * FROM members	WHERE email='$username' AND id='$id'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
?>
<img src='<?php echo $row['pic']; ?>'>

and also, what kind of field should i use in the mysql database?
if you could help me asap that would be awesome

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Shanti C
0

first you should chekc the image path is right
i think you should print row and then check it is right

0

what kind of field should i use in the mysql database?

You can do upload images functionality in two ways:

1. You store your image in folder and then save that path in database.

2. Directly you can store image in database.

First way is always recommended. Because if you store your image in database then it will become huge and slow.

For the first way, db column data type would be BLOB,TINYBLOB,MEDIUMBLOB,LONGBLOB .
For the second way, db column data type would be varchar or text .

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.