Take this for example:
I will want to replace whatever is in $1 and $2 with variables retrived from the query, such as
So to cut it short, how can I replace $1, $2 with certain variables?
If the result set contains $3 then replace this with the field3 in a query. etc.
Or is there a better way to do it?
Thx
PHP:
$query = 'SELECT field1, field2 FROM thisTable ORDER BY dateline LIMIT 5';
$resultSet = '<li><a href="$1">$2</a></li>';
I will want to replace whatever is in $1 and $2 with variables retrived from the query, such as
PHP:
while(GETeachRESULT)
{
// <li><a href="$1">$2</a></li>
// replace $1 with field1 result
// replace $2 with field2 result
// Echo result: <li><a href="3">This is a link</a></li>
}
So to cut it short, how can I replace $1, $2 with certain variables?
If the result set contains $3 then replace this with the field3 in a query. etc.
Or is there a better way to do it?
Thx
Last edited: