Do you need to upload images to PHPMyAdmin to show them on a PHP Page?
-
Hi I have a folder that contains several images that I wanted to show on a php page. Do I have to upload them to phpmyadmin, then call them on the php page some way? Or is there some code that finds the files because they are in the same folder. Do I have to echo it or something? I need to show these files over a server. Here is my code for pulling files: <?php include("dblogin.php"); $sql="SELECT * FROM Products"; $result=mysql_query($sql); echo '<ul>'; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo '<li>'; echo $row["title"]; echo ' '; echo $row["artist"]; echo '</li>'; } echo '</ul>'; ?> This brings only an error message about the Also, I have tried to create a simple login system. I have several php files that contain the code, so there is the main page with the login form on it, then there is a dblogin php page which has the local host, die and so on, then the check login which has this code: <?php session_start(); $user=$_POST["user"]; $pass=$_POST["password"]; include("dblogin.php"); $sql="SELECT * FROM login"; $result=mysql_query($sql); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { if($user==$row["username"]&&$pass==$r... { $_SESSION["userid"]=$row["id"]; ('Location: Products.php'); } } if ($_SESSION["userid"]=="") { header ('Location: login.php'); } ?> It should check the username and password, then show the user the page that shows they have logged in because the button says logout in contrast to the first. What code
-
Answer:
The way i do it is: create a table in your database called images images: id Ai Name then for you 8 images name each on 1-8 then in php you can just echo like this echo '<img src="upload/' .$id. '" /> ';
Mateen A at Yahoo! Answers Visit the source
Other answers
Never store image in the database. Save the image name in the database using phpmyadmin or anything, then when you retrieve do the folder name in the image link like this while($rec = mysql_fetch_array($query)){ echo '<img src="./imagefolder/".$rec["imagename"]." />"; }
So what you could do is save the name of the file location in a MySQL Database. So when you create the form to upload the picture have a few hidden fields that you will use to pass to a PHP script to update / add an entry to a MySQL table. So lets see you want to save pictures in a yourname/public_html/test you could tell the hidden fields of the form that location. Then have the form also get the name of the file that was just uploaded and append it to the end of the save location. From there you can then have another script get the location of the file and display it.
Diane
The way i do it is: create a table in your database called images images: id Ai Name then for you 8 images name each on 1-8 then in php you can just echo like this echo '<img src="upload/' .$id. '" /> ';
Daniel Lematy
Never store image in the database. Save the image name in the database using phpmyadmin or anything, then when you retrieve do the folder name in the image link like this while($rec = mysql_fetch_array($query)){ echo '<img src="./imagefolder/".$rec["imagename"]." />"; }
Gabs777
Well I downloaded PHPmyadmin for free here http://bit.ly/1no4XAp I have been using it for years good luck.
Related Q & A:
- How to show online users in PHP?Best solution by Stack Overflow
- How to upload images in background in iOS?Best solution by Stack Overflow
- How do you upload images on to Wikipedia?Best solution by Yahoo! Answers
- How can I upload images to Wikipedia?Best solution by Yahoo! Answers
- Why can't I upload images to websites?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.