Re: Two php pages and a single column

From: Date: Sun, 12 Nov 2000 05:06:55 +0000
Subject: Re: Two php pages and a single column
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-24838@lists.php.net to get a copy of this message
sannec27@eng.uab.edu wrote: > > Hello all, > > I am having two different php pages(scene1.php and scene2.php) and in the > first page i am collecting the 'firstname' and in the second page i am > collecting the 'lastname' and i am using the following queries respectively > in those two php pages: > mysql_query ("insert into usertable (firstname) values ($firstname)"); > mysql_query ("insert into usertable (lastname) values ($lastname)"); > > What my problem is, i want these two details to be in the same row not in > two different rows as that is the case now as shown below: > -------------------------- > firstname |lastname > -------------------------- > john | null > -------------------------- > null | deo > -------------------------- > > I want it to be as below: > -------------------------- > firstname |lastname > -------------------------- > john | deo > -------------------------- > > As i don't have the idea about who is going to be the user i am not able to > use a command like this in the second page: > mysql_query ("insert into usertable (lastname) values ($lastname) where > firstname='john'"); > > Can any body suggest me how to get around this problem. Does MySQL and PHP > entertain this feature? > > I very much appreciate whomever responds > Chakravarthy K Sannedhi Chak: I would combine the pages into one and use a table, but that's a php question not an MySQL question. You'll need to either create an autonumber field as uid and use mysql_insert_id(int [link_identifier] ) for the second insert (i.e. where $last_row_id = what was returned from the mysql_insert_id function. Or, you could use a table in a single page and keep the variables in the same form and do: mysql_query ("insert into usertable set firstname = $firstname, lastname = $lastname"); Van -- ========================================================================= Linux rocks!!! http://www.dedserius.com =========================================================================

« previous php.general (#24838) next »