I am trying to generate 300 link in serial with php very confused plz help what im missing.
$i = 0;
$c = 300;
do {
$i++;
echo "<a href=http://deewayz.in/user/" . $i . "/><img src="http://deewayz.in/images/user/" . $i . "/profile_q.jpg" border=0></a>";
} while ($c > $i);
out put i want is:
<a href=http://deewayz.in/user/1/>
<img src="http://deewayz.in/images/user/1/profile_q.jpg" border=0></a>
<a href=http://deewayz.in/user/2/>
<img src="http://deewayz.in/images/user/2/profile_q.jpg" border=0></a>
so on....
Error:
Parse error: syntax error, unexpected 'http' (T_STRING), expecting ',' or ';'
echo "<a href='http://deewayz.in/user/ $i/'><img src='http://deewayz.in/images/user/$i/profile_q.jpg' border=0></a>";
php parses variables automatically within double quotes
You have to escape quotes that are inside quotes:
echo "<a href=http://deewayz.in/user/" . $i . "/><img src=\"http://deewayz.in/images/user/" . $i . "/profile_q.jpg\" border=0></a>";
First I would chaange what you have as your loop to this
do {
$i++;
echo "<a href='http://deewayz.in/user/" . $i . "'/><img src='http://deewayz.in/images/user/" . $i . "/profile_q.jpg' border=0></a>";
} while ($c > $v);