Update Row If IP = IP in database
Moderator: General Moderators
- nickman013
- Forum Regular
- Posts: 764
- Joined: Sun Aug 14, 2005 12:02 am
- Location: Long Island, New York
- nickman013
- Forum Regular
- Posts: 764
- Joined: Sun Aug 14, 2005 12:02 am
- Location: Long Island, New York
Code: Select all
echo "<form action=/rmvcmt.php>";
echo '<input type=hidden name=ip value='.$ip.'>';
echo '<input type=hidden name=id value='.$row4['id'].'>';
echo '<div align=right><input type=submit value="Delete My Comment"></div></form>';
};Thats the form.. I was looking in the source at the input values and they were correct... I just realized that the problem was I didnt set a method on the form. Thanks Alot.
thank you all so much for helping me.!!!!!!!
- nickman013
- Forum Regular
- Posts: 764
- Joined: Sun Aug 14, 2005 12:02 am
- Location: Long Island, New York
Actually I got one more quick question (I hope)..
How can I add multiple WHERE's in my query.
This is my query that displays the comments
How can I make it select the comments where row = number AND where show = 1 ?
How can I add multiple WHERE's in my query.
This is my query that displays the comments
Code: Select all
$sql4 = "SELECT * FROM `comments` WHERE who =" . $row['Number'] . " ORDER BY `id` DESC";after a WHERE, you need to have a boolean expression.
You can use the keywords AND and OR to make that
so say you want to select where fruit=apple or fruit=grape and vegetable=carrot you would do something like
WHERE (fruit='apple' OR fruit='grape') AND vegetable='carrot'
AND's are usually performed before OR's so make sure you get parantheses right.
so for your case it would be:
You can use the keywords AND and OR to make that
so say you want to select where fruit=apple or fruit=grape and vegetable=carrot you would do something like
WHERE (fruit='apple' OR fruit='grape') AND vegetable='carrot'
AND's are usually performed before OR's so make sure you get parantheses right.
so for your case it would be:
Code: Select all
$sql4 = "SELECT * FROM `comments` WHERE who =" . $row['Number'] . " AND show=1 ORDER BY `id` DESC";- nickman013
- Forum Regular
- Posts: 764
- Joined: Sun Aug 14, 2005 12:02 am
- Location: Long Island, New York
- nickman013
- Forum Regular
- Posts: 764
- Joined: Sun Aug 14, 2005 12:02 am
- Location: Long Island, New York
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Code: Select all
$id = intval($_POST['id']);
$ip = intval($_POST['ip']);