Great God, please help, thank you!

Source: Internet
Author: User
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 ' \ n ";Case UserName:Echo ' \ n ";Case Realname:Echo ' \ n ";Case Department:Echo ' \ n ";Case PassWord:Echo ' \ n ";Case Email:Echo ' \ n ";Case MyGroup:Echo ' \ n ";Case Workphone:Echo ' \ n ";Case HomePhone:Echo ' \ n ";Case Mobilephone:Echo ' \ n ";Case CurrentTime:Echo ' \ n ";Case EndTime:Echo ' \ n ";Case Status: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 ') ';} echo " \ n ";}echo "
'.
"ID";
echo "
'.
"User name";
echo "
'.
"Real name";
echo "
'.
"Department";
echo "
'.
"Password";
echo "
'.
"E-mail";
echo "
'.
"Group";
echo "
'.
"Work phone";
echo "
'.
"Home Phone";
echo "
'.
"Mobile phone";
echo "
'.
"Registration Time";
echo "
'.
"End Time";
echo "
'.
"Audit";
echo "
';
if ($i = = (Mysql_num_fields ($user _query)-1) {
echo $row [$i]. "";
}else{
echo "$row [$i]";
}

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 ';
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.