php - joomla 3x insert a string into sql database -
i'm running joomla 3x portal , need insert string mysql database, have had no success far (sadly, i'm not programmer).
so added new field users table called "ok1" , want insert string (actually hyperlink) , overwrite every time current 1 on page executed code last.
this code used, "blows" 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 can me out one, in advance.
second attempt:
$content ="test" $query = $db->getquery(true); update `x__users` set `ok1`=$content `user` = $user->id; $db->setquery($query); $result = $db->execute();
what want this
$columns = "ok1"; $values = "my hyperlink"; $query ->update($db->quotename('#__users')) ->set($db->quotename($columns) = $db->quote($values)) ->where($db-quotename('user') = $user->id) ; $db->setquery($query); $db->execute();
that want update record not insert new one, , want specific record indicated clause. use correct quote values (since not names).
Comments
Post a Comment