Re: Still trying to figure this out...
| From: | Chris | Date: | Tue, 20 Jun 2006 06:39:57 +0000 |
| Subject: | Re: Still trying to figure this out... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-238379@lists.php.net to get a copy of this message | ||
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. ----------------------------------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/| switchid | switchport |----------------------------------| 1 | 1 | | 1 | 2 | | 1 | 3 | | 1 | 4 | | 1 | 7 | | 1 | 10 |----------------------------------