Page 2 of 2
Re: search a table
Posted: Sun Oct 19, 2008 8:59 am
by me666
a conditional statement? what something like a code that will only display the result codeing when u click the search button? sorry im confused, new to all this, i started at the deep end, going straight for a big script, should of started with a small 1 really
thanks
Re: search a table
Posted: Sun Oct 19, 2008 9:06 am
by jaoudestudios
Yes I think you are trying to run before you can walk. Which is not always bad if a developer understands the concepts from another language just not the syntax. Conditional statements are one of the first things a developer learns.
Yes you could fire the code after the submit button has been pressed. Therefore when the user comes to the page for the first time only the search boxes are shown. Then after the user has entered the search criteria then the form will be submit and the page will be reloaded and you can fire the rest of the code to do the search through the database and to display the results.
Re: search a table
Posted: Sun Oct 19, 2008 9:12 am
by me666
ok cool thanks, will just have to try and work out the codeing for that now.... may take some time but i been lookin at the codes and trying to work something out for it...
thanks for the help, much appriciated

Re: search a table
Posted: Mon Oct 20, 2008 12:37 pm
by me666
i have it sorted now, all done. i use a session, when you search, by pressing enter or search it sets a session variable, and the search results will only display when the variable is set, and then the variable is unset again once the code has been displayed. i have tested this code a number of times with different search strings and it seams to do the job.
thanks for the help

Re: search a table
Posted: Mon Oct 20, 2008 3:31 pm
by jaoudestudios
session is overkill. You are using a hammer to crack a nut! But if it works, who cares right?

Re: search a table
Posted: Tue Oct 21, 2008 6:41 am
by me666
yep it works, and i knew roughly how to do that. maybe in time ill figure out a different way of doing it, but for now it will do

thanks for all the help wiv this
Re: search a table
Posted: Wed Oct 22, 2008 4:26 pm
by me666
I must be mad... i thought about this the other day... i use a if(isset($_POST function to set the session, and then another if(isset function to check if the session is set or not.... why donti just use the original if(isset($_POST function on the mysql query in the first place? i have now changed the code, so that im not using the session anymore, and it works just the same... and it saves on space as it uses less code. I wish i had of thought of this first :S
Thanks for the help u gave me
