Re: basic php question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:  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
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux