Jump to content

Recommended Posts

Guys need help in using forms, I have 4 fields in my database table named "ipadd". I have a search form that handle the queries inputted by the user. The user will input values in this format "192.168.2.1". In the database table, the values in each octet of the IP address is distributed in the four fields. For example using the value "192.168.2.1". The value of the 1st Octet "192" is in the 1st field of the database named "IP1". "168" will be in the second field and so on. However the value of the 1st and the second Octet is constant: "10" and "0". The problem is how can I get the value of the third and 4th Octet in php (can I use the trim command?). Please check my code:


case "ip":
$ip1 = 10;
$ip2 = 0; $ip3 = // What should I put in here?
$ip4 = // What should I put in here?
$rs = mysql_query("SELECT * FROM ipadd WHERE IP1 LIKE'%".$_GET['ip1']."%' AND IP2 LIKE'%".$_GET['ip3']."%' AND IP3 LIKE'%".$_GET['ip3']."%'" AND IP4 LIKE'%".$_GET['ip4']."%'");
break;
Link to comment
https://forums.phpfreaks.com/topic/10166-pls-help-php-and-forms/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.