Jump to content


Photo

sql query between echo


  • Please log in to reply
2 replies to this topic

#1 bob_the _builder

bob_the _builder
  • Members
  • PipPipPip
  • Advanced Member
  • 207 posts

Posted 27 September 2006 - 10:03 PM

Hi,

Is there a way to place an sql query between:

echo 'some html here';

without breaking the echo and starting it again?

Its to populate a list/menu fom the db which is within echo.


Thanks

#2 alpine

alpine
  • Members
  • PipPipPip
  • Advanced Member
  • 756 posts
  • LocationNorway

Posted 27 September 2006 - 10:18 PM

do the query first and display the desired result within, like

<?php

while($r=mysql_fetch_array($query))
{
  $option .="<option value".$r['xx'].">".$r['xxx']."</option>";
}

echo <<<__HTML

<select name="x">
$option
</select>

__HTML;

?>


#3 bob_the _builder

bob_the _builder
  • Members
  • PipPipPip
  • Advanced Member
  • 207 posts

Posted 28 September 2006 - 12:50 AM

That did the trick

Thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users