Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> insert do bazy
cfkr
post 14.01.2006, 03:13:43
Post #1





Grupa: Zarejestrowani
Postów: 14
Pomógł: 0
Dołączył: 7.01.2006

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


Witam, czy moglby ktos sie przyjrzec temu skryptowi? co z nim jest nie tak?. Wyswietla sie dobrze.. pobiera i wstawia w formularz dane./.. ale po edycji(lub nie) i wyslaniu pokazuje sie błąd:

Cytat
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /public/snoopy/chkim.php on line 19


Oto skrypt:

  1. <html>
  2. <head>
  3. <title>Edycja działu "Kim jesteśmy"</title>
  4. </head>
  5. <body>
  6. <?php
  7. include("config.php");
  8. if (!IsSet($stage))
  9. {
  10. $_GET['id'];
  11. mysql_connect($host, $name, $pass)
  12. or die("nieudane polaczenie z bazą danych");
  13. mysql_select_db($dbname);
  14.  
  15. $result = mysql_query('
  16. SELECT *
  17. FROM kimjestesmy
  18. where ID = '.$_GET['id'].';');
  19. $kRow = mysql_fetch_array($result);
  20. $kID = $kRow['ID'];
  21. $kTytul = $kRow['tytul'];
  22. $kTresc = stripslashes($kRow['tresc']);
  23. ?>
  24. <form method="post" action="<?php print("$PHP_SELF");?>">
  25. Tytuł:
  26. <input type=text name="kTytul" size=20 value="<?php print($kTytul); ?>"><br>
  27. Zawartość strony:
  28. <textarea name="kTresc" cols=50 rows=15><?php print("$kTresc"); ?>
  29. </textarea><br>
  30. <input type=hidden name="kID" value="<?php echo $kID; ?>">
  31. <input type=submit>
  32. </form>
  33. <?php
  34. }
  35. else
  36. {
  37. mysql_connect($host, $name, $pass)
  38. or die("nieudane polaczenie z bazą danych");
  39. mysql_select_db($dbname);
  40. $result = mysql_query("UPDATE kimjestesmy SET tytul = $kTytul, tresc = kTresc WHERE ID = $kID");
  41. if($result > 0)
  42.  print("error.n");
  43. else
  44.  print("OK! .n");
  45. }
  46. ?>
  47. </body>
  48. </html>
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Wersja Lo-Fi Aktualny czas: 19.07.2025 - 10:27