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!

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

How to write on database when a link is clicked?
Hi, I have a list of products in a gridview. When the link is clicked currently it takes to an ext

Filtering for a phrase using pregmatch
Here is my code which looks for addresses which start with ' src=" '

Code: [Select]preg_

$get problem
Hi Guys ...

can you please tell me what i am doing wrong here
Code: <?php

script is pulling more then they have....
I have this script for my game where they can change there race. This will cost them 2,500 points. H

A WBS element with the name XXX already exists in version FREI_VERSION
Hi.
When I am trying to insert WBS element in a project, error occurs:

"A WBS eleme

How to ... (FAQs)
... get e-mail notifications As several people asked how to get e-mail notifications when new posti

Quick Syntax Question
Hi folks,

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

ASP.NET Validation Event Cycle
Hi,
I have asp button as follow:

Cache PHP Objects/Classes?
Does anyone have ideas about caching PHP objects using something like: http://memcached.org/

ob_ dynamic content
i was wondering about the potential to use ob to create a <div then remove it when the page

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