Page 1 of 1

The best way to pull data form FrontEndUsers

Posted: Thu Apr 24, 2014 2:57 pm
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>';	
		
		}
?>

Re: The best way to pull data form FrontEndUsers

Posted: Thu Apr 24, 2014 3:16 pm
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.

Re: The best way to pull data form FrontEndUsers

Posted: Tue Apr 29, 2014 8:23 am
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?