array problem...
am 10.12.2006 15:54:59 von Matthew Ferry------=_NextPart_000_0015_01C71C41.40E3A060
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello everyone,
I'm new to PHP/MySQL but I know my way around good now.
I have egroupware installed/setup and its running fine. I want to =
create a couple of PHP pages that access the mySQL data to report the =
info in egroupware. The information in the one table I can access fine. =
=20
Code for that: =20
$db =3D mysql_connect("HOST", "USERNAME", "PASSWORD");
mysql_select_db("DATABASE",$db);
$result =3D mysql_query("SELECT * FROM egw_addressbook
WHERE cat_id=3D10", $db);
if ($myrow =3D mysql_fetch_array($result)) {
echo "
%s | %s = %s | ||||
%s | = | %s | |||
%s, %s = %s | |||||
} else {
echo "Sorry, no records were found!";=20
}
?>
For what you see there. It works Great. BUT
There is other info in another table I want to report also in this page. =
In the second table one record may have more than one row. It stays =
associated with the correct contact with the "contact_id" column matches =
the "id" column from the first table. This second table is used for =
custom fields in egroupware. =20
So to do a search for a record in the second table. its something like:
SELECT contact_value FROM egw_addressbook_extra
WHERE contact_name=3D"Supplier" and contact_id=3D"correct number from =
first table"
Also valid for Contact_name are: RANO, Install Date, PrevSystem
When I build the top array I want to include these four other fields but =
they have to be with the correct record from the first table.
Do I want to do a array merge?
Can I add some ANDs to my current SELECT statement?
I have tried a bunch of stuff can't find a solution.
The bottom line is have it create the array from the first table and =
then add 4 columns on the end. then pull the info from the second table =
and insert it in the last 4 column of the array
Thanks...
Matt
------=_NextPart_000_0015_01C71C41.40E3A060--