Help with simple PHP problem...

Status
Not open for further replies.
I'm trying to display an image in a table and I don't have the syntax correct in the <img> tag:
Code:
while($row = mysql_fetch_array($querymodelinfo))
		
		{
		$UserID = $row['UserID'];
		
		echo "<br>
		<table>
		 	<tr>
		 		<td>
		 		<b>Photo1:</b><img src='show.php?UserID=<?php echo $UserID ?>'>
		 		</td>
		 	</tr>
		 </table>
		 <br>
		 <a href='editprofile.php'>Edit your profile</a>";
		}

The output URL comes out as: http://localhost:8888/BM/loginsession/s ... 201%20?%3E

What the hell am I doing wrong? My syntax sucks.

Thanks for your help.
 
I have no idea. There's absolutely no reason to break out of a double-quoted string in PHP unless you need to add the output of a function or method.

That said, I've gotten in the habit of enclosing variables in strings in curly braces {}, so they read "{$variable}" as that fully delineates the variable name instead of letting PHP guess. It also means you can properly concatenate words with no spaces with out breaking out of the quoted string.

Code:
echo "I had 6 $beers.";    // Will reference the variable $beers
echo "I had 6 {$beer}s.";  // Will reference the variable $beer with an s immediately after it.
 
Status
Not open for further replies.