The best way to pull data form FrontEndUsers

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
skylineitbv
New Member
New Member
Posts: 4
Joined: Wed Sep 25, 2013 11:10 am

The best way to pull data form FrontEndUsers

Post by skylineitbv »

Hello,

I'm building a custom system for my website, that uses data from the FrontEndUsers-module. I went into PHPMyadmin to see the datastructure this module is using, so I could efficiently pull the data I wanted from the tables. Problem is, the way this module stores it's user data makes it pretty difficult to get the data out the way i would like.. Forcing me to make a query in PHP that fetches all the values from the data column that matches a certain ID, and put the data in an array. In this way, data is not always in the same order.

I'm sure there is a more efficient way to pull the exact data I want. Am I missing something?

This is an example I use:

Code: Select all

<?php
$toegewezen_1 = 'info@jumacom.nl';
	
$usertable='cms_module_feusers_properties'; //table
$usertable2='cms_module_feusers_users'; //table
$userid='cms_module_feusers_properties.userid';
$id='cms_module_feusers_users.id';
$title='title';
$username='username';
$data='data';
        	
$query = "SELECT * FROM $usertable JOIN $usertable2 ON $id = $userid AND $username = '$toegewezen_1'";
			
	//WHERE $username = $toegewezen_1

	$result = mysql_query($query);
		if($result) {
				
		$datarow = array();
				
			while($row = mysql_fetch_assoc($result)){
        		
				$datarow[] = ("$row[$data]");
					
			}
			
			echo '<p>'.$datarow[0].'</p>';
			echo '<p>'.$datarow[1].'</p>';
			echo '<p>'.$datarow[2].'</p>';
			echo '<p>'.$datarow[3].'</p>';
			echo '<p>'.$datarow[4].'</p>';
			echo '<p>'.$datarow[5].'</p>';
			echo '<p>'.$datarow[6].'</p>';
			echo '<p>'.$datarow[7].'</p>';
			echo '<p>'.$datarow[8].'</p>';
			echo '<p>'.$datarow[9].'</p>';	
		
		}
?>
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: The best way to pull data form FrontEndUsers

Post by calguy1000 »

You cannot count on the order of the properties in the database.

a: users can be members of different, or multiple groups
b: different user properties can be associated with each group
c: different sort orders for properties in groups can influence their order in the database
d: empty values are not typically saved to the database.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
skylineitbv
New Member
New Member
Posts: 4
Joined: Wed Sep 25, 2013 11:10 am

Re: The best way to pull data form FrontEndUsers

Post by skylineitbv »

I was afraid of this. Is there a way to pull the data out in a certain order? Maybe taking values in the title-column into account so they match up with the data-column?
Post Reply

Return to “Modules/Add-Ons”