vendredi 16 septembre 2016

sql message Table 'testowanie.id' doesn't exist

I have a problem with me code, i wanted to do that when i click on a checkbox and then on the acceptation button some informations will be inserted into my sql database. There is my code:

<form action="checkboxes.php" method="post">
<input type="checkbox" name="chk1"> 4K </input>
<input type="submit" name="Submit" value="Submit"></input>
</form>

<?php
/* Database connection */

$sDbHost = 'localhost';
$sDbName = 'testowanie';
$sDbUser = 'root';
$sDbPwd = '';
$Conn = mysql_connect ($sDbHost, $sDbUser, $sDbPwd);
mysql_select_db ($sDbName, $Conn)

$checkbox1 = $_POST['chk1'];
if ($_POST["Submit"]=="Submit") {
for ($i=0; $i<sizeof($checkbox1); $i++) {
$query="INSERT INTO cena (name) VALUES ('".$checkbox1[$i]."')";
mysql_query($query) or die (mysql_error() );
  }  
echo "Record is inserted";
}
?>

But when i click on the button this don't work and a text appears "Table 'testowanie.cena' doesn't exist" but the problem is that the table really exist.enter image description here

So if someone can help me it will be great. Thanks,




Aucun commentaire:

Enregistrer un commentaire