Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2010
    Thanked 0 Times in 0 Posts

    Help with PHP / SQL problem


    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!


  • #2
    met is offline
    Regular Coder
    Join Date
    Oct 2009
    United Kingdom
    Thanked 119 Times in 119 Posts
    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


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts