Jump to content

mjsulliv

Members
  • Content Count

    94
  • Joined

  • Last visited

Community Reputation

0 Neutral

About mjsulliv

  • Rank
    Newbie
  1. I’m trying to write a trigger that will cause an increment in a count value in one table when a row is inserted in another table that has a matching id value. The syntax I’ve tried is: CREATE TRIGGER inc_m_cnt AFTER INSERT ON m UPDATE c SET c.m_cnt = c.m_cnt + 1 WHERE m.c_id = c.c_id. Myphpadmin give the generic error message that there is a problem in the SQL. Any thoughts will appreciated. Test DB: -- phpMyAdmin SQL Dump-- version 3.3.9-- [url="http://www.phpmyadmin.net"]http://www.phpmyadmin.net[/url]---- Host: localhost-- Generation Time: Oct 28, 2011 at 09:43 PM-- Server version:
  2. Hey all. Ive been trying to write what should be a simple query. I want to count the number of items 'M' in each of the containers 'C'The query I run is : SQL query: SELECT C_ID, Count(C_ID) FROM `m` JOIN `c` Where C_ID = Cage_ID; What I get is a result w/ the first C_ID and a sum of the number of items in all the containers. What I expected and want, is a result w/ three rows each w/ one C_ID and the number of M_IDs in them. Below is the SQL to creat a set of test tables. Any help would be appreciated. --- Mike CREATE TABLE IF NOT EXISTS `c` ( `C_ID` int(11) NOT NULL, `Room` varchar(
  3. Thank you. Your insights are helpful. I found description of obj to string and back at: http://www.json.org/js.htmlI'll start playing w/ these.
  4. You are right, the semicolon is wrong and is not really in the code i'm running; probably vestigial from a early cut and paste.I'm using jQuery. What I think the function is expecting is a JSON object. How would i make the object instead of a string?
  5. when I pass it through encodeURIComponent() I see the string as modified by the encoding but it makes no difference in what appears at the server.
  6. in Firebug: inside the function: "{"RecdNum_ckBx" : "RecdNum_ckBx", "RecdTimeStmp_ckBx" : "RecdTimeStmp_ckBx"}"back in the calling code: "{"RecdNum_ckBx" : "RecdNum_ckBx", "RecdTimeStmp_ckBx" : "RecdTimeStmp_ckBx"}"
  7. I've corrected the code:function BuildJsonData(){ var jsonData = "{"; var recdNum_ckBx = document.getElementById('selectMenu_RecdNum_CkBx'); if(recdNum_ckBx.checked == true){ jsonData = jsonData + '"RecdNum_ckBx" : "RecdNum_ckBx"'; a = 1; // line for debug breakpoint } var recdTimeStmp_CkBx = document.getElementById('selectMenu_RecdTimeStmp_CkBx'); if(recdTimeStmp_CkBx.checked == true){ jsonData = jsonData + "," + ' "RecdTimeStmp_ckBx" : "RecdTimeStmp_ckBx"'; a = 1; // line for debug breakpoint } jsonData = jsonData + "}"; return jsonData; According to Netbeans debugger what I get
  8. Thanks, I'll make the correction and give it a try.
  9. Hello All. I've been hammering on some code that I thought would work but can't seem to get it to do so. I want to dynamically build the JSON data I send when the OnClick of a check box is done. The function callsseem to work fine but I can't seem to successfully substitute the JSON data as a js var. Below is a snippet of code that I hope demonstrates what I'm trying to do. Any help would be appreciated. function BuildJsonData(){ var jsonData = "{"; var recdNum_ckBx = document.getElementById('selectMenu_RecdNum_CkBx'); if(recdNum_ckBx.checked == true){ jsonData = '"RecdNum_ckBx" : "Re
  10. Excellent! Thank you both.--- Mike
  11. Hello all. I’ve been trying to use jQuery to get data from a DB and javascript to use the data to build the output and show it. If call a test file with a JSON object, it works. If I query a DB the data sent back to the js callback-function is always NULL. I have a small example below of the three files involved in the project, the starting index file, the called php that reads the DB and the SQL that builds the table.I’ve been beating this up since mid week and can’t seem to find a solution. Any help would be appreciated.index.php: <!DOCTYPE html><html xmlns="http://www.w3.org
  12. Good point. I guess I KNOW what it will return, a '0'. Rereading the manual warning about what is returned when needle is not found, a Boolean FALSE, does not imply that if found it returns anything but a number; TRUE is NEVER returned. I guess in some ways it just bothers my sense of symmetry.Thanks for all the responses.--- Mike
  13. hmmm... if I use the syntax $a = 0; if(strpos("DOB_fld", "DOB") === 0) { $a = 1; } What will $a be?
×
×
  • Create New...