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

xml element exists
Code: [Select]<?xml version="1.0"?>
<Addresses>
<

very easy question about SQL info
Hello,
I think that I have a very easy question.
I know how to create a form using php SQL and

Include ("Absolute Path") of a file?
I'm not sure what I'm doing wrong. I am writing my php code in the same directory of the file that

New to mysqli library - Multiple query problem
Greetings,

I am writing a batch program that executes 3 queries on a single page. Using mysql

Unidentified index error in a simple form
I have been trying to make an HTML form that is handled by a PHP script. So far my attempts to get i

how make 2 column in table with data tybe long row
hi every one

I want make in my table 2 column with data tybe long raw

how thi

Database/Table Collation
What is the Database, and table collations used for? i don't understand what there used for since co

Alterar a hora do servidor
Se alguém souber, ajude-me a adicionar 6 horas, obrigado
<tr>
&

Basic Question about Threading and PHP...
I have a page that I am working on and it is taking several hours to process. The basics of what th

mysql_real_escape_string making variable equal nothing
i post a form and i post the variable:
Code: $var = $_POST[variable];then i echo $var its what i

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