Click here to Skip to main content
15,903,854 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I was doing Online Shopping project on PHP and it is working properly but product images are not getting displayed correctly. I am pasting the code and the project. Is there any problem in Backend or in Logic?
I m beginner. Please provide me the solution.
Link of project
https://www.dropbox.com/s/iq8xfe44eukwlvq/Online_Shopping.rar?dl=0
<html>

<div><br/><center><h2><font face="Lucida Handwriting" size="+1" color="#00CCFF">Casual Shirts</font></h2></center></div>
<div style="width:100%;float:left" >
<?php
include("config.php");
$dress=$_REQUEST['dress'];
$catg=$_REQUEST['catg'];
$subcatg=$_REQUEST['subcatg'];


   $sel=mysqli_query($conn,"select * from items where catg='$catg' and subcatg='$subcatg'");
   echo"<form method='post'><table border='0' align='center'><tr>";
   $n=1;
    while($arr=mysqli_fetch_array($sel))
   {
   $i=$arr['itemno'];
    if($n%4==0)
	{
	echo "<tr>";
	}
   echo "
   <td height='280' width='240' align='center'><img src='admin/itempics/$i.jpg' height='200' width='200'><br/>
  
 Item No:".$arr['itemno'].
   "<br>Price:Rs ".$arr['price'].
   "<br>Description:".$arr['desc']."
   <br><br><a href='index.php?con=12 & itemno=$i'><img src='images/MetalPlakDa5new.gif' width='70' height='20'/></a>
      <a href='index.php?con=14 & itemno=$i'><img src='images/view7.jpg' width='70' height='20'/></a>
   </td>";
  $n++;

   }
   	  echo "</tr></table>
       </form>";
	?>
<div><br>
<marquee behavior="scroll"  dir="ltr" align="absbottom"><img src="usepics/logo5.jpg" width="100" height="70"/>
<img src="usepics/logo11.jpg" width="100" height="70"/>
<img src="usepics/logo12.jpg" width="100" height="70"/><img src="usepics/logo8.jpg" width="100" height="70"/><img src="usepics/logo6.jpg" width="100" height="70"/>
<img src="usepics/logo4.jpg" width="100" height="70"/>
<img src="usepics/logo3.jpg" width="100" height="70"/>

<img src="usepics/logo13.jpg" width="100" height="70"/> <img src="usepics/logo15.jpg" width="100" height="70"/>
<img src="usepics/logo1.jpg" width="100" height="70"/> <img src="usepics/logo2.jpg" width="100" height="70"/><img src="usepics/logo14.jpg" width="100" height="70"/><img src="usepics/logo9.jpg" width="100" height="70"/>
</marquee>
</div>
	</div>
</body>
</html>


What I have tried:

I tried everything from my side but no success. Please help. I need to submit it by tomorrow.
Posted
Updated 26-Sep-19 11:28am
v2
Comments
F-ES Sitecore 26-Sep-19 7:34am    
Look at how you're injecting data from $arr into the html and compare it with how you are injecting $i
sam99eer 26-Sep-19 7:35am    
I m beginner. Please provide me the solution.

1 solution

We cannot simply solve the problem without knowing what the actual problem is; all we can do is guess, and my first guess would be that the image paths are invalid or incorrect.

What you can do is to utilizer the "inspect element" function or the "views source" feature on the broswer to see what HTML is actually being generated for the image. Then you would compare this to what the actual URLS should be, and adjust your code as needed.

While you are adjusting code; Fix the SQL Injection Vulnerability within it, it is in no way acceptable to not know how to properly write a simple SQL statement without the risk when this problem was discovered over 20 years ago.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900