UPDATE database - not working

My goal is to have the value in the “commission” column in my “status” table change from ‘open’ to ‘closed’ I can’t seem to get the BD to update. I do not get any errors. What am I doing wrong?

This is the code for my submit button:

if($result["commissions"]=='open'){ echo '<form method="post" action="admin_main.php"> <input name="commissionsC" type="submit" value="Close commissions" /> </form>'; }

This is the part of my code that is not working:

[php]<?php
include(“includes/connect.php”);
if(isset($_POST[‘comissionsC’])){

$res= mysql_query(“SELECT * FROM status”);
$row= mysql_fetch_array($res);
$sql=“UPDATE status”.
“SET commissions = ‘closed’”.
“WHERE id = 1”;
}

?>[/php]

Add a space . This is what the server sees,

$sql=“UPDATE statusSET commissions = 'closed’WHERE id = 1”;

What is the point of the select statement? You aren’t doing anything with the result.

You are using obsolete Mysql code. You need to use PDO or Mysqli with prepared statements.

Sponsor our Newsletter | Privacy Policy | Terms of Service