Re: basic php question

From: Date: Wed, 03 Sep 2003 21:35:01 +0000
Subject: Re: basic php question
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-30312@lists.php.net to get a copy of this message
Darryl, I'm not completely clear on what you mean by "I need to walk table employee and see if emp2 has a record that matches by employee number" From what I understand I would do something like: $query = mysql_query("select * from employee where EmployeeNo = $EmployeeNo and emp2.EmployeeNo = '$EmployeeNo'"); if(mysql_num_rows($query) == 1) { mysql_query("update emp2 where emp2.id = '$SomeValue'"); } else { mysql_query("insert into emp2 set X = '$X'"); } hope this helps, Graeme :) ----- Original Message ----- From: "Darryl" <darryl@osborne-ind.com> To: <php-db@lists.php.net> Sent: Wednesday, September 03, 2003 10:14 PM Subject: [PHP-DB] basic php question > Greetings, > I have php and mysql installed on my freebsd machine. > I have a database iweb with tables employee and emp2. > > I need to walk table employee and see if emp2 has a > record that matches by employee number. If it matches, > I need to update some values in emp2. If there is no match, > I need to create a new record in emp2 and load values. > > Is there a tutorial that shows how to do something this basic ? > tips ? > > thanks, > Darryl > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.db (#30312) next »