how do I add a +1 too the c_request field. every time I do and insert I want to add a 1 to the current number (ex. like a hit counter)
mysql_query("INSERT INTO ed_names (com_id, c_date, c_time, c_type, c_request, c_by)
VALUES ($id, CURRENT_DATE, CURRENT_TIME, '.($type == 'normal' ? 1 : 2).',0,$user)");
$rid = mysql_insert_id();
mysql_query("UPDATE ed_names SET c_request = c_request+1 WHERE id = 'x'");
use update if you want to add to an existing, if not, just enter 1
INSERT INTO ed_names (com_id, c_date, c_time, c_type, c_request, c_by)
VALUES ($id, CURRENT_DATE, CURRENT_TIME, '.($type == 'normal' ? 1 : 2).',1,$user)
if you want to update you can do
update ed_names set c_date = CURRENT_DATE, C_time = CURRENT_TIME, c_type = '.($type == 'normal' ? 1 : 2).''.($type == 'normal' ? 1 : 2).', c_request = c_request + 1, c_by = $user where com_id = $id
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With