I have the following code behind the on submit button. This works the value that the user has selected from a list box gets updated But a new blank record is being added as well each time the form gets submitted?? Thanks for any help on this.
<?php
$userid = $_POST['select_5'];
$db =& JFactory::getDBO();
$query = sprintf("UPDATE jos_eventlist_events SET frontpageimage = 'astring' WHERE id = $userid");
$db->setQuery($query);
$db->query();
?>
This is part of the debug trace I'm receiving when submitting the form. I'm guessing the bit marked in red is adding the empty record??
#
SELECT *
FROM `jos_chrono_contact_plugins`
WHERE `form_id` = '18'
AND event IN ('ONSUBMIT','ONLOADONSUBMIT')
AND `name` = ''
#
SELECT *
FROM `jos_chrono_contact`
WHERE `id` = '18'
#
UPDATE jos_eventlist_events
SET frontpageimage = 'astring'
WHERE id = 2
#
SELECT *
FROM `jos_chrono_contact`
WHERE `id` = '18'
#
INSERT INTO `jos_eventlist_events` ( )
VALUES ( )
#
SELECT *
FROM `jos_chrono_contact_plugins`
WHERE `form_id` = '18'
AND event IN ('ONSUBMIT','ONLOADONSUBMIT')
AND `name` = ''
#
SELECT *
FROM `jos_chrono_contact`
WHERE `id` = '18'
#
UPDATE jos_eventlist_events
SET frontpageimage = 'astring'
WHERE id = 2
#
SELECT *
FROM `jos_chrono_contact`
WHERE `id` = '18'
#
INSERT INTO `jos_eventlist_events` ( )
VALUES ( )
This topic is locked and no more replies can be posted.
