Displaying records base on userid for connectivity form

click2tman 30 Aug, 2009
How to display results from table base on user's username and login status.

I have a table with billing information for customers. Each customer have a unique userid which is used to login to my website and a password. The table is linked to joomla registration, this way customers are automatically registered into my website everytime I import the csv into my database.

below is the link to display the table result and form used to populate the table

http://fbcusl.net/sierratel/index.php?option=com_chronoconnectivity&connectionname=Billing_System&Itemid=114

http://fbcusl.net/sierratel/index.php?option=com_chronocontact&Itemid=113

Right now the permissions to view the table results are set to registered users only. But when a registered user clicks on it, all records in the table are displayed. I want only records matching the users information base on their login status/userid enter to be display because it will make no sense displaying other customers billing information

Please help.
GreyHead 30 Aug, 2009
Hi click2tman,

Add a where clause using the logged in user id.

Bob
click2tman 31 Aug, 2009

Hi click2tman,

Add a where clause using the logged in user id.

Bob



Where do I add that where clause? I already have one in the where clause section for the search functionality.
GreyHead 31 Aug, 2009
Hi click2tman,

Yes that's it - if I understand correctly - you need to limit the search to their results.

Bob
click2tman 01 Sep, 2009
I am a beginner so am not sure of my code. I have tried the code below in the where clause section but I get errors
MyCode
"<?php $mycurrentuser = JRequest::getVar (username); ?>"
WHERE cf_user_id="<?php echo JRequest::getVar('username') ; ?>"


Error

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"" WHERE cf_user_id=""' at line 1 SQL=SELECT count(*) FROM main_billingsystem "" WHERE cf_user_id=""
Warning: Invalid argument supplied for foreach() in /home/content/e/d/u/eduportal/html/sierratel/components/com_chronoconnectivity/libraries/connection.php on line 300
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"" WHERE cf_user_id=""' at line 1 SQL=SELECT count(*) FROM main_billingsystem "" WHERE cf_user_id=""



I also tried this but it did not work either
SELECT * FROM `main_billingsystem` WHERE cf_user_id = 62

62 is my joomla userid

All I need is a code to get my current login userid, pass it over and use it in the where clause to display information from the table for that user alone. Please help. This is a school project am working on.
GreyHead 01 Sep, 2009
Hi click2tman,

You seem to have a lot of quotes in there. And you are comparing username with user_id
<?php 
$user =& JFactory::getUser();
?>
WHERE `cf_user_id` = '<?php echo $user->id; ?>'

Bob
Cranky-9 05 Sep, 2011
First of all my heartful thanks for the solution provided.

I could get the instances created but the values are not being displayed. I find the blank instances.

I am using Adobe Livecycle Designer 7.1 for designing the form. I have Adobe Reader 7.0.0 installed in my system. Is it a problem? Should I have a version which is higher than that?
GreyHead 05 Sep, 2011
Hi Crank-9,

Sorry but there's nothing I can reply to there :-(

Please be specific about what code you are using and where you are seeing blank results.

Bob

PS The version of Acrobat Reader shouldn't make much/any difference. I don't know about Livecycle designer.
This topic is locked and no more replies can be posted.