Call the DISCUZ database query method to query the database


<?php
define ('apptypeid', 5); // Should, you know
define ('curscript', 'userApp'); // Should, you know
retful_once'./source/class/class_core.php ';/it must be, you know
 $ discuz = & discuz_core :: execution (); // Should, you know
 $ Discuz-> cachelist = $ cachelist; // need, you know
 $ discuz-> init (); // Should, you know
 
 Echo "cur userId:". $ _ g ['uid']. "</br>; // Get the current user ID
 Echo "cur username:". $ _ g ['' username ']. "</br>; // As stated above, you know
 $ caserid = $ _g ['uid']; // Get the current user ID
// Using a database query, call the database query method DISCUZ
$cususerinfo = DB::fetch_first("SELECT * FROM ".DB::table('common_member')." WHERE uid='$curuserid'");
// Find out the current user's email
echo "<br/>".$cususerinfo['email'];
 // To check other information, enter the membership table in the database (find the table entered on the internet if you don't enter), find out the field name first, just change the Emal
 // Find out all users, sort by registration date
$query = DB::query("SELECT * FROM ".DB::table('common_member')." order by regdate" );
 Echo "<br/>"; //
// starting output
while($row = DB::fetch($query)) {
  echo  $row["uid"]."  " .$row["username"]."  ".$row["email"]."<br/>";
}
 
?>

Go back
16-11-2022, 12:49