Welcome! Log In Create A New Profile

Advanced

[PHP] PHP & Database Problems

Posted by Ethan Rosenberg 
Ethan Rosenberg
[PHP] PHP & Database Problems
May 02, 2012 09:10PM
have a database

mysql> describe Intake3;
+--------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+-------+
| Site | varchar(6) | NO | PRI | | |
| MedRec | int(6) | NO | PRI | NULL | |
| Fname | varchar(15) | YES | | NULL | |
| Lname | varchar(30) | YES | | NULL | |
| Phone | varchar(30) | YES | | NULL | |
| Height | int(4) | YES | | NULL | |
| Sex | char(7) | YES | | NULL | |
| Hx | text | YES | | NULL | |
+--------+-------------+------+-----+---------+-------+
8 rows in set (0.00 sec)

mysql> describe Visit3;
+--------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------+--------------+------+-----+---------+----------------+
| Indx | int(4) | NO | PRI | NULL | auto_increment |
| Site | varchar(6) | YES | | NULL | |
| MedRec | int(6) | YES | | NULL | |
| Notes | text | YES | | NULL | |
| Weight | int(4) | YES | | NULL | |
| BMI | decimal(3,1) | YES | | NULL | |
| Date | date | YES | | NULL | |
+--------+--------------+------+-----+---------+----------------+

and a program to enter and extract data.

I can easily extract data from the database. However, if I try to
enter data, it goes into the incorrect record. Following are some
screenshots. The program is attached. [pardon the comical
names. This is a test, and any resemblance to true names is not
intentional....]

Let us say that I wish to deal with Medical Record 10000:


This it data from Intake3:
Site Medical Record First Name Last Name Phone Height Sex History
AA 10000 David Dummy 845 365-1456 66 Male c/o obesity. Various
treatments w/o success

This is data from Visit3:
Index Site Medical Record Notes Weight BMI Date
2322 AA 10000 Second Visit. 170 27.4 2010-01-20
2326 AA 10000 Third visit. Small progress, but pt is very happy. 165
26.6 2010-02-01


I then request to enter additional data:

Site Medical Record First Name Last Name Phone Height Sex History
AA 10003 Stupid Fool 325 563-4178 65 Male Has been convinced by his
friends that he is obese. Normal BMI = 23.
Index Site Medical Record Notes Weight BMI Date

Notice that it is entered into record 10003

The data is "First Try"

Index Site Medical Record Notes Weight BMI Date
2590 AA 10003 First Try 189 31.4 02 May 2012

Help and advice, please.

Thanks.

Ethan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Gavin Chalkley
[PHP] RE: [PHP-DB] PHP & Database Problems
May 02, 2012 09:20PM
Ethan,

