Re: [PHP] helping people...
No that wasnt a ddos threat you idiot, i dont play them games. And when you keep sending spam is when it starts to piss people off. - Original Message - From: Jochem Maas [EMAIL PROTECTED] To: [php] PHP General List php-general@lists.php.net Sent: Wednesday, June 21, 2006 1:55 AM Subject: [PHP] helping people... helping some people will get you no end of trouble. and so it seems as though I'm going to be DoSSed by someone who uses Outlook Express as their mail client. I guess it's monday somewhere. Original Message From: - Wed Jun 21 01:47:39 2006 X-Mozilla-Status: 0001 X-Mozilla-Status2: Return-Path: [EMAIL PROTECTED] X-Original-To: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] Received: from localhost (localhost [127.0.0.1]) by mx1.moulin.nl (Postfix) with ESMTP id EECE119EB29 for [EMAIL PROTECTED]; Wed, 21 Jun 2006 01:47:00 +0200 (CEST) Received: from mx1.moulin.nl ([127.0.0.1]) by localhost (mx1.moulin.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 01046-16 for [EMAIL PROTECTED]; Wed, 21 Jun 2006 01:46:57 +0200 (CEST) Received: from mail.fiberuplink.com (newyork.hardlink.com [140.186.181.161]) by mx1.moulin.nl (Postfix) with SMTP id A4FBB19EAF0 for [EMAIL PROTECTED]; Wed, 21 Jun 2006 01:46:56 +0200 (CEST) Received: (qmail 86220 invoked by uid 1013); 20 Jun 2006 23:46:57 - Received: from 208.107.101.135 by eclipse.fiberuplink.com (envelope-from [EMAIL PROTECTED], uid 1011) with qmail-scanner-1.25-st-qms (clamdscan: 0.87/1102. spamassassin: 3.0.1. perlscan: 1.25-st-qms. Clear:RC:0(208.107.101.135):SA:0(-1.9/4.5):. Processed in 3.519899 secs); 20 Jun 2006 23:46:57 - X-Antivirus-INetKing-Mail-From: [EMAIL PROTECTED] via eclipse.fiberuplink.com X-Antivirus-INetKing: 1.25-st-qms (Clear:RC:0(208.107.101.135):SA:0(-1.9/4.5):. Processed in 3.519899 secs Process 86212) Received: from host-135-101-107-208.midco.net (HELO rob) ([EMAIL PROTECTED]@208.107.101.135) by mail.fiberuplink.com with SMTP; 20 Jun 2006 23:46:52 - Message-ID: [EMAIL PROTECTED] From: Rob W. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Date: Tue, 20 Jun 2006 19:18:02 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary==_NextPart_000_003E_01C6949E.403D9880 X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-Virus-Scanned: amavisd-new at moulin.nl Unless you wanna keep your server up, I suggest you quit sending me shit. -- 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
Re: [PHP] Still trying to figure this out...
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| -- ect so on and so forth. There are other switch id's in there as well along with their switch port's which sorting the other switchid's is not a problem. I also know the maximum amount for each switchid so that's not a problem as well. I need to be able to display the missing numbers in there. I have no extra spaces in there for blank numbers. After a server has been entered in to the database, it take's that number that was not shown previously in the database and enters it in, there for displaying it and not making it available for the next time another server is added. I have no way to alter the database as I am trying to clone a program and this is the only thing haning me up as of right now. If I can find someone to solve this problem for me, I will be glad to send money via paypal for helping out solving this problem as I have been on it for 2 days now and this is the last bit of code for this program that is holding me up. Please read below for more information on what I am doing. - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Monday, June 19, 2006 3:39 PM Subject: [PHP] Still trying to figure this out... Ok, I am still trying to get this figured out from what I tried doing last night. If anybody wants to try it, please be my guest. This is the deal. Create an INTEGER table. Put the numbers 1 - 24 in it. Leave out like number 8, 9, 22, 23 ect.. Now create a php statement that will take and pull that out of the database, find out the missing numbers and display them as an html drop down selection. And tedd in response to why, is because the values that are already located in the database represent in use already. They represent a server port that a server is sitting on, so that's not the problem. I could have done that along time ago. Any help is appreciated but here is the current code that I have. $query=SELECT switchport FROM network; $result=mysql_query($query); $sql_range=mysql_fetch_array($result); $true_range=range(1,24); $next_range=array_diff($true_range,$sql_range); foreach ($next_range as $final_range) { echo option value='$final_range'$final_range\n; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still trying to figure this out...
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
Re: [PHP] Still trying to figure this out...
Ya know, after working on this for 2 days straight, I have tried my own work. I never said I was an expert at php, that's why this list is here, so the next time you critisize someone, keep it to your self cause no one cares to hear about it. If you dont wanna help, then stfu. - Original Message - From: Jochem Maas [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Tuesday, June 20, 2006 3:54 AM Subject: Re: [PHP] Still trying to figure this out... Rob W. wrote: 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. just do us all a favor and only come back when you have grasped the concept of debugging/investigating a problem (any problem) and doing your *own* work. Sorry everyone for the hastle for those of you wernt able to help with ['wernt'? that is not a word.] what Chris wrote is a tiny variation of code examples that have been posted by at least 4 different people. the fact is that you didn't bother to study the code and just pasted into your script expecting it to work. 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
Re: [PHP] Still trying to figure this out...
Yes, I do have it setup right to display my errors, the reason why I wasnt getting any input is because when the array was matched to range(1,24) and the other array had nothing in it, I was either getting a list of numbers 1 though 24 or nothing at all. - Rob - Original Message - From: Stut [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Tuesday, June 20, 2006 4:08 AM Subject: Re: [PHP] Still trying to figure this out... Rob W. wrote: Ya know, after working on this for 2 days straight, I have tried my own work. I never said I was an expert at php, that's why this list is here, so the next time you critisize someone, keep it to your self cause no one cares to hear about it. If you dont wanna help, then stfu. Just one more suggestion before we all STFU and leave you to work it out for yourself... you do have PHP set up to display errors right? You've said several times that you get no output which leads me to believe you're trying to code with one hand tied behind your back and a red-hot poker in each eye. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still trying to figure this out...
- Original Message - From: Jochem Maas [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Tuesday, June 20, 2006 4:13 AM Subject: Re: [PHP] Still trying to figure this out... Rob W. wrote: Ya know, after working on this for 2 days straight, I have tried my own so what. Why the heck you bitching then? work. I never said I was an expert at php, neither did I. Dont complain about people asking for help when that is what this list is for. that's why this list is here, really, could you please quote your support contract number. If it's not, dont reply then idiot. so the next time you critisize someone, keep it to your self cause no one cares to hear about it. If you dont wanna help, then stfu. your right about not wanting to help you - you silly little toad. Good, ignore my posts and shut the hell up about it, no one want's your opinion. - Original Message - From: Jochem Maas [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Tuesday, June 20, 2006 3:54 AM Subject: Re: [PHP] Still trying to figure this out... Rob W. wrote: 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. just do us all a favor and only come back when you have grasped the concept of debugging/investigating a problem (any problem) and doing your *own* work. Sorry everyone for the hastle for those of you wernt able to help with ['wernt'? that is not a word.] what Chris wrote is a tiny variation of code examples that have been posted by at least 4 different people. the fact is that you didn't bother to study the code and just pasted into your script expecting it to work. 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
[PHP] Array
$query=SELECT switchport FROM network; $result=mysql_query($query); $sql_range=array($result['switchport']); Anybody tell me what i'm doing wrong and why this isnt going in to an array?
[PHP] Still trying to figure this out...
Ok, I am still trying to get this figured out from what I tried doing last night. If anybody wants to try it, please be my guest. This is the deal. Create an INTEGER table. Put the numbers 1 - 24 in it. Leave out like number 8, 9, 22, 23 ect.. Now create a php statement that will take and pull that out of the database, find out the missing numbers and display them as an html drop down selection. And tedd in response to why, is because the values that are already located in the database represent in use already. They represent a server port that a server is sitting on, so that's not the problem. I could have done that along time ago. Any help is appreciated but here is the current code that I have. $query=SELECT switchport FROM network; $result=mysql_query($query); $sql_range=mysql_fetch_array($result); $true_range=range(1,24); $next_range=array_diff($true_range,$sql_range); foreach ($next_range as $final_range) { echo option value='$final_range'$final_range\n; }
Re: [PHP] Still trying to figure this out...
This also didnt work, Still giving me no output just like the last try. - Original Message - From: Xavier Casto To: Rob W. Cc: php-general@lists.php.net Sent: Monday, June 19, 2006 4:33 PM Subject: Re: [PHP] Still trying to figure this out... Have you ever thought of doing something like this: for($i = 0; $i = $maxport; $i++) { $query=SELECT switchport FROM network WHERE switchport = .$i; $result=mysql_query($query); if(empty($result)) { echo p$i/p; } } It should only return the ones that aren't in the table and they will automatically be sorted in ascending order. On 6/19/06, Rob W. [EMAIL PROTECTED] wrote: Ok, I am still trying to get this figured out from what I tried doing last night. If anybody wants to try it, please be my guest. This is the deal. Create an INTEGER table. Put the numbers 1 - 24 in it. Leave out like number 8, 9, 22, 23 ect.. Now create a php statement that will take and pull that out of the database, find out the missing numbers and display them as an html drop down selection. And tedd in response to why, is because the values that are already located in the database represent in use already. They represent a server port that a server is sitting on, so that's not the problem. I could have done that along time ago. Any help is appreciated but here is the current code that I have. $query=SELECT switchport FROM network; $result=mysql_query($query); $sql_range=mysql_fetch_array($result); $true_range=range(1,24); $next_range=array_diff($true_range,$sql_range); foreach ($next_range as $final_range) { echo option value='$final_range'$final_range\n; }
Re: [PHP] Still trying to figure this out...
Yep, and still nothing output's. - Original Message - From: Xavier Casto [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Monday, June 19, 2006 6:20 PM Subject: RE: [PHP] Still trying to figure this out... You did make sure to assign a numerical value to $maxport? -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Monday, June 19, 2006 6:15 PM To: php-general@lists.php.net Subject: Re: [PHP] Still trying to figure this out... This also didnt work, Still giving me no output just like the last try. - Original Message - From: Xavier Casto To: Rob W. Cc: php-general@lists.php.net Sent: Monday, June 19, 2006 4:33 PM Subject: Re: [PHP] Still trying to figure this out... Have you ever thought of doing something like this: for($i = 0; $i = $maxport; $i++) { $query=SELECT switchport FROM network WHERE switchport = .$i; $result=mysql_query($query); if(empty($result)) { echo p$i/p; } } It should only return the ones that aren't in the table and they will automatically be sorted in ascending order. On 6/19/06, Rob W. [EMAIL PROTECTED] wrote: Ok, I am still trying to get this figured out from what I tried doing last night. If anybody wants to try it, please be my guest. This is the deal. Create an INTEGER table. Put the numbers 1 - 24 in it. Leave out like number 8, 9, 22, 23 ect.. Now create a php statement that will take and pull that out of the database, find out the missing numbers and display them as an html drop down selection. And tedd in response to why, is because the values that are already located in the database represent in use already. They represent a server port that a server is sitting on, so that's not the problem. I could have done that along time ago. Any help is appreciated but here is the current code that I have. $query=SELECT switchport FROM network; $result=mysql_query($query); $sql_range=mysql_fetch_array($result); $true_range=range(1,24); $next_range=array_diff($true_range,$sql_range); foreach ($next_range as $final_range) { echo option value='$final_range'$final_range\n; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still trying to figure this out...
Nope, I still dont get anything back from that. So i'm still stuck in the mud. - Original Message - From: Jochem Maas [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Monday, June 19, 2006 4:05 PM Subject: Re: [PHP] Still trying to figure this out... Rob W. wrote: Ok, I am still trying to get this figured out from what I tried doing last night. If anybody wants to try it, please be my guest. This is the deal. Create an INTEGER table. Put the numbers 1 - 24 in it. Leave out like number 8, 9, 22, 23 ect.. I'll assume the DB creation and filling is something you have already covered/dealt with. Now create a php statement that will take and pull that out of the database, this you have already (as per your example code). find out the missing numbers and display them as an html drop down selection. And tedd in response to why, is because the values that are already located in the database represent in use already. They represent a server port that a server is sitting on , so that's not the problem. I could have done that along time ago. huh? whats not a problem, what could have done a long time ago? (and why didn't you?) Any help is appreciated but here is the current code that I have. try the apples below $query=SELECT switchport FROM network; $result=mysql_query($query); $sql_range=mysql_fetch_array($result); $true_range=range(1,24); $next_range=array_diff($true_range,$sql_range); foreach ($next_range as $final_range) { echo option value='$final_range'$final_range\n; } $sqlRange = array(); if ($res = mysql_query('SELECT switchport FROM network')) { while ($row = mysql_fetch_array($res)) $sqlRange[] = $row['switchport']; } echo 'select name=port'; foreach (array_diff(range(1,24), $sqlRange) as $port) { echo 'option value=',$port,'',$port,'/option'; } echo '/select'; /* NOTE: 1. you have to loop your mysql result to get each port that is already used in the DB into you array 2. try to output something that resembles proper HTML (an option without a closing tag sucks) */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still trying to figure this out...
Yeah, that's what i'm trying to print is the missing numbers in the db. That's what I've been trying to figure out this whole time. - Original Message - From: Xavier Casto [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Monday, June 19, 2006 6:34 PM Subject: RE: [PHP] Still trying to figure this out... Are there any numbers missing in your database table between 0 and the number you assigned to $maxport? -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Monday, June 19, 2006 6:26 PM To: php-general@lists.php.net Subject: Re: [PHP] Still trying to figure this out... Yep, and still nothing output's. - Original Message - From: Xavier Casto [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Monday, June 19, 2006 6:20 PM Subject: RE: [PHP] Still trying to figure this out... You did make sure to assign a numerical value to $maxport? -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Monday, June 19, 2006 6:15 PM To: php-general@lists.php.net Subject: Re: [PHP] Still trying to figure this out... This also didnt work, Still giving me no output just like the last try. - Original Message - From: Xavier Casto To: Rob W. Cc: php-general@lists.php.net Sent: Monday, June 19, 2006 4:33 PM Subject: Re: [PHP] Still trying to figure this out... Have you ever thought of doing something like this: for($i = 0; $i = $maxport; $i++) { $query=SELECT switchport FROM network WHERE switchport = .$i; $result=mysql_query($query); if(empty($result)) { echo p$i/p; } } It should only return the ones that aren't in the table and they will automatically be sorted in ascending order. On 6/19/06, Rob W. [EMAIL PROTECTED] wrote: Ok, I am still trying to get this figured out from what I tried doing last night. If anybody wants to try it, please be my guest. This is the deal. Create an INTEGER table. Put the numbers 1 - 24 in it. Leave out like number 8, 9, 22, 23 ect.. Now create a php statement that will take and pull that out of the database, find out the missing numbers and display them as an html drop down selection. And tedd in response to why, is because the values that are already located in the database represent in use already. They represent a server port that a server is sitting on, so that's not the problem. I could have done that along time ago. Any help is appreciated but here is the current code that I have. $query=SELECT switchport FROM network; $result=mysql_query($query); $sql_range=mysql_fetch_array($result); $true_range=range(1,24); $next_range=array_diff($true_range,$sql_range); foreach ($next_range as $final_range) { echo option value='$final_range'$final_range\n; } -- 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
Re: [PHP] Still trying to figure this out...
Nope, still does nothing. - Original Message - From: Xavier Casto [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Monday, June 19, 2006 6:49 PM Subject: RE: [PHP] Still trying to figure this out... I think the problem is I forgot to reset $result to 0 for($i = 0; $i = $maxport; $i++) { $query=SELECT switchport FROM network WHERE switchport = .$i; $result=mysql_query($query); if(empty($result)) { echo p$i/p; $result=0; } } Though I still haven't tested it, I don't have a current installation of MySQL... -Original Message- From: Xavier Casto [mailto:[EMAIL PROTECTED] Sent: Monday, June 19, 2006 6:34 PM To: 'Rob W.' Cc: php-general@lists.php.net Subject: RE: [PHP] Still trying to figure this out... Are there any numbers missing in your database table between 0 and the number you assigned to $maxport? -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Monday, June 19, 2006 6:26 PM To: php-general@lists.php.net Subject: Re: [PHP] Still trying to figure this out... Yep, and still nothing output's. - Original Message - From: Xavier Casto [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Monday, June 19, 2006 6:20 PM Subject: RE: [PHP] Still trying to figure this out... You did make sure to assign a numerical value to $maxport? -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Monday, June 19, 2006 6:15 PM To: php-general@lists.php.net Subject: Re: [PHP] Still trying to figure this out... This also didnt work, Still giving me no output just like the last try. - Original Message - From: Xavier Casto To: Rob W. Cc: php-general@lists.php.net Sent: Monday, June 19, 2006 4:33 PM Subject: Re: [PHP] Still trying to figure this out... Have you ever thought of doing something like this: for($i = 0; $i = $maxport; $i++) { $query=SELECT switchport FROM network WHERE switchport = .$i; $result=mysql_query($query); if(empty($result)) { echo p$i/p; } } It should only return the ones that aren't in the table and they will automatically be sorted in ascending order. On 6/19/06, Rob W. [EMAIL PROTECTED] wrote: Ok, I am still trying to get this figured out from what I tried doing last night. If anybody wants to try it, please be my guest. This is the deal. Create an INTEGER table. Put the numbers 1 - 24 in it. Leave out like number 8, 9, 22, 23 ect.. Now create a php statement that will take and pull that out of the database, find out the missing numbers and display them as an html drop down selection. And tedd in response to why, is because the values that are already located in the database represent in use already. They represent a server port that a server is sitting on, so that's not the problem. I could have done that along time ago. Any help is appreciated but here is the current code that I have. $query=SELECT switchport FROM network; $result=mysql_query($query); $sql_range=mysql_fetch_array($result); $true_range=range(1,24); $next_range=array_diff($true_range,$sql_range); foreach ($next_range as $final_range) { echo option value='$final_range'$final_range\n; } -- 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
Re: [PHP] Still trying to figure this out...
$range = array_flip( range( 1, 24 ) ); $query = SELECT switchport FROM network ; if( ($result = mysql_query( $query )) !== false ) { while( ($row = mysql_fetch_array( $result )) !== false ) { unset( $range[$row[0]] ); } } foreach( $range as $switchport = $foo ) { echo 'option value='.$switchport.''.$switchport.'/option'.\n; $result = 0; } With that, I dont get anything, Not sure what you mean by empty to is_null ect.. - Rob - Original Message - From: Xavier Casto [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Monday, June 19, 2006 7:37 PM Subject: RE: [PHP] Still trying to figure this out... Ok Rob, I tested my code in Oracle (obviously changed for that database type) and discovered I needed to change empty to is_null I had forgotten that empty represents zero but we aren't getting a count so we needed to check for a null. it worked me for once I made that change and didn't need to do the other change I had previously mentioned. -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Monday, June 19, 2006 6:50 PM To: php-general@lists.php.net Subject: Re: [PHP] Still trying to figure this out... Yeah, that's what i'm trying to print is the missing numbers in the db. That's what I've been trying to figure out this whole time. - Original Message - From: Xavier Casto [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Monday, June 19, 2006 6:34 PM Subject: RE: [PHP] Still trying to figure this out... Are there any numbers missing in your database table between 0 and the number you assigned to $maxport? -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Monday, June 19, 2006 6:26 PM To: php-general@lists.php.net Subject: Re: [PHP] Still trying to figure this out... Yep, and still nothing output's. - Original Message - From: Xavier Casto [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Monday, June 19, 2006 6:20 PM Subject: RE: [PHP] Still trying to figure this out... You did make sure to assign a numerical value to $maxport? -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Monday, June 19, 2006 6:15 PM To: php-general@lists.php.net Subject: Re: [PHP] Still trying to figure this out... This also didnt work, Still giving me no output just like the last try. - Original Message - From: Xavier Casto To: Rob W. Cc: php-general@lists.php.net Sent: Monday, June 19, 2006 4:33 PM Subject: Re: [PHP] Still trying to figure this out... Have you ever thought of doing something like this: for($i = 0; $i = $maxport; $i++) { $query=SELECT switchport FROM network WHERE switchport = .$i; $result=mysql_query($query); if(empty($result)) { echo p$i/p; } } It should only return the ones that aren't in the table and they will automatically be sorted in ascending order. On 6/19/06, Rob W. [EMAIL PROTECTED] wrote: Ok, I am still trying to get this figured out from what I tried doing last night. If anybody wants to try it, please be my guest. This is the deal. Create an INTEGER table. Put the numbers 1 - 24 in it. Leave out like number 8, 9, 22, 23 ect.. Now create a php statement that will take and pull that out of the database, find out the missing numbers and display them as an html drop down selection. And tedd in response to why, is because the values that are already located in the database represent in use already. They represent a server port that a server is sitting on, so that's not the problem. I could have done that along time ago. Any help is appreciated but here is the current code that I have. $query=SELECT switchport FROM network; $result=mysql_query($query); $sql_range=mysql_fetch_array($result); $true_range=range(1,24); $next_range=array_diff($true_range,$sql_range); foreach ($next_range as $final_range) { echo option value='$final_range'$final_range\n; } -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql ORDER BY problem
Ok, here's what i got in my mysql db. I got a table listed with numbers as follows 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 18 19 20 21 22 25 These numbers I can display fine. I'm using .. $query=SELECT * FROM db ORDER BY numbers ASC; Right now it displays it as 1 10 11 12 . 2 22 23 25 3 4 5 6 7 Is there a way with my mysql query so that I can list the numbers in correct order? Any help is appricated. - Rob
Re: [PHP] Re: mysql ORDER BY problem
It's not in general to mysql, it's how php and mysql is displaying it. - Original Message - From: Michael Rasmussen [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Sunday, June 18, 2006 4:51 PM Subject: [PHP] Re: mysql ORDER BY problem On Sun, 18 Jun 2006 15:55:14 -0500, Rob W. wrote: Is there a way with my mysql query so that I can list the numbers in correct order? In what way is this problem related to PHP? Try a MySQL group instead. -- Hilsen/Regards Michael Rasmussen http://keyserver.veridis.com:11371/pks/lookup?op=getsearch=0xE3E80917 -- 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
Re: [PHP] mysql ORDER BY problem
Yeah, I got this problem fixed. The datbase was listed under [chr] instead of [integer]. Thanks for the help though. - Original Message - From: Xavier Casto To: Rob W. Cc: php-general@lists.php.net Sent: Sunday, June 18, 2006 7:30 PM Subject: Re: [PHP] mysql ORDER BY problem Rob, Your problem is the data type you are trying to sort. You have a few solutions that can be used depending on your skills, access, and intent of the data. As some had suggested, the problem may be best handled at the database level, but it all depends on what your intent is. When sorting a datatype of Character (or string) 10 will always come before 2, you would either need to convert the string to a number or left pad the string with 0 to get the result your are looking for. Some good information for your issue can be found here: http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html try the CAST or CONVERT functions in your query: $query=SELECT * FROM db ORDER BY CONVERT(numbers, DECIMAL) ASC; On 6/18/06, Rob W. [EMAIL PROTECTED] wrote: Ok, here's what i got in my mysql db. I got a table listed with numbers as follows 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 18 19 20 21 22 25 These numbers I can display fine. I'm using .. $query=SELECT * FROM db ORDER BY numbers ASC; Right now it displays it as 1 10 11 12 . 2 22 23 25 3 4 5 6 7 Is there a way with my mysql query so that I can list the numbers in correct order? Any help is appricated. - Rob
[PHP] Ok next php problem
I got the previous question answered, Now here's my next problem. With the numbers displaying correctly again I got: 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 18 19 20 21 22 25 listed in that order in the database Now i'm trying to figure out how to write a syntax saying that if like number 8 isnt listed, display it. I've tried doing a if ($count != $data) { echo $data; } $count++; But when I get to like id number 9 it dont work right because the next entrie is displayed as 10 in the db. So that's my problem is to try and display only them numbers that are not in there. I have also tried putting the numbers in to an array and matching from there but it still come's up as the same as above. - Rob
Re: [PHP] Re: Ok next php problem
No, but ok here goes the whole thing and sorry if I didnt explain this to everyone before. I am trying to duplicate a program that keep's track of server information, switch ports, apc ports ect ect... In the one column is switchports This lists a total of 24 or 48 or how many ever ports are on that switch. With in there is numbers like this for example: 1 2 3 4 5 6 7 10 11 12 13 14 15 ect... Hopefully that help's so far. As far as listing the numbers is ok, I can pull it from the db and list all the numbers just fine in numerical order as they are listed. My problem is inside this script, when a new server is added, it pulls the information from the database and finds an empty number, which is why, though the whole list of 1 though 24 i need to get the information of the missing numbers. These missing numbers HAFT to be dynamic and can not be hard coded in because servers are always moved around and changed and added. I hope this information was helpful for those of you trying to help solve my problem. - Rob - Original Message - From: João Cândido de Souza Neto [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Sunday, June 18, 2006 8:38 PM Subject: [PHP] Re: Ok next php problem If i understood right, you want to list a sequence of numbers and follow some data like: 1 - data of number 1 2 - data of number 2 ... If it's right, you can do it. $query=SELECT * FROM db ORDER BY numbers DESC limit 1; $maxnum=$numbers; for ($num=1;$num=$maxnum; $num++) { $query=SELECT * FROM db where numbers=.$num; echo $num. - .$data.br; } Rob W. [EMAIL PROTECTED] escreveu na mensagem news:[EMAIL PROTECTED] I got the previous question answered, Now here's my next problem. With the numbers displaying correctly again I got: 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 18 19 20 21 22 25 listed in that order in the database Now i'm trying to figure out how to write a syntax saying that if like number 8 isnt listed, display it. I've tried doing a if ($count != $data) { echo $data; } $count++; But when I get to like id number 9 it dont work right because the next entrie is displayed as 10 in the db. So that's my problem is to try and display only them numbers that are not in there. I have also tried putting the numbers in to an array and matching from there but it still come's up as the same as above. - Rob -- 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
Re: [PHP] Ok next php problem
Ok but my problem is is that in the process of doing that, numbers can be released so they pretty much haft to be dynamic. Any idea how I do it with that. IE: 1 2 3 6 9 10 ... So if them numbers change, which they can, because they are assigned port numbers for servers, How do I make it so they are not scripted statically. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Sunday, June 18, 2006 8:38 PM Subject: Re: [PHP] Ok next php problem Rob W. wrote: I got the previous question answered, Now here's my next problem. With the numbers displaying correctly again I got: 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 18 19 20 21 22 25 listed in that order in the database Now i'm trying to figure out how to write a syntax saying that if like number 8 isnt listed, display it. Get them both into arrays and compare: $good_list = range(1,10); $db_list = array(4,7,10); $missing = array_diff($good_list, $db_list); http://php.net/array_diff -- 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] Javascript PHP
Ok. I am trying to figure out if this would be the correct thing to do. I start off with Java script that looks like this. /* function getType(what,available,owner) { var serverid = serveradd.serverid.value; var cabinetid = serveradd.cabinetid.value; var rowid = serveradd.rowid.value; var dcid = serveradd.dcid.value; var colour = serveradd.colour.value; var spec = serveradd.spec.value; var mainip = serveradd.mainip.value; var oldip = serveradd.oldip.value; var switchid = serveradd.switchid.value; var switchport = serveradd.switchport.value; var apcid = serveradd.apcid.value; var apcport = serveradd.apcport.value; document.location=('admin.php?page=serveraddaction=' + add + 'myid=serverid=' + serverid + 'cabinetid=' + cabinetid + 'rowid=' + rowid + 'dcid=' + dcid + 'colour=' + colour + 'spec=' + spec + 'mainip=' + mainip + 'oldip=' + oldip + 'switchid=' + switchid + 'switchport=' + switchport + 'apcid=' + apcid + 'apcport=' + apcport + 'available=' + available + 'owner=' + owner); }*/ Do I, Before that exec's, add in my mysql get to set the variables to the java variables or how do I enter that in? Any help is appricated. -Rob
Re: [PHP] Javascript PHP
Well i'm trying to figure out how to bind the php variables to the javascript variables after I pull them out of the mysql database. - Rob - Original Message - From: Jochem Maas [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Friday, June 16, 2006 4:13 AM Subject: Re: [PHP] Javascript PHP Rob W. wrote: Ok. I am trying to figure out if this would be the correct thing to do. I start off with Java script that looks like this. /* function getType(what,available,owner) { var serverid = serveradd.serverid.value; var cabinetid = serveradd.cabinetid.value; var rowid = serveradd.rowid.value; var dcid = serveradd.dcid.value; var colour = serveradd.colour.value; var spec = serveradd.spec.value; var mainip = serveradd.mainip.value; var oldip = serveradd.oldip.value; var switchid = serveradd.switchid.value; var switchport = serveradd.switchport.value; var apcid = serveradd.apcid.value; var apcport = serveradd.apcport.value; document.location=('admin.php?page=serveraddaction=' + add + 'myid=serverid=' + serverid + 'cabinetid=' + cabinetid + 'rowid=' + rowid + 'dcid=' + dcid + 'colour=' + colour + 'spec=' + spec + 'mainip=' + mainip + 'oldip=' + oldip + 'switchid=' + switchid + 'switchport=' + switchport + 'apcid=' + apcid + 'apcport=' + apcport + 'available=' + available + 'owner=' + owner); }*/ Do I, Before that exec's, add in my mysql get to set the variables to the java variables or how do I enter that in? I read that line 3 times - I know its english, but the meaning escapes me... maybe others have the same problem. could you rephrase the question? Any help is appricated. -Rob -- 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
Re: [PHP] Javascript PHP
Well for example when I pull my mysql db variable $serverid=mysql_result($result,$i,serverid); How do I bind it so this ^^ to the java var below? var serverid = serveradd.serverid.value; - Rob - Original Message - From: Jochem Maas [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Friday, June 16, 2006 4:26 AM Subject: Re: [PHP] Javascript PHP Rob W. wrote: Well i'm trying to figure out how to bind the php variables to the javascript variables after I pull them out of the mysql database. something like this? ... $data = getServerTypeDataOrSomething(); ? form name=serveradd input type=text name=serverid value=? echo $data['serverid']; ? ... etc or am I missing the point completely? - Rob - Original Message - From: Jochem Maas [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Friday, June 16, 2006 4:13 AM Subject: Re: [PHP] Javascript PHP Rob W. wrote: Ok. I am trying to figure out if this would be the correct thing to do. I start off with Java script that looks like this. /* function getType(what,available,owner) { var serverid = serveradd.serverid.value; var cabinetid = serveradd.cabinetid.value; var rowid = serveradd.rowid.value; var dcid = serveradd.dcid.value; var colour = serveradd.colour.value; var spec = serveradd.spec.value; var mainip = serveradd.mainip.value; var oldip = serveradd.oldip.value; var switchid = serveradd.switchid.value; var switchport = serveradd.switchport.value; var apcid = serveradd.apcid.value; var apcport = serveradd.apcport.value; document.location=('admin.php?page=serveraddaction=' + add + 'myid=serverid=' + serverid + 'cabinetid=' + cabinetid + 'rowid=' + rowid + 'dcid=' + dcid + 'colour=' + colour + 'spec=' + spec + 'mainip=' + mainip + 'oldip=' + oldip + 'switchid=' + switchid + 'switchport=' + switchport + 'apcid=' + apcid + 'apcport=' + apcport + 'available=' + available + 'owner=' + owner); }*/ Do I, Before that exec's, add in my mysql get to set the variables to the java variables or how do I enter that in? I read that line 3 times - I know its english, but the meaning escapes me... maybe others have the same problem. could you rephrase the question? Any help is appricated. -Rob -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Javascript PHP
Yeah, I think something like that might work. ( I also know it's javascript and not java - Little tired being up @ 5am and havnt slept for over 24 hrs already. ) - Rob - Original Message - From: Jochem Maas [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Friday, June 16, 2006 4:55 AM Subject: Re: [PHP] Javascript PHP Rob W. wrote: Well for example when I pull my mysql db variable $serverid=mysql_result($result,$i,serverid); How do I bind it so this ^^ to the java var below? (I hope english is not you first language - or maybe you write in shorthand *and* you don't bother to reread what you have written) btw it's not JAVA but JAVASCRIPT. var serverid = serveradd.serverid.value; have you thought of something like this: script type=text/javascript !-- var serverid = ? echo $serverid ?; //-- /script - Rob - Original Message - From: Jochem Maas [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Friday, June 16, 2006 4:26 AM Subject: Re: [PHP] Javascript PHP Rob W. wrote: Well i'm trying to figure out how to bind the php variables to the javascript variables after I pull them out of the mysql database. something like this? ... $data = getServerTypeDataOrSomething(); ? form name=serveradd input type=text name=serverid value=? echo $data['serverid']; ? ... etc or am I missing the point completely? - Rob - Original Message - From: Jochem Maas [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Friday, June 16, 2006 4:13 AM Subject: Re: [PHP] Javascript PHP Rob W. wrote: Ok. I am trying to figure out if this would be the correct thing to do. I start off with Java script that looks like this. /* function getType(what,available,owner) { var serverid = serveradd.serverid.value; var cabinetid = serveradd.cabinetid.value; var rowid = serveradd.rowid.value; var dcid = serveradd.dcid.value; var colour = serveradd.colour.value; var spec = serveradd.spec.value; var mainip = serveradd.mainip.value; var oldip = serveradd.oldip.value; var switchid = serveradd.switchid.value; var switchport = serveradd.switchport.value; var apcid = serveradd.apcid.value; var apcport = serveradd.apcport.value; document.location=('admin.php?page=serveraddaction=' + add + 'myid=serverid=' + serverid + 'cabinetid=' + cabinetid + 'rowid=' + rowid + 'dcid=' + dcid + 'colour=' + colour + 'spec=' + spec + 'mainip=' + mainip + 'oldip=' + oldip + 'switchid=' + switchid + 'switchport=' + switchport + 'apcid=' + apcid + 'apcport=' + apcport + 'available=' + available + 'owner=' + owner); }*/ Do I, Before that exec's, add in my mysql get to set the variables to the java variables or how do I enter that in? I read that line 3 times - I know its english, but the meaning escapes me... maybe others have the same problem. could you rephrase the question? Any help is appricated. -Rob -- 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 -- 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
Re: [PHP] Automatic email sending
If you have a unix box, Use cron to run a script to exec a php file to do it. If you have a windows box, you can setup a scheduled time to run a php file as well. - Rob - Original Message - From: Murtaza Chang [EMAIL PROTECTED] To: php-general-digest@lists.php.net; php-general@lists.php.net Sent: Friday, June 16, 2006 5:15 AM Subject: [PHP] Automatic email sending Hi everyone, my website need to automatically send an email to people when thier account is about to expire, but iam not sure how to do it. In other words its easy to put a check if an account is about to expire and send automatic email when admin logs in to system, but how is it possible to do it in background. -- Murtaza Chang http://dirtinme.blogspot.com/ A Place to throw personal trash http://milddreamerz.blogspot.com For Photoshopers And Digital Art Enthusiasts -- 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
Re: [PHP] Getting totals
Yeah, it counts how many times block is in $address, so if there's 254 ip's listed in the database, it will incriment it 254 times and display that. - Original Message - From: Rabin Vincent [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Wednesday, June 07, 2006 2:03 AM Subject: Re: [PHP] Getting totals On 6/7/06, Rob W. [EMAIL PROTECTED] wrote: I got the fix, strstr didnt work right because it was relaying more than just what I was thinking. Here is the fix. $value=array(strstr($block, $address)); foreach ($value as $var) { $block_total_ip++; } How can this work? $value will have 1 element no matter what, so $block_total_ip will always be incremented once. The above code is equivalent to just: $block_total_ip++; Rabin -- 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
[PHP] Removing an aspect of a variable...
Say I have a variable setting an ip address of 192.168.100.0 I want to be able to remove the last to chr's of that variable ie: .0 What would be my best solution to do that?
Re: [PHP] Removing an aspect of a variable...
Tnx. - Original Message - From: rich gray [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Sent: Tuesday, June 06, 2006 2:44 AM Subject: Re: [PHP] Removing an aspect of a variable... substr($variable,0,-2); Rob W. wrote: Say I have a variable setting an ip address of 192.168.100.0 I want to be able to remove the last to chr's of that variable ie: .0 What would be my best solution to do that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting totals
Ok, Here is my next problem. Inside my database, I have a list of ip's of about 10 blocks 192.168.100.0 all the way though 255 along with 192.168.101.0 though 255 and 192.168.102.0 though 255 and soforth My problem is, is i'm trying to figure out a pattern to match so I can count how many ip's are in each block and display them. So far what I have gotten is a stristr match but it's not working correctly. I have a variable that basically weed's out the last digits of the ip it's self from help previously So my code so far is: if (stristr($block,$address)) { $count_ip++; } $block would == 192.168.100 $address would == 192.168.100.0 - 255 Any help would be appricated.
Re: [PHP] Getting totals
Acutall no, Because in my database is is all them blocks but each ip in all them blocks has a seperate entry in a column. So in listing the whole column in my mysql request, i need a line that will weed out and count how many ip's are in a block. - Original Message - From: [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Sent: Tuesday, June 06, 2006 1:16 PM Subject: Re: [PHP] Getting totals i may be missing something in your description, but does turning the first and last ipnumber in a block into its integer representation, and then doing the math (subtraction) to get the ipnumber count per block, accomplish what you're after? - Rick Original Message Date: Tuesday, June 06, 2006 12:15:27 PM -0500 From: Rob W. [EMAIL PROTECTED] To: php-general@lists.php.net Subject: [PHP] Getting totals Ok, Here is my next problem. Inside my database, I have a list of ip's of about 10 blocks 192.168.100.0 all the way though 255 along with 192.168.101.0 though 255 and 192.168.102.0 though 255 and soforth My problem is, is i'm trying to figure out a pattern to match so I can count how many ip's are in each block and display them. So far what I have gotten is a stristr match but it's not working correctly. I have a variable that basically weed's out the last digits of the ip it's self from help previously So my code so far is: if (stristr($block,$address)) { $count_ip++; } $block would == 192.168.100 $address would == 192.168.100.0 - 255 Any help would be appricated. -- End Original Message -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting totals
if (strstr(192.168.100,192.168.100.10)) { $inc++; } echo $inc; That returns nothing. What am i still doing wrong? - Original Message - From: Rabin Vincent [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Tuesday, June 06, 2006 1:36 PM Subject: Re: [PHP] Getting totals On 6/6/06, Rob W. [EMAIL PROTECTED] wrote: So far what I have gotten is a stristr match but it's not working correctly. I have a variable that basically weed's out the last digits of the ip it's self from help previously So my code so far is: if (stristr($block,$address)) { $count_ip++; } You've got the parameters mixed up. strstr is (haystack, needle) so you need strstr($address, $block). php.net/stristr. Rabin -- 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
Re: [PHP] Getting totals
Sorry for the miss understanding, That's the way the viarable will look, i'm putting it in as a viariable. if (strstr($block,$address)) { $inc++; } - Original Message - From: Richard Lynch [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Sent: Tuesday, June 06, 2006 8:58 PM Subject: Re: [PHP] Getting totals Put quotes or apostrophes on the strings... if (strstr('192.168.100','192.168.100.10')) { On Tue, June 6, 2006 8:46 pm, Rob W. wrote: if (strstr(192.168.100,192.168.100.10)) { $inc++; } echo $inc; That returns nothing. What am i still doing wrong? - Original Message - From: Rabin Vincent [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Tuesday, June 06, 2006 1:36 PM Subject: Re: [PHP] Getting totals On 6/6/06, Rob W. [EMAIL PROTECTED] wrote: So far what I have gotten is a stristr match but it's not working correctly. I have a variable that basically weed's out the last digits of the ip it's self from help previously So my code so far is: if (stristr($block,$address)) { $count_ip++; } You've got the parameters mixed up. strstr is (haystack, needle) so you need strstr($address, $block). php.net/stristr. Rabin -- 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 -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting totals
I got the fix, strstr didnt work right because it was relaying more than just what I was thinking. Here is the fix. $value=array(strstr($block, $address)); foreach ($value as $var) { $block_total_ip++; } - Original Message - From: Rabin Vincent [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Tuesday, June 06, 2006 11:38 PM Subject: Re: [PHP] Getting totals On 6/7/06, Rob W. [EMAIL PROTECTED] wrote: Sorry for the miss understanding, That's the way the viarable will look, i'm putting it in as a viariable. if (strstr($block,$address)) { $inc++; } Like I said before, strstr's argument list is haystack (what to search in) first and then needle (what to search for). Therefore, you need to have: strstr($address, $block); Rabin -- 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
[PHP] Displaying data a certian way.
Ok, here's my issue that I have. Inside my database I have something that look's like this idserveridcabinetidect... - 1 server11 2 server21 3 server31 I am trying to get it to display the servers 1 2 3 under a display bar of cabinet 1. Anybody have any solutions to this? I am a novis to php and mysql but i know the majority of the basics.
Re: [PHP] Displaying data a certian way.
Just to clarify a little more, I want the output to do something like this... -- | Cabinet 1 | -- Server 1 Server 2 Server 3 and so forth... - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Sunday, June 04, 2006 10:47 PM Subject: [PHP] Displaying data a certian way. Ok, here's my issue that I have. Inside my database I have something that look's like this idserveridcabinetidect... - 1 server11 2 server21 3 server31 I am trying to get it to display the servers 1 2 3 under a display bar of cabinet 1. Anybody have any solutions to this? I am a novis to php and mysql but i know the majority of the basics. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying data a certian way.
That worked. Thanks. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Sunday, June 04, 2006 10:59 PM Subject: Re: [PHP] Displaying data a certian way. Rob W. wrote: Ok, here's my issue that I have. Inside my database I have something that look's like this idserveridcabinetidect... - 1 server11 2 server21 3 server31 I am trying to get it to display the servers 1 2 3 under a display bar of cabinet 1. Anybody have any solutions to this? I am a novis to php and mysql but i know the majority of the basics. Remember the previous cabinet and you can use that for checking whether to display another heading: $previous_cabinet = ''; while($row = mysql_fetch_assoc($query_result)) { if ($row['cabinetid'] != $previous_cabinet) { echo Cabinet id . (int)$row['cabinetid']; $previous_cabinet = $row['cabinetid']; } echo Server . htmlentities($row['serverid']) . br/; } -- 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
RE: [PHP] Escaping Chars
Thanks for the reply, but I still can't seem to make the connection... If I enter the value 123\/' in a web form and put the form post value directly into the db (no stripslashes or any other function), the value as reported by the db at a command line query is 123\/' (it LOOKS like the same value that was entered), but to get it to return that value, at the command prompt, I have to enter select * from users where password = 123/\';. OK, that makes sense. You have to 'slash' or escape every escape or delimiter character. So, the value is apparently getting into the db properly. Now, when I enter that same value (minus the outside quotes) into the form field and then compare that with the value in the db, they don't match. I've tried add and strip slashes in various combinations, but that makes no difference. I suspect there are some HTML entities or some other odd URL encoding problem??? My app has a feature that will remind a user of their password. This returns in an email exactly what I'd expect, that is, 123\/' I can't see how to make the round trip from the original input into the db and then back out again intact so it will 'match itself'... That behavior doesn't seem to match the magic_quotes docs. My current project is the first real app I have done for the Air Force in PHP. Most of the PHP work I have done is for query only db interfaces, counters, REMOTE_HOST tests for dynamic links or doing form-to-email type stuff. Entering data INTO a db adds a whole new set of challenges. I'd appreciate any other advice or clarification you could offer. Thanks, -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 4:25 PM To: 'Rob Walls'; [EMAIL PROTECTED] Subject: RE: [PHP] Escaping Chars I need to get a password value from a form, store it in a database and then later be able to compare a login password to the one stored in the db. This works great unless the password contains the '\' char. magic_quotes_gpc is ON and magic_quotes_runtime is OFF. As a klude, I tried just removing slashes from the input password using stripslashes() before storing it in the db and then testing to see if stripslashes(val from db)=stripslashes(val from form) in the login test to see if they match. (the user shouldn't even know that slashes are being striped, so I have to strip them on each input). They still don't match if a slash is input for the original password storage, but I don't know why. Okay... you want the slash or escape character there when you insert it into the database. But, since it's an escape character, it doesn't actually go into the data of the database. If you put O'Kelly into your form, magic_quotes_gpc will turn it into O\'Kelly. If you insert that into the database, it'll use the \ as an escape character and the data in the database will actually be just O'Kelly. With magic_quotes_runtime OFF, that's exactly what you'll draw out of the database, too. So, if you want to compare a form submitted value to a value drawn out of the database, you have to use stripslashes() on the form data first. A better option overall is to just do it in your query. SELECT * FROM table WHERE user = '{$_POST['user']} and password = '{$_POST['password']}' Where your form is method=POST... If a row is returned, the username and password matched. If no row is returned, then one or both didn't match. ---John Holmes... PS: Just noticed the .af.mil address. Do you do any PHP programming for the AirForce or is this on your own? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php