Próbuję wykonać następujące zapytanie:
<?
mysql_query (\"INSERT INTO ksiegarnia (product_name, product_number,
product_price,
product_isbn,
product_ean,
product_manufacture,
product_char,
product_picture)
VALUES ('$product_name',
'$product_number',
'$product_price',
'$product_isbn',
'$product_ean',
'$product_manufacture',
'$product_char',
'$product_picture', NOW())\");
?>
W kodzie strony wartości deklaruję w następujący sposób:
<td height=\"160\" width=\"500\" bgcolor=\"#9a9f75\" align=\"center\">
<textarea name=\"product_char\" cols=\"60\" rows=\"7\" value=\"
<?php echo $product_char; ?>\">
</textarea>
</td>
Nazwy pól dokładnie się zgadzają, a mając obawy dwukrotnie to sprawdziłem. Niestety dostaję komunikat:
Kod
Column count doesn't match value count at row 1
Nijak nie mogę znaleźć jego przyczyny.
Poniżej wklejam kod całej strony:
<html>
<head>
<title>PANEL ADMINISTRACYJNY</title>
<meta http-equiv=\"Content Type\" content=\"text/html; charset=iso-8859-2\">
</head>
<body bgcolor=\"#e5e8d1\" align=\"center\">
<?php
//index.php
// konfiguracja
$adres = \"localhost\";
$uzytkownik = \"alpin19\";
$haslo = \"\";
$baza_danych = \"domowa\";
// podłączenie się do mysql
// wybranie bazy
?>
<form name=\"ksiegarnia1-dodawanie\" action=\"podglad.php\" method=\"get\">
<table align=\"center\" cellspacing=\"1\" cellpadding=\"1\" bgcolor=\"#060700\">
<tr>
<td height=\"500\" width=\"920\" bgcolor=\"#5c6042\">
<table bgcolor=\"#33390b\" cellspacing=\"1\" cellpadding=\"1\" align=\"center\" valign=\"middle\">
<tr>
<td height=\"20\" width=\"903\" bgcolor=\"#9a9f75\" align=\"center\">
<font size=\"\" color=\"\">WPROWADZANIE NOWYCH POZYCJI</font>
</td>
</tr>
</table>
</br>
<table bgcolor=\"#33390b\" cellspacing=\"1\" cellpadding=\"1\" align=\"center\" valign=\"middle\">
<tr>
<td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
<font size=\"\" color=\"\">Nazwa towaru</font>
</td>
<td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
<font size=\"\" color=\"\">Ilość sztuk</font>
</td>
<td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
<font size=\"\" color=\"\">Cena jednostkowa</font>
</td>
</tr>
<tr>
<td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
<input type=\"text\" name=\"product_name\" value=\"
<?php echo $product_name; ?>\">
</input>
</td>
<td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
<input type=\"text\" name=\"product_number\" value=\"
<?php echo $product_number; ?>\">
</input>
</td>
<td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
<input type=\"text\" name=\"product_price\" value=\"
<?php echo $product_price; ?>\">
</input>
</td>
</tr>
<tr>
<td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
<font size=\"\" color=\"\">ISBN (jeśli istnieje)</font>
</td>
<td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
<font size=\"\" color=\"\">EAN (jeśli istnieje)</font>
</td>
<td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
<font size=\"\" color=\"\">Producent</font>
</td>
</tr>
<tr>
<td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
<input type=\"text\" name=\"product_isbn\" value=\"
<?php echo $product_isbn; ?>\">
</input>
</td>
<td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
<input type=\"text\" name=\"product_ean\" value=\"
<?php echo $product_ean; ?>\">
</input>
</td>
<td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
<input type=\"text\" name=\"product_manufacture\" value=\"
<?php echo $product_manufacture; ?>\">
</input>
</td>
</tr>
</table>
</br>
<table bgcolor=\"#33390b\" cellspacing=\"1\" cellpadding=\"1\" align=\"center\" valign=\"middle\">
<tr>
<td height=\"30\" width=\"500\" bgcolor=\"#9a9f75\" align=\"center\">
<font size=\"\" color=\"\">Opis towaru</font>
</td>
<td height=\"30\" width=\"400\" bgcolor=\"#9a9f75\" align=\"center\">
<font size=\"\" color=\"\">Ilustracja</font>
</td>
</tr>
<tr>
<td height=\"160\" width=\"500\" bgcolor=\"#9a9f75\" align=\"center\">
<textarea name=\"product_char\" cols=\"60\" rows=\"7\" value=\"
<?php echo $product_char; ?>\">
</textarea>
</td>
<td height=\"160\" width=\"400\" bgcolor=\"#9a9f75\" align=\"center\">
<input type=\"file\" name=\"product_picture\" value=\"
<?php echo $product_char; ?>\">
</input></br>
<font size=\"2\">
Obrazek nie powinien być większy niż 300x300px, oraz jego objętość nie pow
nna przekraczać 125Kb
</font>
</td>
</tr>
</table>
</br>
<table bgcolor=\"#33390b\" cellspacing=\"1\" cellpadding=\"1\" align=\"center\" valign=\"middle\">
<tr>
<td height=\"30\" width=\"450\" bgcolor=\"#9a9f75\" align=\"center\">
<input type=\"submit\" value=\"Prześlij dalej aby zatwierdzić !\">
</td>
<td height=\"30\" width=\"450\" bgcolor=\"#9a9f75\" align=\"center\">
<input type=\"reset\" value=\"Oczyść wszystkie pola !\">
</td>
</tr>
</table>
</td>
</tr>
</table>
<?
mysql_query (\"INSERT INTO ksiegarnia (product_name, product_number,
product_price,
product_isbn,
product_ean,
product_manufacture,
product_char,
product_picture)
VALUES ('$product_name',
'$product_number',
'$product_price',
'$product_isbn',
'$product_ean',
'$product_manufacture',
'$product_char',
'$product_picture', NOW())\");
?>
<font size=\"2\">Site Created by Karol Lipnicki @ 2005</font>
</form>
</body>
</html>
Uprzejmie proszę o pomoc !