Page 1 of 1

Can you display variable within a href="$variable"

Posted: Tue Feb 17, 2004 5:59 pm
by mikegotnaild
Im getting 'Parse error: parse error, expecting `','' or `';'' in /www/n/naild/htdocs/localmm/modules/Bands_Showcase/index.php on line 36' And its because i put a variable inside a link. How could i do this? Heres my code: (I would also like to know how to list code in these forums with the highlited colors like i see here and there)

Code: Select all

<?

$query="SELECT * FROM nuke_bands";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

$i=0;
while ($i < $num) &#123;

$bandname=mysql_result($result,$i,"band_name");
$description=mysql_result($result,$i,"description");
$history=mysql_result($result,$i,"history");
$influences=mysql_result($result,$i,"influences");
$genra=mysql_result($result,$i,"genra");
$email=mysql_result($result,$i,"email");
$website=mysql_result($result,$i,"website");
?>

<br>Click&nbsp <a href="modules.php?name=Bands_Showcase&file=form">HERE</a>&nbsp to submit a band, upload your mp3 and image.<br>
<br>

<?
echo "<b>$bandname</b><br><br><b>Description:</b> $description<br><br><b>History:</b> $history<br><br><b>Influences:</b> $influences<br><br><b>E-mail:</b> $email<br><br><b>Website:</b> <a href="$website">$website</a><br><br><hr><br>";

++$i;
&#125;
?>

Posted: Tue Feb 17, 2004 6:07 pm
by John Cartwright
Only error I got was

Code: Select all

<?php
echo "<b>$bandname</b><br><br><b>Description:</b> $description<br><br><b>History:</b> $history<br><br><b>Influences:</b> $influences<br><br><b>E-mail:</b> $email<br><br><b>Website:</b> <a href="$website">$website</a><br><br><hr><br>";
?>
to

Code: Select all

<?php
echo "<b>$bandname</b><br><br><b>Description:</b> $description<br><br><b>History:</b> $history<br><br><b>Influences:</b> $influences<br><br><b>E-mail:</b> $email<br><br><b>Website:</b> <a href="$website">$website</a><br><br><hr><br>";



?>
Get get the syntax.. simply instead of using the code button use the php button

Posted: Tue Feb 17, 2004 6:09 pm
by mikegotnaild
OH this shows how newb i am lol. Slashes

Posted: Tue Feb 17, 2004 6:09 pm
by mikegotnaild
thanks

Posted: Tue Feb 17, 2004 6:10 pm
by John Cartwright
np