Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation WIERD: Unable to pass variable within URL

    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
    }
    ?>

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    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.

  • #3
    New to the CF scene
    Join Date
    May 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •