Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Quick PHP Help


ghost's Avatar
0 0

I'm trying to set up a link that will link to an users profile by their user id and the link will say their username, so heres what i got so far…

<a href=' http://www.example.com/profile.php?lookup= ". $userdata["user_id"] ." '> ". $userdata['user_name'] ."</a>;

And it links to this URL… http://www.example.com/profile.php?lookup=". $userdata["user_id"] ." with this text… ". $userdata['user_id'] ." It doesnt change the $userdata['user_id'] to the user id and doesnt change the $userdata['user_name'] to their username.

Could someone help me out please.


ghost's Avatar
0 0

I am not sure what would be causing that. What I can tell you is I put $500 on your running PHP-Fusion :P I would have to see more of your code, chances are its just malformed PHP here is an example


echo &quot;&lt;a href=&#39;http://www.example.com/profile.php?lookup={$userdata[&#39;user_id&#39;]}&#39;&gt;{$userdata[&#39;user_name&#39;]}&lt;/a&gt;&quot;;

?&gt;```

and if you are using PHP-Fusion use this instead...

```markup&lt;?PHP

echo &quot;&lt;a href=&#39;&quot;.BASEDIR.&quot;profile.php?lookup={$userdata[&#39;user_id&#39;]}&#39;&gt;{$userdata[&#39;user_name&#39;]}&lt;/a&gt;&quot;;

?&gt;```

ghost's Avatar
0 0

You're using a database with this ?


ghost's Avatar
0 0

I dont think it would be any problem besides his code. Look at the example he showed us. He is missing quotes… You should just paste your script here.


ghost's Avatar
0 0

instead of <a href=' http://www.example.com/profile.php?lookup= ". $userdata["user_id"] ." '> ". $userdata['user_name'] ."</a>;

try this..

<a href='http://example.com/profile.php?lookup='" . $userdata['user_name'] . "'>" . $userdata['user_name'] . "</a>;

notice that you must put ' before the " after lookup= and " before ' to end the href value. that should work.


ghost's Avatar
0 0

Are you kidding chislam, that will give a broken tag. after PHP outputs that it would look like <a href='profile.php?lookup='id'>name</a>

The way he explains it, it sounds like he doesnt know PHP and he doesnt have it in PHP tags, if it was in PHP tags he would be getting blank or errors. he isnt getting eaither. I can almost gurentee you he doesnt have it in php tags and is echoing it out properly just look at my example above


ghost's Avatar
0 0

K ill try all these out, thanks for your help guys


ghost's Avatar
0 0

Nope no luck. All the quotations are messing it up. I copied both skarecrow and chislams examples and neither worked. Any other ideas??

Oh and btw, I am not using this for Black-Fire, for another site that im working on.


ghost's Avatar
0 0

Did you not here my request? You need to give me more code. Paste the whole script if you cant, all you are doing is frustrating me cause I cannot see the problem. I need to see your code.