God Help, please, thank you!!
I want to make a button under the audit, click Audit. Just My code over there will not achieve ah, how to add buttons, how to do it, eldest brother, elder sister to help Isaac!! It's a split.
------Solution--------------------
The information given is not complete at all.
Probably as follows:
The above is the data that you loop to read, 1 is the representative has passed the audit, 0 represents not audited,
So when you build the list, you add a judgment.
if ($row [' xxx '] = = ' 1 ') {
echo ' audited ';
}else{
echo ' Audit ';
}
is equivalent to an editorial page.
Implementation Method 2: Directly with Ajax implementation.
------Solution--------------------
Echo ' Button'
Click on the time to get value values with Ajax to PHP for processing, modify the status of the data is 1 to be examined, the kernel defaults to 0
------Solution--------------------
Error_reporting (E_all&~e_notice);
Session_Start ();
Check whether to log in, and then turn to the login screen if not logged in
if (!isset ($_session[' userid ')) {
Header ("Location:login.html");
Exit ();
//}
Include database connection file
Include (' connect.php ');
$userid = $_session[' userid '];
$username = $_session[' username ');
$user _query = mysql_query ("Select Username,realname,department,password,email, Mygroup,workphone,homephone, Mobilephone,currenttime,endtime,status from UserInfo ORDER by ID ASC ");
$row = mysql_fetch_array ($user _query);
Echo '
';Show Field namesecho "\ n
\ n ";Switch (Mysql_field_name ($user _query, $i)) {Case ID:Echo '
'. "ID"; echo " | \ n ";Case UserName:Echo '
'. "User name"; echo " | \ n ";Case Realname:Echo '
'. "Real name"; echo " | \ n ";Case Department:Echo '
'. "Department"; echo " | \ n ";Case PassWord:Echo '
'. "Password"; echo " | \ n ";Case Email:Echo '
'. "E-mail"; echo " | \ n ";Case MyGroup:Echo '
'. "Group"; echo " | \ n ";Case Workphone:Echo '
'. "Work phone"; echo " | \ n ";Case HomePhone:Echo '
'. "Home Phone"; echo " | \ n ";Case Mobilephone:Echo '
'. "Mobile phone"; echo " | \ n ";Case CurrentTime:Echo '
'. "Registration Time"; echo " | \ n ";Case EndTime:Echo '
'. "End Time"; echo " | \ n ";Case Status:Echo '
'. "Audit"; echo " | \ n ";}echo "
\ n ";if (mysql_fetch_row ($user _query) = = "0") {echo "No record! ";Exit}Navigate to the first recordMysql_data_seek ($user _query, 0);Loop out Recordswhile ($row =mysql_fetch_row ($user _query)){echo "
\ n "; for ($i =0; $i {echo ')
'; if ($i = = (Mysql_num_fields ($user _query)-1) { echo $row [$i]. ""; }else{ echo "$row [$i]"; }
Echo ' | ';} echo "
\ n ";}echo "
\ n ";
Freeing resources
Mysql_free_result ($user _query);
Close connection
Mysql_close ();
?>
------Solution--------------------
If you come here, write a link!
{
Index.php is the equivalent of your present. php file
echo "";
}else{
echo "$row [$i]";
}
Also use this page to receive:
if (Isset ($_get))
{
$status =$_get[' status '];
$userid =$_get[' userid '];
Then write the SQL statement
Update tablename set status= $status where userid= $userid;
}
The above is just to provide you with this idea, the code does not have any processing, the actual use of the need for your own tuning
------Solution--------------------
if ($i = = (Mysql_num_fields ($user _query)-1)) {
if ($row [$i] = = 1) {
echo ' audited Input type= "button" value= "Audit" onclick= "location.href=". " ' Processing page address? status= ' 0&userid=" $row [' id ']."'" '. ' ">';
} else {
echo ' is not audited ';