Jump to content

Function Help


phpretard

Recommended Posts

How can I convert the code below in a funtion.

 

I then need to call it out and see the results.

 


echo"<select name='SiteArea'>";
$resultshape = mysql_query("SELECT * FROM shape");
while($row = mysql_fetch_array($resultshape))
{
$id=$row['id'];
$name=$row['name'];
echo "<option value='$name'>$name</option>";
}
echo "<select>";

 

Any help today?

 

-Anthony

Link to comment
https://forums.phpfreaks.com/topic/128174-function-help/
Share on other sites

function getResponse()

{

global $db;

echo "<select name='SiteArea'>";

$resultshape = mysql_query("SELECT * FROM shape");

while($row = mysql_fetch_array($resultshape))

{

$id=$row['id'];

$name=$row['name'];

echo "<option value='$name'>$name</option>";

}

echo "<select>";

}

 

 

call like :$res=getResponse();

Link to comment
https://forums.phpfreaks.com/topic/128174-function-help/#findComment-663888
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.