# \[php\] update mysql database

**URL:** <https://forum.kirupa.com/t/php-update-mysql-database/124765>\
**Category:** Uncategorized\
**Created:** [October 6, 2004, 4:26pm UTC](https://forum.kirupa.com/t/php-update-mysql-database/124765 "2004-10-06T16:26:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alapimba](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@alapimba](https://forum.kirupa.com/u/alapimba)\
**Post date:** [October 6, 2004, 4:26pm UTC](https://forum.kirupa.com/t/php-update-mysql-database/124765/1 "2004-10-06T16:26:25Z")

</div>

hello  
can anyone explain me what can be wrong in this code or give me some extra lines of code to find what can wrong to this thing don’t work?

```php
 
<?php
$dbhost = "localhost"; 
$dbuser = "xxxx"; 
$dbpwd = "xxxx"; 
$dbname = "comuna"; // change this to your database name 
$connection = mysql_connect($dbhost, $dbuser, $dbpwd); 
mysql_select_db("$dbname",$connection);
 
$id = "4";
$sala = "5";
$titulo = "5";
$info = "5";
$descriccao = 5;
 
mysql_query("UPDATE emcena SET sala='$sala', titulo='$titulo', info='$info' descricao='$descriccao', WHERE id='$id' ");
echo "File " . $id . " " . $sala . " " . $info . " " . $descriccao . " " . $titulo . " uploaded successfuly.";
//header("Location: cena.php");
?>

```

if i write this in a file and open in my server… it should add the data to database right? or i need any submit button or something like that? this is probably stupid but ok… i just want to understand why i can’t update the data in this table, cause i can in the other table in the same database… help me please 😕
