this is my html code in which i want to get info from the server and insert it into the list items and show it in the browser, using loop .so i am using php but this code is not working for me . please somebody help me !!!!!!!!!

<body>

<div class="infiniteCarousel">
<div class="wrapper" style="overflow: hidden;">
<ul>
<?php
// Connects to your Database 
 mysql_connect("localhost", "root", "") or die(mysql_error()) ; 
 mysql_select_db("a") or die(mysql_error()) ; 
 
 //Retrieves data from MySQL 
 $data = mysql_query("SELECT * FROM employees") or die(mysql_error()); 
 //Puts it into an array 
 while($info = mysql_fetch_array( $data )) 
 { 
?>
<li > 
<?php 
 Echo "<img width="240" height="240" alt="Wonky Buildings"  src=images/".$info

['photo'] ."> ";  // this part is not working 
?>

</li>
<?php   } ?>

</ul>
</div>
<a class="arrow back">&lt;</a>
<a class="arrow forward">&gt;</a>
</div>


</body>

i am getting this syntax error

Parse error: syntax error, unexpected T_LNUMBER, expecting ',' or ';'

Recommended Answers

All 2 Replies

The problem is related to the double quotes, rewrite that line 19:

$img = $info['photo'];
echo '<img width="240" height="240" alt="Wonky Buildings"  src="images/'. $img .'>';

Or:

echo "<img width=\"240\" height=\"240\" alt=\"Wonky Buildings\" src=\"images/".$img ."\">";

Or:

echo "<img width='240' height='240' alt='Wonky Buildings' src='images/$img'>";

bye

thanks :)

Be a part of the DaniWeb community

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