retrieve data from database

mmu - July 24, 2008 - 03:45

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

You can retrieve all the

nevets - July 24, 2008 - 03:57

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
}

thx but see this

mmu - July 24, 2008 - 04:14

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

 
 

Drupal is a registered trademark of Dries Buytaert.