Some coding you are using would be helpful (as far as i am aware attachments
are not support on the mailing list's)

Gav

-----Original Message-----
From: Ethan Rosenberg [mailto:[email protected]]
Sent: 02 May 2012 19:54
To: php-db-lists.php.net; php-general@lists.php.net
Subject: [PHP-DB] PHP & Database Problems

have a database

mysql> describe Intake3;
+--------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+-------+
| Site | varchar(6) | NO | PRI | | |
| MedRec | int(6) | NO | PRI | NULL | |
| Fname | varchar(15) | YES | | NULL | |
| Lname | varchar(30) | YES | | NULL | |
| Phone | varchar(30) | YES | | NULL | |
| Height | int(4) | YES | | NULL | |
| Sex | char(7) | YES | | NULL | |
| Hx | text | YES | | NULL | |
+--------+-------------+------+-----+---------+-------+
8 rows in set (0.00 sec)

mysql> describe Visit3;
+--------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------+--------------+------+-----+---------+----------------+
| Indx | int(4) | NO | PRI | NULL | auto_increment |
| Site | varchar(6) | YES | | NULL | |
| MedRec | int(6) | YES | | NULL | |
| Notes | text | YES | | NULL | |
| Weight | int(4) | YES | | NULL | |
| BMI | decimal(3,1) | YES | | NULL | |
| Date | date | YES | | NULL | |
+--------+--------------+------+-----+---------+----------------+

and a program to enter and extract data.

I can easily extract data from the database. However, if I try to enter
data, it goes into the incorrect record. Following are some screenshots.
The program is attached. [pardon the comical names. This is a test, and
any resemblance to true names is not intentional....]

Let us say that I wish to deal with Medical Record 10000:


This it data from Intake3:
Site Medical Record First Name Last Name Phone Height Sex History AA 10000
David Dummy 845 365-1456 66 Male c/o obesity. Various treatments w/o success

This is data from Visit3:
Index Site Medical Record Notes Weight BMI Date
2322 AA 10000 Second Visit. 170 27.4 2010-01-20
2326 AA 10000 Third visit. Small progress, but pt is very happy. 165
26.6 2010-02-01


I then request to enter additional data:

Site Medical Record First Name Last Name Phone Height Sex History
AA 10003 Stupid Fool 325 563-4178 65 Male Has been convinced by his
friends that he is obese. Normal BMI = 23.
Index Site Medical Record Notes Weight BMI Date

Notice that it is entered into record 10003

The data is "First Try"

Index Site Medical Record Notes Weight BMI Date
2590 AA 10003 First Try 189 31.4 02 May 2012

Help and advice, please.

Thanks.

Ethan



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Lucas
Re: [PHP] PHP & Database Problems
May 02, 2012 09:30PM
I do believe attachments are allowed. Looking back, I see that there
have been messages sent to the list that had odt, php, and ini attachments

On 05/02/2012 12:12 PM, Gavin Chalkley wrote:
> Ethan,
>
> Some coding you are using would be helpful (as far as i am aware attachments
> are not support on the mailing list's)
>
> Gav
>
> -----Original Message-----
> From: Ethan Rosenberg [mailto:[email protected]]
> Sent: 02 May 2012 19:54
> To: php-db-lists.php.net; php-general@lists.php.net
> Subject: [PHP-DB] PHP& Database Problems
>
> have a database
>
> mysql> describe Intake3;
> +--------+-------------+------+-----+---------+-------+
> | Field | Type | Null | Key | Default | Extra |
> +--------+-------------+------+-----+---------+-------+
> | Site | varchar(6) | NO | PRI | | |
> | MedRec | int(6) | NO | PRI | NULL | |
> | Fname | varchar(15) | YES | | NULL | |
> | Lname | varchar(30) | YES | | NULL | |
> | Phone | varchar(30) | YES | | NULL | |
> | Height | int(4) | YES | | NULL | |
> | Sex | char(7) | YES | | NULL | |
> | Hx | text | YES | | NULL | |
> +--------+-------------+------+-----+---------+-------+
> 8 rows in set (0.00 sec)
>
> mysql> describe Visit3;
> +--------+--------------+------+-----+---------+----------------+
> | Field | Type | Null | Key | Default | Extra |
> +--------+--------------+------+-----+---------+----------------+
> | Indx | int(4) | NO | PRI | NULL | auto_increment |
> | Site | varchar(6) | YES | | NULL | |
> | MedRec | int(6) | YES | | NULL | |
> | Notes | text | YES | | NULL | |
> | Weight | int(4) | YES | | NULL | |
> | BMI | decimal(3,1) | YES | | NULL | |
> | Date | date | YES | | NULL | |
> +--------+--------------+------+-----+---------+----------------+
>
> and a program to enter and extract data.
>
> I can easily extract data from the database. However, if I try to enter
> data, it goes into the incorrect record. Following are some screenshots.
> The program is attached. [pardon the comical names. This is a test, and
> any resemblance to true names is not intentional....]
>
> Let us say that I wish to deal with Medical Record 10000:
>
>
> This it data from Intake3:
> Site Medical Record First Name Last Name Phone Height Sex History AA 10000
> David Dummy 845 365-1456 66 Male c/o obesity. Various treatments w/o success
>
> This is data from Visit3:
> Index Site Medical Record Notes Weight BMI Date
> 2322 AA 10000 Second Visit. 170 27.4 2010-01-20
> 2326 AA 10000 Third visit. Small progress, but pt is very happy. 165
> 26.6 2010-02-01
>
>
> I then request to enter additional data:
>
> Site Medical Record First Name Last Name Phone Height Sex History
> AA 10003 Stupid Fool 325 563-4178 65 Male Has been convinced by his
> friends that he is obese. Normal BMI = 23.
> Index Site Medical Record Notes Weight BMI Date
>
> Notice that it is entered into record 10003
>
> The data is "First Try"
>
> Index Site Medical Record Notes Weight BMI Date
> 2590 AA 10003 First Try 189 31.4 02 May 2012
>
> Help and advice, please.
>
> Thanks.
>
> Ethan
>
>
>


--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Terry Ally (Gmail)
Re: [PHP] PHP & Database Problems
May 02, 2012 10:10PM
Dear Ethan,

It would be useful to see what code you are using.

The syntax is:

UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value


The data that you are required to enter is for Intake3. I am assuming that
the only change is the History and/or Phone that you need to update since
the Site, MedRec, Fname, Lname, Height and Sex should remain the same.
Therefore I imagine the code should be something like


mysql_query("UPDATE Intake3 SET History='Has been convinced by his
friends that he is obese. Normal BMI = 23', Phone='325 563-4178'
WHERE MedRec='10000' LIMIT 1");


Having said that I notice that you have two primary keys in Intake3. Not
aware that a table can carry two.

Terry

On 2 May 2012 19:53, Ethan Rosenberg <[email protected]> wrote:

> have a database
>
> mysql> describe Intake3;
> +--------+-------------+------**+-----+---------+-------+
> | Field | Type | Null | Key | Default | Extra |
> +--------+-------------+------**+-----+---------+-------+
> | Site | varchar(6) | NO | PRI | | |
> | MedRec | int(6) | NO | PRI | NULL | |
> | Fname | varchar(15) | YES | | NULL | |
> | Lname | varchar(30) | YES | | NULL | |
> | Phone | varchar(30) | YES | | NULL | |
> | Height | int(4) | YES | | NULL | |
> | Sex | char(7) | YES | | NULL | |
> | Hx | text | YES | | NULL | |
> +--------+-------------+------**+-----+---------+-------+
> 8 rows in set (0.00 sec)
>
> mysql> describe Visit3;
> +--------+--------------+-----**-+-----+---------+------------**----+
> | Field | Type | Null | Key | Default | Extra |
> +--------+--------------+-----**-+-----+---------+------------**----+
> | Indx | int(4) | NO | PRI | NULL | auto_increment |
> | Site | varchar(6) | YES | | NULL | |
> | MedRec | int(6) | YES | | NULL | |
> | Notes | text | YES | | NULL | |
> | Weight | int(4) | YES | | NULL | |
> | BMI | decimal(3,1) | YES | | NULL | |
> | Date | date | YES | | NULL | |
> +--------+--------------+-----**-+-----+---------+------------**----+
>
> and a program to enter and extract data.
>
> I can easily extract data from the database. However, if I try to enter
> data, it goes into the incorrect record. Following are some screenshots.
> The program is attached. [pardon the comical names. This is a test, and
> any resemblance to true names is not intentional....]
>
> Let us say that I wish to deal with Medical Record 10000:
>
>
> This it data from Intake3:
> Site Medical Record First Name Last Name Phone Height Sex History
> AA 10000 David Dummy 845 365-1456 66 Male c/o obesity. Various treatments
> w/o success
>
> This is data from Visit3:
> Index Site Medical Record Notes Weight BMI Date
> 2322 AA 10000 Second Visit. 170 27.4 2010-01-20
> 2326 AA 10000 Third visit. Small progress, but pt is very happy. 165 26.6
> 2010-02-01
>
>
> I then request to enter additional data:
>
> Site Medical Record First Name Last Name Phone Height Sex History
> AA 10003 Stupid Fool 325 563-4178 65 Male Has been convinced by his
> friends that he is obese. Normal BMI = 23.
> Index Site Medical Record Notes Weight BMI Date
>
> Notice that it is entered into record 10003
>
> The data is "First Try"
>
> Index Site Medical Record Notes Weight BMI Date
> 2590 AA 10003 First Try 189 31.4 02 May 2012
>
> Help and advice, please.
>
> Thanks.
>
> Ethan
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



--
*Terry Ally*
Twitter.com/terryally
Facebook.com/terryally
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
To print or not to print this email is the environmentally-searching
question!
Which has the highest ecological cost? A sheet of paper or constantly
switching on your computer and connecting to the Internet to read your
email?
Duken Marga
Re: [PHP] PHP & Database Problems
May 03, 2012 01:30AM
But I don't see any attachments in this message.

On Thu, May 3, 2012 at 2:28 AM, Jim Lucas <[email protected]> wrote:

> I do believe attachments are allowed. Looking back, I see that there have
> been messages sent to the list that had odt, php, and ini attachments
>
>
> On 05/02/2012 12:12 PM, Gavin Chalkley wrote:
>
>> Ethan,
>>
>> Some coding you are using would be helpful (as far as i am aware
>> attachments
>> are not support on the mailing list's)
>>
>> Gav
>>
>> -----Original Message-----
>> From: Ethan Rosenberg [mailto:[email protected]]
>> Sent: 02 May 2012 19:54
>> To: php-db-lists.php.net; php-general@lists.php.net
>> Subject: [PHP-DB] PHP& Database Problems
>>
>> have a database
>>
>> mysql> describe Intake3;
>> +--------+-------------+------**+-----+---------+-------+
>> | Field | Type | Null | Key | Default | Extra |
>> +--------+-------------+------**+-----+---------+-------+
>> | Site | varchar(6) | NO | PRI | | |
>> | MedRec | int(6) | NO | PRI | NULL | |
>> | Fname | varchar(15) | YES | | NULL | |
>> | Lname | varchar(30) | YES | | NULL | |
>> | Phone | varchar(30) | YES | | NULL | |
>> | Height | int(4) | YES | | NULL | |
>> | Sex | char(7) | YES | | NULL | |
>> | Hx | text | YES | | NULL | |
>> +--------+-------------+------**+-----+---------+-------+
>> 8 rows in set (0.00 sec)
>>
>> mysql> describe Visit3;
>> +--------+--------------+-----**-+-----+---------+------------**----+
>> | Field | Type | Null | Key | Default | Extra |
>> +--------+--------------+-----**-+-----+---------+------------**----+
>> | Indx | int(4) | NO | PRI | NULL | auto_increment |
>> | Site | varchar(6) | YES | | NULL | |
>> | MedRec | int(6) | YES | | NULL | |
>> | Notes | text | YES | | NULL | |
>> | Weight | int(4) | YES | | NULL | |
>> | BMI | decimal(3,1) | YES | | NULL | |
>> | Date | date | YES | | NULL | |
>> +--------+--------------+-----**-+-----+---------+------------**----+
>>
>> and a program to enter and extract data.
>>
>> I can easily extract data from the database. However, if I try to enter
>> data, it goes into the incorrect record. Following are some screenshots.
>> The program is attached. [pardon the comical names. This is a test, and
>> any resemblance to true names is not intentional....]
>>
>> Let us say that I wish to deal with Medical Record 10000:
>>
>>
>> This it data from Intake3:
>> Site Medical Record First Name Last Name Phone Height Sex History AA 10000
>> David Dummy 845 365-1456 66 Male c/o obesity. Various treatments w/o
>> success
>>
>> This is data from Visit3:
>> Index Site Medical Record Notes Weight BMI Date
>> 2322 AA 10000 Second Visit. 170 27.4 2010-01-20
>> 2326 AA 10000 Third visit. Small progress, but pt is very happy. 165
>> 26.6 2010-02-01
>>
>>
>> I then request to enter additional data:
>>
>> Site Medical Record First Name Last Name Phone Height Sex History
>> AA 10003 Stupid Fool 325 563-4178 65 Male Has been convinced by his
>> friends that he is obese. Normal BMI = 23.
>> Index Site Medical Record Notes Weight BMI Date
>>
>> Notice that it is entered into record 10003
>>
>> The data is "First Try"
>>
>> Index Site Medical Record Notes Weight BMI Date
>> 2590 AA 10003 First Try 189 31.4 02 May 2012
>>
>> Help and advice, please.
>>
>> Thanks.
>>
>> Ethan
>>
>>
>>
>>
>
> --
> Jim Lucas
>
> http://www.cmsws.com/
> http://www.cmsws.com/examples/
> http://www.bendsource.com/
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Duken Marga
Jim Lucas
Re: [PHP] PHP & Database Problems
May 03, 2012 08:00AM
On 5/2/2012 4:28 PM, Duken Marga wrote:
> But I don't see any attachments in this message.
>

This was in the first email of this thread.

>>> I can easily extract data from the database. However, if I try to enter
>>> data, it goes into the incorrect record. Following are some screenshots.
>>> The program is attached. [pardon the comical names. This is a test, and
>>> any resemblance to true names is not intentional....]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Sorry, only registered users may post in this forum.

Click here to login