hi , i need to retrieve data from data base , here is the situation ;

Data Store here ==>> db_query("INSERT INTO {rank} (uid, name) values (%d, '%s')", $user->uid, $data);

how can i read the data ?
i used this , $sql = "select count (*) from {rank} ;
can any one give me the correct one , thx

Comments

nevets’s picture

You can retrieve all the records from rank with something like this

$results = db_query("SELECT uid, name FROM {rank}";
while ( $rank = db_fetch_object($results) ) {
  // You can now use $rank->uid and $rank->name
  // to access the data for one record
}
mmu’s picture

function garland_user_profile($account, $fields){
	$output = '<div class="profile">';
	$output .= theme('user_picture', $account);
	foreach ($fields as $category => $items) {
		if (strlen($category) > 0) {
			$output .= '<h2 class="title">'. check_plain($category) .'</h2>';
		}
		$output .= '<dl>';
		foreach ($items as $item) {
			if (isset($item['title'])) {
				$output .= '<dt class="'. $item['class'] .'">'. $item['title'] .'</dt>';
			}
			$output .= '<dd class="'. $item['class'] .'">'. $item['value'] .'</dd>';
		}
	               	$output .= '</dl>'; 
	}
	$output .= '</div=">';
	return $output;
} 

Where can i add $result to view the output?? thx