search function


Posted on 16th Feb 2014 07:03 pm by admin

HI guys,

if anyone could point us in the right direction of how to do this, or provide some test code for a similar problem would be great!

Did you know?Explore Trending and Topic pages for more stories like this.
Basically, I have user profiles on my site, and I have a search by for example firstnames will list all usernames with the first name 'bob'. With this list I want to turn the output of each name to a link to their profile.

the profile page is profile-view.php and I am using the statement "select username from members where firstname = $input";

and
$num_results = mysql_num_rows($result);


$username = $row['username'];

for ($i=0; $i <$num_results; $i++)
{
$num_found = $i ;
$row = mysql_fetch_assoc($result);
echo "<a href='profile-view.php?username = $username'>{$row['username']}</a><br/>";
}

I know the <a href> wont work, but is there anyway of being able to do this, all usernames are unique across the site too thats why I thought the link it by this.

Thanks in advance
No comments posted yet

Your Answer:

Login to answer
121 Like 35 Dislike
Previous forums Next forums
Other forums

Reduce redundancies in switch functions?
Hello all! I somewhat new to PHP, and was wondering if anyone could give some suggestions on a swit

Not "Just Another" MMORPG - text based.
Hello,

I've been learning MySQL and PHP for the last 2-3 years.
Though, I've had long paus

Preventing SQL Injection
I have a question about SQL Injection, In some of our code we use this: view plaincopy to clipboa

RSS feed - FeedList for WordPress
Hi,

I'm trying to alter the FeedList plugin for WordPress so that I can click on the title of

Using real time in php
I'm very average at PHP and im looking to introduce time to something on my site.
Its a sports si

recrawling
Can anyone suggest me how may i know a page is updated before it is being downloaded, so that i can

Fetching array then reversing it
Hi, I have a simple problem, I'll try to explain it as best I can:
News entries in my database ar

Quick Syntax Question
Hi folks,

I'm getting the following error: "unexpected T_LNUMBER". I'm trying to b

Error querying database.
I get the above error when trying to insert some values to a datatable.
Here's the code :

present value of sequence?
Hi

Please help me to find out the present value of sequence?

Thanks

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash