<?php $Ref=$_GET["Ref"]; $conn = mysql_connect("#######"); mysql_select_db("#######",$conn); $result = mysql_query("Select FileName From ".$Ref."Where Enable = 1"); while($row = mysql_fetch_array($result)); { [COLOR="Red"] echo "<img src=".$row['FileName']." width='100'>\r";[/COLOR] } ?> Code (markup): Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/content/t/r/o/trollnest/html/bragflags/AJAX.php on line 8 ?
Tri this wai,,, <?php $Ref=$_GET['Ref']; $conn = mysql_connect("#######"); mysql_select_db("#######",$conn); $result = mysql_query("Select FileName From $Ref Where Enable = 1"); while($row = mysql_fetch_array($result)); { echo "<img src=\"$row['FileName']\" width='100'>"; } ?> PHP:
try this.... <?php $Ref=$_GET["Ref"]; $conn = mysql_connect("#######"); mysql_select_db("#######",$conn); $result = mysql_query("Select FileName From ".$Ref."Where Enable = 1"); while($row = mysql_fetch_array($result)){ echo "<img src=".$row['FileName']." width='100'>\r"; } ?> Code (markup):
One other fix: <?php $Ref=$_GET["Ref"]; $conn = mysql_connect("#######"); mysql_select_db("#######",$conn); $result = mysql_query("Select FileName From ".$Ref." Where Enable = 1"); while($row = mysql_fetch_array($result)) { echo "<img src=".$row['FileName']." width='100'>\r"; // You can use this, too: // echo "<img src=\"{$row['FileName']}\" width='100'>\r"; } ?> PHP: Why are you taking the table name from the Query String? Some serious security problems going on there.
Tri this is working 100% <?php $Ref=$_GET["Ref"]; $conn = mysql_connect("localhost","user","password"); mysql_select_db("database",$conn); $query = mysql_query("SELECT FileName from $Ref where Enable='1'"); $row = mysql_fetch_array($query); echo "<img src='$row[FileName]' width='100'>"; ?> PHP:
You should always enclose variables that are in quotation marks with { and } example: $rawr = "Hey!"; echo("Hello, the string is {$rawr}");