Hello,
i am connecting to a database and then bring the ten most popular images to show them to the client,
but there are problems with echoing the results to the client. It returns errors similar to this one “Parse error: parse error, expecting `T_STRING”.
I suspect there might be problems in the way i use echo, using “” or ‘’,the use of integer variables as strings
and the paths in the code bellow, any help is appreciated.Also please be a bit extensive i would like to understand the solution except of solving the problem.
[php]<?php
$con=mysql_connect(“localhost”,“root”,"");
if(!$con)
die(‘Could not connect’.mysql_error());
mysql_select_db(“user_details”,$con);
$result=mysql_query(“SELECT * FROM image WHERE type=‘public’ ORDER BY views DESC “)
or die(mysql_error());
$i=0;
while(($row = mysql_fetch_array($result))&&(i<10)){
$width=(i%5)*150;
$height=(i/5)*150;
$imgName=”\archive”.$row[‘title’];
echo"<div
style=" top: “$height”; left: “$width”; position: absolute; z-index: 1; visibility: show; ">
";
$i++;
}
[/php]