Passing Variable within URL coming from SQL DB
Posted: Sat May 09, 2009 5:29 am
Request help to pass variable in URL coming from database.... it behaves differently.
Sample below. Your help will be highly appreciated. Tx.
Sample below. Your help will be highly appreciated. Tx.
Code: Select all
<?
//Database Connection
$dbcnx = @mysql_connect('localhost', 'Haresh', 'REMOVED');
mysql_select_db('iwddb',$dbcnx);
$memberidresult = @mysql_query('SELECT * FROM members');
//db hase only 2 fields, memberid & name
while ($memberarray = mysql_fetch_array($memberidresult))
{
$memberid = $memberarray['memberid'];
echo '<p>The member id is ' . $memberid . '</p>';
$namelink = $memberarray['name'];
echo '<p>
//actual value of namelink in database =
<a href="http://www.xyz.com/x/?x=c&z=s&v=1801659&k=' . $memberid . '" target="_blank">Name Link</a>
// end of actual value of name link in database
</p>';
}
//Till here it is fine, we are able to pass $memberid's actual VALUE in the url
// ERROR STARTS HERE when we insert the above actual link in the database as above & call it from there.
echo '<p>The name link via DB ' . $namelink . '</p>';
// ERROR: When $namelink is called via DB, $memberid is not getting passed and is called as (' . $memberid . ') instead of its value
// pls help. Thanks.
?>