We help IT Professionals succeed at work.
Get Started

Using MySQL and PHP display all the images uploaded to secured folder by customer name

Last Modified: 2015-04-04
I am using the following php and mysql code to display all the images uploaded by customers.

// Check connection
if (mysqli_connect_errno())
echo "Failed to connect to MySQL: " . mysqli_connect_error();

$result = mysqli_query($con,"SELECT * FROM `cust-results`");

echo "<table border='1'>";

while($row = mysqli_fetch_array($result))
echo "<tr>";
echo "<td>" . $row['customer-name'] . "</td>";
echo "<td><a href=uFiles/storage/files/". $row['file1'] .">" . $row['file1'] . "</a/></td>";
echo "<td><a href=uFiles/storage/files/". $row['file2'] .">" . $row['file3'] . "</a/></td>";
echo "<td><a href=uFiles/storage/files/". $row['file3'] .">" . $row['file4'] . "</a/></td>";
echo "</tr>";
echo "</table>";


Open in new window

The table as rowid, customer-name,file1,file2,file3,submitdate as columns. here are some of the rows

Customer Name File1     File2       File3
John Doe	test.jpg	test1.jpg	test2.jpg
Jane Done	C1.jpg	    kitten-1.jpg	
test test	EM_0_rzefyw.jpg	EM_0_fkddmu.jpg	EM_2.jpg
John Doe	cat_wallpaper.pdf	

Open in new window

so If I do GROUP BY customer-name only one instance of customer name is being show so John Doe shows only once which is the first row.

I am looking to display like all the images uploaded by a particular customer like

Customer Name: John Doe
display all the images

Customer Name: Jane Doe
display all the images

Watch Question
Most Valuable Expert 2020
Most Valuable Expert 2018
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE