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

Recommended Answers

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. …

Jump to Post

All 2 Replies

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

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 .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.