Jump to content

DCM

Members
  • Posts

    39
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

DCM's Achievements

Member

Member (2/5)

0

Reputation

  1. I think i have solved my first query by casting the contents to TEXT as below so i can now do partial queries: SELECT * FROM network_table WHERE network::TEXT LIKE '%192.%'; I would still however really appreciate a practical example of how some of the more advanced cidr functions can be used to for example: 1> Determine if a network exists. 2> If a new network allocation falls within the range of an already existing network. If the network 192.168.1.0/24 exists then i would like to be able to detect that allocating 192.168.1.16/28 would cause a conflict.
  2. Hi i have a table which contains IP networks stored as a cidr data type in postgreSQL. I have read the offical support page on both inet and cidr but I cannot find a simple practical example where this data type is queried in SQL statement, at least not to achieve the below? if for example the table was as follows: Network_Name | Network_Address ---------------------------------------------- Network A | 192.168.1.0/24 Network B | 192.168.2.0/24 Network C | 192.168.3.0/24 Network D | 10.1.1.0/24 Network E | 10.1.2.0/24 Network F | 10.1.3.0/24 How can i construct an SQL query querying data stored in the Network_Address that matches/contains the users search criteria of say '192.168.': I would like this to return all the 192.168.x.x networks. This seems to work with the inet type as it lets you use the LIKE command but cidr will not allow this. If i type in the full Network address is works, but i need to be able to do partial searches. I would also like to be able to do more advanced things such as checking if a network already exists or overlaps/conflicts with current assigned networks. From what i have read i think i may need to do something called casting with the functions available to the cidr data type but i'm not really sure how to go about it. Thanks for reading, any pointers are appreciated
  3. Thanks thats fixed it I added 'AddType application/x-httpd-php .php' to the following section: <IfModule mime_module> AddType application/x-httpd-php .php </IfModule> I do use short tags occassionly yes but i should probably go away and change them to the full version. Thank you again very much for you prompt assistance.
  4. Hi I am tryng to get PHP/Apache working on a windows 2003 server (standard edition 32 bit). I currently have this setup working on my XP machine and i have used the same installers/locations/config files. However Apache is not parsing the PHP files, i simply get the raw text outputted. The specifics of my install are: - Windows 2003 server 32bit standard edition - Apache - httpd-2.2.16-win32-x86-no_ssl.msi - PHP - php-5.2.14-win32-installer.msi - Apache install dir: c:\apache - PHP install dir: c:\php I have also attached my php.ini file and httpd.conf file as this must be where the issue lies but i cannot see it I have renamed the atatched files .txt so i can post them on here Any help advice is greatly appreciated, I dont understand my this wont work as its pretty much a direct port of a working config on my XP machine. [attachment deleted by admin]
  5. Thanks I'll give it a try.. I was also looking at array_splice which may also work without me having to sort the array. Idealy i do not want to disturb the order in which data is displayed in the array as it (in my real app) will have been pr-ordered by the user selecting from a sort by radio button selection. making progress though so thanks.
  6. typo in presious reply, the original array is defined as : $_SESSION['myarray'][0][0] = "aaa"; $_SESSION['myarray'][0][1] = "111"; $_SESSION['myarray'][1][0] = "bbb"; $_SESSION['myarray'][1][1] = "222"; $_SESSION['myarray'][2][0] = "ccc"; $_SESSION['myarray'][2][1] = "333"; $_SESSION['myarray'][3][0] = "ddd"; $_SESSION['myarray'][3][1] = "444";
  7. Sure the above is simply and example but if example the array at present is as above such that the values assigned are $_SESSION['myarray'][0][0] = "aaa"; $_SESSION['myarray'][0][1] = "111"; $_SESSION['myarray'][1][0] = "bbb"; $_SESSION['myarray'][1][1] = "222"; $_SESSION['myarray'][2][0] = "ccc"; $_SESSION['myarray'][2][1] = "333"; $_SESSION['myarray'][2][0] = "ddd"; $_SESSION['myarray'][2][1] = "444"; A quick for loop to output the results given that $numrecs currently equals 4 for ($x=0; $x<$numrecs; $x++) { echo $_SESSION['myarray'][$x][0] ."<br>"; echo $_SESSION['myarray'][$x][1] ."<br>"; } would give as output: aaa 111 bbb 222 ccc 333 ddd 444 If say record $_SESSION['myarray'][1] has been deleted in the back end data base and $numrecs reduced by one, then on refresh of the webpage i would the contents of the array to display as: aaa 111 ccc 333 ddd 444 However at present i can't seem to get this to work, to delete the data in the array I do unset ($_SESSION['myarray'][1][0]); unset ($_SESSION['myarray'][1][1]); However on re-running the for loop i then get the below as output: aaa 111 ccc 333 When it should be: aaa 111 ccc 333 ddd 444
  8. Hi I have a multi-dimension session array as per the below: $_SESSION['myarray'][][] If for example there are several elements stored in the array: $_SESSION['myarray'][0][0] = "aaa"; $_SESSION['myarray'][0][1] = "111"; $_SESSION['myarray'][1][0] = "bbb"; $_SESSION['myarray'][1][1] = "222"; $_SESSION['myarray'][2][0] = "ccc"; $_SESSION['myarray'][2][1] = "333"; $_SESSION['myarray'][2][0] = "ddd"; $_SESSION['myarray'][2][1] = "444"; How can i remove one of the above and shunt the other elements up? I have tried using the unset command but this seems to essentailly nullify the desired values where as what i would like to do is remove them completly from the array and then shorten the total number of records stored in the array. Thanks for taking the time to read this.
  9. Thanks for the reply. At the moment i cannot even seem to get the contents of my $_POST['chbox_delete_host_record'] I have tried various ways, such as testing if it isset, doing a foreach loop but all the time no results are returned. Is there a flaw in the way i am trying to detect which checkboxes have been ticked? The unique value I am assigning is the hostname which is stored in a $?S_SESSION['hosts'][][] array where S_SESSION['hosts'][$x][0] is the hostname for each device. Its this i use when setting the value attribute of the checkbox: <input type='checkbox' name='chbox_delete_host_record[]' value='".$_SESSION['hosts'][$x][0]."'>
  10. I still cant seem to get this working, could anyone please point out what i'm doing wrong. Given i have a session array along the lines of: $_SESSION['hosts'][$x][0] = "HostA" // stores hostname $_SESSION['hosts'][$x][1] = "IP address" //stores IP address $_SESSION['hosts'][$x][2] = "VLAN" // stores VLAN // in reality the data is loaded into the above array from a postgresql DB. // When cylcing through to output the users search results I tag a check box onto the end // of each row of data returned in a for loop as follows for ($x=0; $x < $result_count; $x++) { //other code.... echo "<td><input type='checkbox' name='chbox_delete_host_record[]' value='".$_SESSION['hosts'][$x][0]."'></td>"; } //Upon the user clicking a delete_multiple_hosts button i then try to detect which checkboxes have been aciviated with: if (isset ($_POST['delete_multiple_hosts'])) { for ($x=0; $x < $result_count; $x++) { if (isset ($_POST['chbox_delete_host_record[$x]'])) { echo "checkbox has been activiated for host".$_SESSION['hosts'][$x][0]; //obviously other code would go here i'm just trying to detect which boxes have been checked at present } } }
  11. Hi, my PHP code currently outputs the results from a users search by querying a backend postgresql database. As result/row is retuned to the user i would like to be able to detect whether or not they have checked a checkbox at the end of each rown in which case multiple rows can then be deleted from the database upon the user clicking a 'delete multiple records' button. I have no problem in being able to display the checkboxes on the webpage but i am a little unsure as to how to refernce them and detect which ones the user has checked. Given my database stores hostnames/IP addresses would it be best to name each checkbox to reflect the hostname or name the value it returns when checked to reflect the hostname. Given the above and that I also store the results of a users search in a $_SESSION['hosts'][][] array how can I then tie the two together? Thanks for reading.
  12. Is it possible to set the vertical viewing start posiiton of a page? Instead of the page starting from the top each time it is loaded i want to be able under certain circumstances to present the user with a with a viewing position that is lower down on the page (for example when displaying search results). Thanks for reading.
  13. Thanks for the reply, i think i follow the logical (although I am using postgresql not mysql, my fault i should have said). The part i dont really get is where the final WHERE clause is created, could you please elaborate on the follwoing line: $WHERE = (count($whereParts)>0) ? 'WHERE '.implode(' AND ', $whereParts) : ''; I am assuming that the implode command outputs the contents of the $whereParts array but i dont get the syntax of how that line cycles through and creates the where part?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.