PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?
//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.
?>
Last edited by Benjamin on Sat May 09, 2009 9:59 am, edited 1 time in total.
Reason:Added code tags, removed password.
<?
//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>';
echo '<p>The name link via DB ' . $namelink . '</p>';
}
?>
Last edited by Benjamin on Sun May 10, 2009 12:30 pm, edited 1 time in total.
Reason:Changed code type from text to php.
Hi, Thanks for trying to help. however, i think you did not get the problem right.
Let me put it this way: In the above code:
1. the variable $memberid value in database = 1002
2. variable $namelink in the database has the value = "<a href="http://www.xyz.com/x/?x=c&z=s&v=1801659&k=' . $memberid . '" target="_blank">Name Link</a>"