Here's the while statement :::
while ($row = mysql_fetch_array($result))
{
echo "<li>" . $row['Product'] . "</li>" . "\n";
}
I'd like to create a function that does this and replaces whats in the brackets..
For example
rowfunc(Product);
Would return :::
echo "<li>" . $row['Product'] . "</li>" . "\n";
Thanks in advance for your time!
I'd like to just add rowfun(Product)
Right now that code isn't being used as a function, it just echos the while statement once..
Maybe I'm looking at it wrong, but it's not doing what I want..
I want to call the function in the middle of my code and display a $row[$item]
Using your code, rowfunc(Price); returns <li>Price</li>
And
while ($row = mysql_fetch_array($result))
{
rowfunc($row['Product']);
}
function rowfunc($product)
{
echo "<li>" . $row[$product] . "</li>\n";
}
Returns $row['Product'] before I even called it.
while ($row = mysql_fetch_array($result))
{
echo "<li>" . $row['Product'] . "</li>" . "\n";
}
I'd like to create a function that does this and replaces whats in the brackets..
For example
rowfunc(Product);
Would return :::
echo "<li>" . $row['Product'] . "</li>" . "\n";
Thanks in advance for your time!
I'd like to just add rowfun(Product)
Right now that code isn't being used as a function, it just echos the while statement once..
Maybe I'm looking at it wrong, but it's not doing what I want..
I want to call the function in the middle of my code and display a $row[$item]
Using your code, rowfunc(Price); returns <li>Price</li>
And
while ($row = mysql_fetch_array($result))
{
rowfunc($row['Product']);
}
function rowfunc($product)
{
echo "<li>" . $row[$product] . "</li>\n";
}
Returns $row['Product'] before I even called it.