View Full Version : Help with PHP / SQL problem

01-29-2010, 09:05 PM

I have a bit of a problem and I'm not sure how to go about it.
On the site I'm developing in PHP (with mySQL), I read in a text file of BibTeX data (bibliography data). Each entry usually starts in the form

@book {short-key, author= {John Smith}, ... }

I read these in and generate an SQL query to insert them into my DB. My problem is that sometimes a 'short-key' might be blank, and it is a required field. I use a loop in PHP currently to read in these entries and add them to the DB, and I want to be able to prompt the user within that loop, at each entry that has no key, and ask them to enter one.

I've no idea how I can go about doing this - any ideas would be much appreciated!


01-29-2010, 09:24 PM
i imagine you would need to create an array of queries, using if/else logic to determine if "short-key" is empty, set a flag some where if it is

store the array in a session, then inform the user to enter a key for the missing ones, update the array, then insert it all of the records at once. (foreach)

hope this helps