how to send user $ to database - Joomla! Forum - community, help and support
i have several scripts workin in tandom on page pulling user data , displaying on screen , pulling data flash file , posting database. unable attach username data input database page. suggestions on method pulling username jfactory::getuser , inserting database. data being populated new table not trying overwrite data user tables.
here have far.
here have far.
code: select all
{source 0}<?php
$user =& jfactory::getuser();
if (!$user->guest) {
echo 'owner: ' .$user->username;
}?>{/source}
{source 0}
<?php
$image_id=$_get['imageid'];
$image_url=$_get['imageurl'];
$image_name=$_get['imagename'];
echo "id : $image_id<br/>url : $image_url<br/>name : $image_name";
echo $username
?>
{/source}
{source 0}<?php
$data =new stdclass();
$data->image_id = $image_id;
$data->image_url = $image_url;
$data->image_name = $image_name;
$db = jfactory::getdbo();
$db->insertobject('#__image_data', $data, image_id, $data, image_url, $data, image_name);
?>{/source}
code: select all
<?php
$data =new stdclass();
$data->image_id = $image_id;
$data->image_url = $image_url;
$data->image_name = $image_name;
$db = jfactory::getdbo();
$db->insertobject('#__image_data', $data, image_id, $data, image_url, $data, image_name);
?>i've never used insertobject method before, syntax appear incorrect
try this
code: select all
<?php
$data =new stdclass();
$data->image_id = $image_id;
$data->image_url = $image_url;
$data->image_name = $image_name;
$data->user_name = $user->username;
$db = jfactory::getdbo();
$db->insertobject('#__image_data', $data, image_id);
?>this assumed 2 things
-that have field called user_id (if name different edit in stdclass object)
-that image_id primary key of table #__image_data
i said i've never used insertobject method, think if works- save me great deal of time! thank introducing me.
Comments
Post a Comment