Forums

Saving form back to cb 1.2 table #__comprofiler

tullski 13 Jul, 2008
Hi,

just made my first form.
Like thc cb_profile, which display all the field data.

Is there a way, if a user make changes to the fields and hit the submit button, that the changes will automatically update the #__comprofiler table?

I tried
<?php
$user =& JFactory::getUser();
$db =&JFactory::getDBO();
$database->setQuery( "INSERT * INTO #__comprofiler WHERE user_id = ".$user->get('id'));
		
if (!$database->query()) {
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>";
		}

?>

i enterd this code in the
On Submit code - before sending email:
(PHP code with tags)


No error - no changes in the db?
What im doing wrong?

thx
t
Max_admin 13 Jul, 2008
Hi tullski,

Sorry but the query used is wrong of course!

you need to check if there was changes made or not, depends on your requirements but then you need to update one record existing, look at the forums for UPDATE statements and not INSERT statements

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
tullski 13 Jul, 2008
Hi Max,

sorry the SQL-Code is grap.
I did look around for threads concerning the cb issue, but didn`t find any.

Can you point me to a solution.

Thx
m
This topic is locked and no more replies can be posted.