Jump to content

basic0

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

basic0's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. A co-worker reports that it's not working properly in Safari as well.
  2. $meds = preg_replace('/\n/', ', ', $pt->getValue("medications")); $controller->setDefaults(array('medication' => $meds)); $pt->getValue("medications") returns a block of text like "Tylenol\nAdvil\nAsprin" from the MySQL table. $controller-setDefaults(...) calls a method from PEAR::QuickForm_controller to set default values on form elements, in this case, fill the "medication" text field with "Tylenol, Advil, Asprin". This works in IE6 and Firefox 3 beta3 fine, but in Firefox 2 the field is populated with only the first item ("Tylenol"). The the first comma and everything after it are truncated. Is this a bug in Firefox 2.x? Is there any way to work around it?
  3. // db connection code ... // meat of the matter $query = "INSERT INTO emg_formdata VALUES(NULL, '01/02/03', 'N', 'N', 'N', 'something', 'something else', 'another thing', 'blah', 'Y', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N')"; mysql_query($query); $last_insert = mysql_insert_id($connection); print $last_insert; ----- expected: 13 (next in sequence) result: 0
  4. Greetings. mysql-standard 5.0.27 macosx powerpc php 5.2.1 macosx 10.4.9 mysql> describe forms; +------------+---------------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+---------------------------+------+-----+---------+----------------+ | id | int(10) unsigned zerofill | NO | PRI | NULL | auto_increment | | formtype | varchar(50) | NO | | | | | formdata | int(10) unsigned zerofill | NO | | | | | patient_id | int(10) unsigned | NO | | | | | resolved | enum('Y','N') | NO | | | | +------------+---------------------------+------+-----+---------+----------------+ 5 rows in set (0.07 sec) mysql> describe emg_formdata; +------------+---------------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+---------------------------+------+-----+---------+----------------+ | id | int(10) unsigned zerofill | NO | PRI | NULL | auto_increment | | date | varchar(12) | NO | | | | | prev_emg | enum('Y','N') | NO | | | | | prev_eeg | enum('Y','N') | NO | | | | | prev_evp | enum('Y','N') | NO | | | | | prev_loc | varchar(50) | YES | | NULL | | | diagnosis | varchar(160) | YES | | NULL | | | medication | varchar(160) | YES | | NULL | | | history | varchar(160) | YES | | NULL | | | questions | varchar(160) | YES | | NULL | | | urgent | enum('Y','N') | NO | | | | | visual | enum('Y','N') | NO | | | | | brainstem | enum('Y','N') | NO | | | | | arms | enum('Y','N') | NO | | | | | legs | enum('Y','N') | NO | | | | | routine | enum('Y','N') | NO | | | | | sleep | enum('Y','N') | NO | | | | | ambulatory | enum('Y','N') | NO | | | | | study1 | enum('Y','N') | NO | | | | | study2 | enum('Y','N') | NO | | | | +------------+---------------------------+------+-----+---------+----------------+ 20 rows in set (0.06 sec) I want to run something like this: "INSERT INTO emg_formdata VALUES(NULL, '01/02/03', 'N', 'N', 'N', 'something', 'something else', 'another thing', 'blah', 'Y', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N')"; then this: INSERT INTO forms VALUES(NULL, 'emg', LAST_INSERT_ID(), '$uid', 'N'); With me so far? Here's the problem: when I do this through a PHP script, the last insert id never changes, though the data gets inserted as expected. If I type these commands into the mysql monitor, the last insert id number changes as it should. I can add 100 rows through the PHP script and the result of last_insert_id() and "SELECT max(id) FROM emg_formdata" will never change from zero. If I *do* issue these commands to the monitor, it'll insert the data and update the last insert id, say in this case the id number is 4. I can then run the script 100 more times and the last insert id will never change from 4. I've tried both last_insert_id() and max(id). I've tried PHP's mysql functions and PEAR::DB. How can I get the auto generated id number from emg_formdata rows into the formdata column of rows in the forms table?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.