I have huge problems saving data to my table in my database. Although the connection seems to be created without a problem, the data won't be stored. My plan is to write a download-archive-skript. You can enter data into some HTML-Forms that pass their data to the PHP Skript using <? $echo.... >.
After I submit my data ($sumbit gets triggered) I get a self-defined error (look at end of code) that tells me that I have a problem. I checked if the database and the table habe been setup correctly. There were no problems. First, here's a dump of the table (downloadarchiv):
CREATE TABLE downloadarchiv (
id tinyint(4) NOT NULL auto_increment,
rubrik varchar(80),
programmname varchar(80),
version varchar(80),
groesse varchar(80),
sprache varchar(80),
homepage varchar(80),
programmicon varchar(80),
beschreibung longblob,
download_a varchar(80),
adresse_a1 varchar(80),
adresse_b1 varchar(80),
adresse_c1 varchar(80),
download_b varchar(80),
adresse_a2 varchar(80),
adresse_b2 varchar(80),
adresse_c2 varchar(80),
sreenshot_a varchar(80),
sreenshot_b varchar(80),
sreenshot_c varchar(80),
sreenshot_d varchar(80),
PRIMARY KEY (id)
);
Now here is the PHP Code:
<?
$db_host = "xxx";
$db_user = "xxx";
$db_pass = "xxx";
$db_name = "xxx";
if ($submit) {
@mysql_pconnect($db_host,$db_user,$db_pass);
@mysql_select_db($db_name);
$sql = "INSERT INTO downloadarchiv (rubrik,programmname,version,groesse,sprache,homepage,programmicon,beschreibung,download_a,
adresse_a1,adresse_b1,adresse_c1,download_b,adresse_a2,adresse_b2,adresse_c2,screenshot_a,screenshot_b,
screenshot_c,screenshot_d)"." VALUES('$rubrik','$programmname','$version','$groesse','$sprache','$homepage',
'$programmicon','$beschreibung','$download_a','$adresse_a1','$adresse_b1','$adresse_c1','$download_b','$adresse_a2',
'$adresse_b2','$adresse_c2','$screenshot_a','$screenshot_b','$screenshot_c','$screenshot_d')";
if ($result=mysql_query($sql))
{
echo "Success!";
echo "Result-String:"; echo $result;
MYSQL_CLOSE();
}
else
{
echo "Error!";
}
}
?>
After that code is some HTML stuff (forms).
Any hints why the data wont't be stored into my table "downloadarchiv"??