Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MYSQL]Problem z zapytaniem SQL, nvalid default value for 'id'
joCkero
post
Post #1





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 20.07.2007

Ostrzeżenie: (0%)
-----


Witam,

Otoz po zapytaniu SQL
  1. CREATE TABLE shoutbox (
  2. id int(11) DEFAULT '0' NOT NULL AUTO_INCREMENT,
  3. tresc text,
  4. imie text,
  5. ip text,
  6. UNIQUE id (id),
  7. PRIMARY KEY (id)
  8. );

MySQL zwrócił komunikat:
#1067 - Invalid default value for 'id'

Znalazlem na jednym z forow ten sam problem, wtedy ktos poradzil aby wyslac takie zapytanie
  1. CREATE TABLE `shoutbox` (
  2. `id` int(11) NOT NULL AUTO_INCREMENT,
  3. `tresc` text NOT NULL DEFAULT '',
  4. `imie` text NOT NULL DEFAULT '',
  5. `ip` text NOT NULL DEFAULT '',
  6. PRIMARY KEY (`id`)
  7. ) AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;


Fakt, wchodiz, bez problemu, ale na stronie wyswietla sie komunikat Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in

Co zrobic?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
joCkero
post
Post #2





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 20.07.2007

Ostrzeżenie: (0%)
-----


Kod
<?
ob_start();
/*****************************************************/
/*      jPORTAL - internetowy system portalowy       */
/*****************************************************/
/* autor: Pawel 'jaco' Jaczewski                     */
/* email: info@websys.pl                             */
/*****************************************************/
include ('config.php');

#===========================#

function site_main() {

global $tresc, $imie, $all, $ip, $REMOTE_ADDR, $emots, $prefix, $PHP_SELF;

if(is_user_login()=='yes')
$info = get_user_info();

main_title_open();
echo 'Shoutbox';
main_title_close();
main_text_open();
#=================#
$shoutbox = $prefix.'shoutbox';  
$tresc = wordwrap($tresc, 15, " ", 1);
$imie = wordwrap($imie, 15, " ", 1);  
$tresc = strip_tags ($tresc);
$imie = strip_tags ($imie);
#=================#
if ($tresc!="" && $imie!="") {
$zapytanie = "INSERT INTO $shoutbox SET tresc='$tresc', imie='$imie', ip='$ip'";
$wykonaj = mysql_query ($zapytanie);
$dalej="shoutbox.php";
header("Location: $dalej");
}
if ($all!=ok) {
$zapytanie = "SELECT * FROM $shoutbox ORDER BY id DESC LIMIT 10";
$wykonaj = mysql_query($zapytanie);
while ($wiersz = mysql_fetch_array($wykonaj)) {
?>


Ten post edytował joCkero 5.11.2008, 21:09:18
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 15.10.2025 - 05:23