I'm currently running a joomla 3x portal and need to insert a string into my MySQL database, but have had no success so far (sadly, I'm not a programmer).
So I added a new field into my users table called "ok1" and just want to insert a string into it (actually a hyperlink) and overwrite it every time with the current one on the page that executed the code last.
This is the code I used, but it always "blows" my portal...
$query = $db->getQuery(true);
$columns = "ok1";
$values = "my hyperlink";
$query
->insert($db->quoteName('#__users'))
->columns($db->quoteName($columns))
->values($db->quoteName($values));
$db->setQuery($query);
$db->execute();
$query = $db->getQuery(true);
$db->setQuery($query);
$db->execute();
Hopefully somebody can help me out with this one, thanks in advance.
Second attempt:
$content ="test"
$query = $db->getQuery(true);
Update `x__users` SET `ok1`=$content WHERE `user` = $user->id;
$db->setQuery($query);
$result = $db->execute();