LMarie Posted September 11, 2009 Share Posted September 11, 2009 Hi iv created a drop down menu of users and a submit button. and this is what i want the submit button to do: when submit search file.txt for match in user if match then increase number for that user by one and write the new number to file.txt then rederect to a new page iv created the lines in file.txt looks like this: number:name:email any ideas or tips? Quote Link to comment Share on other sites More sharing options...
shadowfiend20 Posted September 11, 2009 Share Posted September 11, 2009 i dont know weather it will work wid your script or not!! anyways i am assuming you are tryin to search for the files in database... $query = "select * from the_table where 1st_field like \"%$input%\" order by 1st_field"; // EDIT HERE and specify your table and input for the SQL query $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); //and check on the basis of $numrows..like match found or not..and so on ..hope i got ur question right Quote Link to comment Share on other sites More sharing options...
LMarie Posted September 11, 2009 Author Share Posted September 11, 2009 im searching for match in a file not a database Quote Link to comment Share on other sites More sharing options...
shadowfiend20 Posted September 11, 2009 Share Posted September 11, 2009 and where is dat file plz explain litle bit more as required Quote Link to comment Share on other sites More sharing options...
syed Posted September 11, 2009 Share Posted September 11, 2009 Wat you need to do is read each line of the text file into a 2D array. after the data is loaded into a 2D array you can then use a loop and an if statement to loop through the array and do a comparison, you can break out of the loop if you find a match. That's the easy bit. Now you need to increase the number for that record, you could update the array and then create a new file using the data from the array. 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.