Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Niekaip nerandu klaidos MySQL užklausoje

Parašė Clepter· 2008 Vas. 24 19:02:11
#3

Bandžiau jau, 0 buvaus padaręs default ir buvau ištrynęs tą kodo dalį, tačiau nieko... Yra keli INT atributai, bet į juos vedami skaičiai, todėl nelygūs 0, todėl neturėtų nepripažinti. Štai įvedimo kodas, kad žinotumėte, kas vedama į laukelius:

} elseif ($stype == "d") {
if (isset($_POST['submit_download'])) {
if ($_POST['download_title'] != "" && $_POST['download_description'] != "" && $_POST['download_url'] != "" && $_POST['download_license'] != "" && $_POST['download_os'] != "" && $_POST['download_version'] != "" && $_POST['download_filesize'] != "") {
$submit_info['download_title'] = stripinput($_POST['download_title']);
$submit_info['download_description'] = stripinput($_POST['download_description']);
$submit_info['download_url'] = stripinput($_POST['download_url']);
$submit_info['download_cat'] = stripinput($_POST['download_cat']);
$submit_info['download_license'] = stripinput($_POST['download_license']);
$submit_info['download_os'] = stripinput($_POST['download_os']);
$submit_info['download_version'] = stripinput($_POST['download_version']);
$submit_info['download_filesize'] = stripinput($_POST['download_filesize']);
$result = dbquery("INSERT INTO ".$db_prefix."submissions (submit_type, submit_user, submit_datestamp, submit_criteria) VALUES ('d', '".$userdata['user_id']."', '".time()."', '".serialize($submit_info)."')");
opentable($locale['400']);
echo "<center><br>\n".$locale['410']."<br><br>
<a href='submit.php?stype=d'>".$locale['411']."</a><br><br>
<a href='index.php'>".$locale['412']."</a><br><br>\n</center>\n";
closetable();
}
} else {
$opts = "";
opentable($locale['400']);
$result = dbquery("SELECT * FROM ".$db_prefix."download_cats ORDER BY download_cat_name");
while ($data = dbarray($result)) {
if (checkgroup($data['download_cat_access'])) $opts .= "<option>".$data['download_cat_name']."</option>\n";
}
if (!empty($opts)) {
echo $locale['420']."<br><br>
<form name='submit_form' method='post' action='".FUSION_SELF."?stype=d' onSubmit='return validateLink(this);'>
<table align='center' cellpadding='0' cellspacing='0'>
<tr>
<td class='tbl'>Pavadinimas:</td>
<td class='tbl'><input type='text' name='download_title' maxlength='100' class='textbox' style='width:300px;'></td>
</tr>
<tr>
<td class='tbl'>Vaizdelis.lt Kodas</td>
<td class='tbl'><input type='text' name='download_description' maxlength='200' class='textbox' style='width:300px;'></td>
</tr>
<tr>
<td class='tbl'>URL:</td>
<td class='tbl'><input type='text' name='download_url' maxlength='200' class='textbox' style='width:300px;'></td>
</tr>
<tr>
<td class='tbl'>Kategorija:</td>
<td class='tbl'><select name='download_cat' class='textbox'>
$opts</select></td>
</tr>
<tr>
<td class='tbl'>Idejo</td>
<td class='tbl'><input type='text' name='download_license' maxlength='100' class='textbox' style='width:300px;'></td>
</tr>
<tr>
<td class='tbl'>Formatas:</td>
<td class='tbl'><input type='text' name='download_os' maxlength='100' class='textbox' style='width:300px;'></td>
</tr>
<tr>
<td class='tbl'>Kokybe:</td>
<td class='tbl'><input type='text' name='download_version' maxlength='200' class='textbox' style='width:300px;'></td>
</tr>
<tr>
<td class='tbl'>Failo Dydis:</td>
<td class='tbl'><input type='text' name='download_filesize' maxlength='200' class='textbox' style='width:300px;'></td>
</tr>
<tr>
<td align='center' colspan='2' class='tbl'><br>
<input type='submit' name='submit_download' value='".$locale['425']."' class='button'>
</td>
</tr>
</table>
</form>\n";


O čia yra MySQL lentelės struktūra:

CREATE TABLE `fusion_downloads` (
`download_id` smallint(5) unsigned NOT NULL auto_increment,
`download_title` varchar(100) NOT NULL default '',
`download_description` text NOT NULL,
`download_url` varchar(200) NOT NULL default '',
`download_cat` smallint(5) unsigned NOT NULL default '0',
`download_license` varchar(50) NOT NULL default '',
`download_os` varchar(50) NOT NULL default '',
`download_version` varchar(20) NOT NULL default '',
`download_filesize` varchar(20) NOT NULL default '',
`download_datestamp` int(10) unsigned NOT NULL default '0',
`download_count` smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (`download_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=259 ;

Redagavo bad_user· 2008 Vas. 28 18:02:04