OMG Chris, Thankyou very much. That is exactally what I needed. If you wish for me to pay you some amount, I will be very happy to. Please send me a private email where I can paypal you. If not, Thank you again very much for the help.

Sorry everyone for the hastle for those of you wernt able to help with what I wanted.

- Rob

----- Original Message ----- From: "Chris" <[EMAIL PROTECTED]>
To: "Rob W." <[EMAIL PROTECTED]>
Cc: <php-general@lists.php.net>
Sent: Tuesday, June 20, 2006 1:39 AM
Subject: Re: [PHP] Still trying to figure this out...


Rob W. wrote:
I still have not yet found anybody to help me with this. All the code that people have given me has not worked at all. I still get no output. So to add a little more to this, I'm gonna define how the database looks.

----------------------------------
|    switchid        |    switchport     |
----------------------------------
|            1          |             1          |
|            1          |             2          |
|            1          |             3          |
|            1          |             4          |
|            1          |             7          |
|            1          |             10        |
----------------------------------

I'm sure the code that people have posted will work if you do more than just copy/paste it and try to understand it and match it to what you want.


$switch_ports_taken = array();

$query = "select switchport from table where switchid=1";
$result = mysql_query($query);

if (!$result) die("error: " . mysql_error());

while($row = mysql_fetch_assoc($result)) {
  array_push($switch_ports_taken, $row['switchport']);
}

echo "Got these ports: " . print_r($switch_ports_taken, true) . "<br/>";

$all_ports = range(1,24);

$unused_ports = array_diff($all_ports, $switch_ports_taken);

echo "Unused ports: " . print_r($unused_ports, true) . "<br/>";


If that doesn't work tell us what doesn't work and don't make us guess what's going on.

--
Postgresql & php tutorials
http://www.designmagick.com/

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




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

Reply via email to