RE: RE: Further MySQL query problems...

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

 



why wouldn't you just run a query to return only the elements that you want?

Bastien

From: "NIPP, SCOTT V (SBCSI)" <sn4265@xxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Subject:  RE: Further MySQL query problems...
Date: Mon, 28 Mar 2005 10:49:24 -0600

	Oops...  Correction to the last line of the script.
	<?php } while ($blah = mysql_fetch_array($exclude_results)); ?>

	Should be...
      <?php } while ($blah = array_shift($temp)); ?>
Scott Nipp
Phone:  (214) 858-1289
E-mail:  sn4265@xxxxxxx
Web:  http:\\ldsa.sbcld.sbc.com


> -----Original Message----- > From: NIPP, SCOTT V (SBCSI) > Sent: Monday, March 28, 2005 10:47 AM > To: 'php-db@xxxxxxxxxxxxx' > Subject: Further MySQL query problems... > > I am having trouble in the following code. Basically, I want to > query two separate database tables and then generate an array from > these two queries. The first query will return a list of ALL systems. > The second query will return a list of systems that should be > excluded. The problem is that this is getting me nowhere. Here is > the pertinent code... > > $query = "SELECT CPU_Hostname FROM AllMid_Data > WHERE CPU_IN_SVC = \"Y\" > AND CPU_DNS = \"sbcld.sbc.com\" > ORDER BY CPU_Hostname ASC"; > $results = mysql_query($query, $Prod) or die(mysql_error()); > $system = mysql_fetch_array($results, MYSQL_NUM); > $exclude_query = "SELECT hostname FROM exclusion"; > $exclude_results = mysql_query($exclude_query, $Prod); > $exclude = mysql_fetch_array($exclude_results, MYSQL_NUM); > $temp = array_diff($system, $exclude); > <?php do { > $sys = $blah[0]; > echo "<tr>"; ?> > <?php echo $sys; ?> > <?php echo "</tr>"; } ?> > <?php } while ($blah = mysql_fetch_array($exclude_results)); ?> > > I have cut out a lot of extraneous stuff that I don't think is > pertinent. Please let me know if you see something causing my > problems. The first query table has about 900 entries and the query > returns about 90 hostnames. The exclude table query has only 13 > hostnames and obviously returns all. I am looking for a way to > display the approximately 77 entries that are NOT in the exclude > table. Thanks again. > > Scott Nipp > Phone: (214) 858-1289 > E-mail: sn4265@xxxxxxx > Web: http:\\ldsa.sbcld.sbc.com > >

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