Wpis z mikrobloga

$TEXT = $GET['TEXT'];

$query = "UPDATE chatlog SET LOG = CONCAT(LOG, '" . $TEXT . "') WHERE PRIMARY = 0";
$result = mysql
query($query) or die("Error: " . mysqlerror());
$item = mysql
fetcharray($result);

Warning: mysql
fetch_array() expects parameter 1 to be resource, boolean given in

co sie zepsuło? #sql #php
  • 18
  • Odpowiedz
  • Otrzymuj powiadomienia
    o nowych komentarzach

@Wextor: W ostatniej linijce probojesz zapisac dane w formacie macierzy, ktore nie istnieja, bo UPDATE ktory robisz nie zwroci Ci zadnej informacji, poza true lub false. Generalnie wyjeb ostatnia linijke
  • Odpowiedz
@Wextor: źle jest wszystko, od użycia parodii języka jaką jest #php przez brak filtrowania danych po brak czytania dokumentacji

For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysqlquery() returns a resource on success, or FALSE on error.

For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysqlquery() returns TRUE on success or FALSE on error.


edit: php otagowałem, żeby przywołać Drużynę PHP
  • Odpowiedz
@Wextor: ale w dokumentacji stoi jak byk:

Warning

This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDOMySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this
  • Odpowiedz