sjones Posted March 12, 2006 Share Posted March 12, 2006 Can someone give me an idea of how to put a INSERT statement - with a WHERE clause. below is my blown example. I am calling the vendors from the database, allowing one of them to be selected, then hit an active or inactive radio button (active_id) I would like to upload the active_id to the vendors table where the $_POST['vendor_id'] = the vendor_id in the table. Any Thoughts ????if(!empty($_POST['submit'])) { [b]$qry = mysql_query("INSERT INTO vendors (active_id) VALUES ('".$_POST['active_id']."') WHERE (vendor_id) = ('".$_POST['vendor_id']."');");[/b] if($qry) { echo "<span class='content_blank'><strong>Vendor has been activated</strong></span>"; } else { echo "<span class='content_blank'><strong>Error activating vendor</strong></span>"; } } Link to comment https://forums.phpfreaks.com/topic/4760-solved-a-simple-query-i-hope/ Share on other sites More sharing options...
trq Posted March 12, 2006 Share Posted March 12, 2006 You need to use an UPDATE statement, not an INSERT. Link to comment https://forums.phpfreaks.com/topic/4760-solved-a-simple-query-i-hope/#findComment-16711 Share on other sites More sharing options...
sjones Posted March 12, 2006 Author Share Posted March 12, 2006 Thank you that worked out fine. Link to comment https://forums.phpfreaks.com/topic/4760-solved-a-simple-query-i-hope/#findComment-16782 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.