...

View Full Version : WIERD: Unable to pass variable within URL



haresh.chugani
05-11-2009, 03:29 PM
CAN YOU BREAK THIS N HELP?

<?
$dbcnx = @mysql_connect('localhost', 'Haresh', 'REMOVED');
mysql_select_db('iwddb',$dbcnx);
$memberidresult = @mysql_query('SELECT * FROM members');

while ($memberarray = mysql_fetch_array($memberidresult))
{
$memberid = $memberarray['memberid'];
echo '<br>The member id is'; echo $memberid;
$namelink = $memberarray['name'];
echo '<br>The name link via DB is '; echo $namelink;
// value of $namelink in database = <a href="http://www.xyz.com/x/?x=c&amp;z=s&amp;v=1801659&amp;k=' . $memberid . '" target="_blank">Name Link</a>
// ERROR: $memberid value is not getting passed within $namelink
}
?>
:confused:

Fumigator
05-11-2009, 05:16 PM
The problem with the code you've provided is you aren't showing us the part that's actually causing the error, and/or, you haven't really explained what the problem is.

haresh.chugani
05-11-2009, 11:27 PM
It is simple, the error is i'm unable to pass variable within the URL which comes from a database.
<a href="http://www.xyz.com/x/?x=c&amp;z=s&amp;v=1801659&amp;k=' . $memberid . '" target="_blank">

In the link above, the variable '$memberid' value is not getting passed.
I also came to understand that WE CANNOT PASS VARIABLES TO LINKS COMING FROM DATABASE. Hence i had to rebuild the string to get this right.
Let me know if you have any other solution (or if you have'nt stilll understood the problem ;)

Fumigator
05-11-2009, 11:32 PM
You still didn't give us the code that builds the URL. You gave us part of it, but if the problem is with your syntax, anything we offer won't help you unless you show us the actual PHP code.

Point #2: find out if there is even a value in $memberid by echoing it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum