TIAMOT Update

Posted 1 month, 3 weeks ago at 1:27 pm. 6 comments

Nope this isn’t a update for the code, although there should be one very soon. This is actually just to say I have uploaded the latest version of the TIAMOT code(version 2.1) to a project in the Google Code Repository.

You can visit it here to get the latest info and the newest versions as soon as they are released.

That’s it for now. More soon.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • StumbleUpon
  • Google
  • Furl
  • del.icio.us
  • Facebook

6 Replies

  1. Hi,
    I love your new version 2.2, especially the preview column. I have everything working exactly like I want, except for where to place the 2 pieces of code to prevent a duplicate entry into the database that you sent me. I’ve tried it everywhere but can’t seem to get it to work. If you could please tell me where exactly to place these 2 pieces of code, and I would be so grateful. Thank you so much. - Linda

    Code 1:

    function checkDuplicate($section, $row, $seat) { 
    $r = $db->query("SELECT * FROM " . $db_info['T'] . " WHERE section='" . $section . "' AND row='" . $row . "' AND seat='" . $seat . "'"); 
    $num = $db->num_rows($r); 
    if($num > 0) { 
    return false; 
    } 
    else { 
    return true; 
    } 
    }

    Code 2:

    if(checkDuplicate($value['section'], $value['row'], $value['seat'])) { 
    echo 'false'; exit(); 
    }
  2. Well the checkDuplicate() function can be placed anywhere really but to keep the code neat and readable I would recommend placing it underneath the separateID() function.

    The other bit though I just realised I didn’t explain where to put it properly the last time, sorry. :(

    You will need to find the bit that looks like this:

    case "add" :
    			foreach($add_list as $field) {
    				if(in_array($field, $required_list)) {
    					if(empty($_POST[$field])) {
    						die("false");
    					}
    				}
    				$values[$field] = $_POST[$field];
    			}

    In my code that’s about line 273 but it may not be the same since my code is the prototype version with some new features in that I’m not ready to release yet. ;)

    You will need to place this underneath that code:

    if(checkDuplicate($values['section'], $values['row'], values['seat'])) { 
      echo 'false';
      exit(); 
    }

    You will need to use this code and not the old code since I have corrected a little mistake, I missed the `s` off $values. :o

    That code should check to see if there is an entry in your database where the section, row and seats all match. If so that seat is taken so return true causing the if to trigger and that will return false to the javascript and stop the code. The user will see and error.

    Unfortunately the error is not customiseable due to the way I wrote the code and that is one of the new features I am working on for version 2.5.

    I hope that helps. Any more problems just shout. :)

  3. Hi Veneficus,
    I still can’t get the code to work. I placed the 2 pieces of code exactly as you said, but the program will now add no records at all, whether I try adding duplicate or unique records. It doesn’t matter. And IE7 says ‘error on page’.
    However if I try to add a record with a blank field, I do get the correct status error message. So this validation still works fine. And IE7 does not say ‘error on page’.
    I added the missing dollar sign before the word ‘values’, in the 2nd piece of code, but still no luck.
    What would you suggest I try next?
    Thanks again,
    Linda

  4. Hey there Linda,

    I just realised why it’s not working. I made a mistake, it’s so obvious of a mistake I don’t even know how I missed it in the first place.

    Change the second bit to this:

    $dupe = checkDuplicate($values['section'], $values['row'], $values['seat']);
    			if($dupe == false) {
    				die("false");
    			}

    Then change the checkDuplicate() to this:

    function checkDuplicate($section, $row, $seat) { 
    		global $db, $db_info;
    		$r = $db->query("SELECT * FROM " . $db_info['T'] . " WHERE section='" . $section . "' AND row='" . $row . "' AND seat='" . $seat . "'"); 
    		$num = $db->num_rows($r);
    		if($num > 0) { 
    			return false;
    		} else { 
    			return true; 
    		} 
    	}

    Hope that solves your problems.

  5. It all works! Thank you so much, Veneficus! I appreciate your willingness to be so helpful, and I look forward to Version 2.5.

    All the best - Linda

  6. No problem. :)

    Some big things coming in 2.5 I hope including a proper customisable version of the dupe check so you won’t need hacks like that one. ;)

    It’ll be a little while yet though since I have to finish Natural Tys which involves rebuilding a huge database. :( I hate databases…

    Anyway I’m glad that works and if you need any more help just ask. :D


Leave a Reply