Kshitij Pandey
Kshitij Pandey

Reputation: 114

How do I fetch and change tinyint values from phpmyadmin and change their values in php

I've set some flags using tiny int in my database and I want to retrieve them, check their values and change them accordingly. How can I do that?

db_connect.php:-

  <?php

    $dbhost = 'localhost';
    $dbname =  'eden';
    $dbuser =  'root';
    $dbpass =  '';

    $conn = mysqli_connect($dbhost, $dbuser, $dbpass);


   if(!$conn)
   {
    die("Connection Failed");
    }
    mysqli_select_db($conn,$dbname);
    ?>

 <?php
   if ($row['S_status']==1)
   {
    echo "Selection Done";
    $row['D_status']=1;
    }
  ?>

Table structure:-
info_id(int)
Enrol_id(varchar)
ES_name(varchar)
S_status(tinyint)
D_status(tinyint)

Upvotes: 1

Views: 368

Answers (1)

mitkosoft
mitkosoft

Reputation: 5316

You don't need PHP for that, just SQL:

UPDATE yourTable SET D_status = 1 WHERE S_status = 1;

You can run this statement directly into PHPMyAdmin.

Upvotes: 1

Related Questions