Jump to content

Search location


depojones

Recommended Posts

Hello,

 

Let me be brief:

 

I have a page that contain the result of students/users. Recently, I was to add a search functionality to the page. That is, an administrator can type the name of a student and the record for similar names will display, that I can do. The tricky part is, I want the result from the search input to display on the same page with the result. When an admin type a student name/number, the entire result shouldn't display, just the particular student's information .

 

I don't know how to explain better, but someone out-there understands.

 

regards

Link to comment
https://forums.phpfreaks.com/topic/154032-search-location/
Share on other sites

i believe i understand .. i'm assuming you have a database setup with the information stored in there?

 

to have the result from the input box display, (depending on your method, let's assume it's POST), just have something like

echo $_POST['input_box_name'];

 

and if your querying the db for the results, some code regarding that would be necessary to explain how to extract only certain records / information.

 

hope i understood.

Link to comment
https://forums.phpfreaks.com/topic/154032-search-location/#findComment-809689
Share on other sites

@mrMarcus

 

Thank you for your response. Have a look at this scenario:

s/n | Firstname | Lastname | Email             | Student # |
-------------------------------------------------
1      Marcus       Nerd         test[]mail.com   00000000

 

If I have populated the above from mysql into all_result.php and I have a search form on the same page. I want whereby, when I type in a student number, It takes all the result away and only show me the information for the student with the # on the same page

 

 

Link to comment
https://forums.phpfreaks.com/topic/154032-search-location/#findComment-809696
Share on other sites

k, but there's much more information needed for me to help .. how are you querying the database?  do you have a form setup already?  are you matching student's via the form by typing in the student # or by typing a name?

 

it really just comes down to the right sql query ..

$sql = sprintf("SELECT * FROM students WHERE student_number='%d' LIMIT 1", mysql_real_escape_string($_POST['student_number']));

just be a little more specific with what YOU need help with .. what don't you know how to do?  marcus nerd, eh?  well, marcus nerd holds the key to your future in PHP.

Link to comment
https://forums.phpfreaks.com/topic/154032-search-location/#findComment-809708
Share on other sites

I do not have any problem with querying my DB. I think my question here is the arrangement. I have the form and the DB correctly setup.

 

This is what i want: I have 100 results on a page. I don't want an admin to click on the pagination to find a record on number 98. What I did was, I created a search form on the same page. I want the administrator to type in the student on record 98 into the search input and it should display the DETAILS ONLY on the same.

Link to comment
https://forums.phpfreaks.com/topic/154032-search-location/#findComment-809736
Share on other sites

I do not have any problem with querying my DB. I think my question here is the arrangement. I have the form and the DB correctly setup.

 

This is what i want: I have 100 results on a page. I don't want an admin to click on the pagination to find a record on number 98. What I did was, I created a search form on the same page. I want the administrator to type in the student on record 98 into the search input and it should display the DETAILS ONLY on the same.

you can create a link alongside each individual student that will re-query the database and retrieve more specific information.  then you just break your page into sections to be displayed upon certain sql queries .. either by using url messages or session variables.
Link to comment
https://forums.phpfreaks.com/topic/154032-search-location/#findComment-809842
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.