pazafuera Posted June 2, 2008 Share Posted June 2, 2008 Hey everybody, I have a database field that stores a users preferences for a job alert search. For example, it might read "Accounting, Sales, Marketing" I need to enter those values into an SQL query like so: WHERE jobcategory = 'Accounting' OR jobcategory = 'Sales' OR jobcategory = 'Marketing' I'm a total rookie and have no idea where to start...any suggestions? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
paulman888888 Posted June 2, 2008 Share Posted June 2, 2008 make an form first i am calling mine add.php my form is useing get and the action is add1.php and the form feild is called add. Now add a submit button. below is add1.php <?php //make an connection mysql_query("INSERT INTO TABLENAME //change this (change this to the table you want to put it in,) VALUES('" . mysql_real_escape_string(substr($_GET['add'], 0, 50)) . "',)") //change add to the form name or die('Theres an error.# Please try again.#'); echo "Completed with no errors"; ?> now upload to them to your server, load up add.php and type in the name of the thing you want to add then click submit. If it works you should see Completed with no errors. Quote Link to comment Share on other sites More sharing options...
pazafuera Posted June 2, 2008 Author Share Posted June 2, 2008 Thanks for the quick reply. Can you clarify the process this is going through? Is this for writing the initial values to the database, or pulling the existing values and rewriting them into the sql query? Quote Link to comment Share on other sites More sharing options...
luca200 Posted June 4, 2008 Share Posted June 4, 2008 Hope your "database field" is a SET field. That way you can find it really easy: WHERE find_in_set(jobcategory, yourField) > 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.