Warning: mysql_query() expects parameter 2 to be resource, boolean given

marcomg

Utente Attivo
19 Nov 2011
204
0
16
In un mio script php quando vado ad eseguire codice mysql ottendo:
Warning: mysql_query() expects parameter 2 to be resource, boolean given in /opt/lampp/htdocs/securepastebin/index.php on line 53
Errore esecuzione query

Ho modificato il mio script in modo che mi stampi la query. Essa è:
Codice:
INSERT INTO `database` (`id`, `pid`, `created`, `expire_after`, `toexpire`) VALUES (`NULL`, `vB11elB5yO5J1CJsVsiFLP2BW2VUAPpw`, `ewAyRiBgqk8euwc=`, `1336565792`, `1336567592`, `1`

Il database è:
Codice:
CREATE TABLE IF NOT EXISTS `database` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `pid` text COLLATE utf8_unicode_ci NOT NULL,
  `created` text COLLATE utf8_unicode_ci NOT NULL,
  `expire_after` text COLLATE utf8_unicode_ci NOT NULL,
  `toexpire` text COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

Dove è l'errore?
 

Nefyt

Utente Attivo
17 Apr 2012
1.102
0
0
Io vedo 5 parametri, fra cui il primo id che è in auto_increment quindi non servirebbe dichiararlo, mentre nell'insert io vedo che dichiari 6 parametri nel values e non lo chiudi, correggi questa parte e fammi sapere
 

marcomg

Utente Attivo
19 Nov 2011
204
0
16
Che sbadato, vero!
Ora ho corretto, ma non va ugualmente!

Codice
Codice:
INSERT INTO `database` (`id`, `pid`, `created`, `expire_after`, `toexpire`) VALUES (`NULL`, `7339hox64yzLm2EG1hYUcEM82dif4bOz`, `XwECUE2Kqk8=`, `1336576589`, `1336578389`, `1`)

Errore:
Codice:
Warning: mysql_query() expects parameter 2 to be resource, boolean given in /opt/lampp/htdocs/securepastebin/index.php on line 53
Errore esecuzione query
 
Ultima modifica:

Nefyt

Utente Attivo
17 Apr 2012
1.102
0
0
Il campo text non lo vedo nel database, poi id non serve ridichiararlo è impostato come auto_increment
 
Discussioni simili
Autore Titolo Forum Risposte Data
F [MySQL] Warning 1265 data truncated for column... MySQL 5
M Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in PHP 6
B Warning: mysql_connect(): Access denied for user 'DIREZIONE'@'81.88.55.179' (using password: YES) PHP 6
G [PHP] Warning: Cannot modify header information - headers already sent by PHP 3
G [PHP] Problema - Warning: session_start() [function.session-start] PHP 9
G Warning: mysql_num_rows() che problema è? PHP 3
P Warning: mysqli_query() expects parameter 1 to be mysqli PHP 2
C ERRORE: Warning: move_uploaded_file()... come risolverlo? PHP 1
JackIlPazzo Warning: Invalid argument supplied for foreach() PHP 1
N warning su sessione PHP 2
F Warning: Invalid argument supplied for foreach() PHP 3
A Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given PHP 17
L Problema messaggio d'errore -Warning: mysqli_num_rows() expects parameter 1 to be mysqli_ etc etc... PHP 2
pup3770 Su Mac funziona - su windows da warning PHP 9
E Warning: session_start() PHP 1
P Warning: mysql_num_rows() expects parameter 1 to be resource, array given in PHP 9
A Warning: mysql_result() expects parameter 1 to be resource, boolean given MySQL 2
I Warning: Division by zero in Joomla 0
S Help : Warning: mail() [function.mail] PHP 2
H Warning: Cannot modify header information... PHP 6
P Warning email() PHP 116
catellostefano CLASSE PHP Warning: mysql_fetch_assoc() expects parameter 1 to be resource PHP 2
Frank10 Problema w3c warning HTML5 -.-" HTML e CSS 5
neo996sps Warning su redirect della pagina PHP 9
S Warning sulle sessioni, come fare? PHP 1
catellostefano Problema per richiamare file xml -- Warning: DOMDocument::load() [domdocument.load]: PHP 0
L Warning: mysql_fetch_assoc() expects parameter 1 to be resource, null given in .... PHP 2
L Warning: Cannot modify header information - headers already sent by... PHP 9
H Warning: session_start() [function.session-start]: Cannot send session cache limiter PHP 8
S errore warning mysql_ferch_array() e mysql_free_result() PHP 5
A Warning strano PHP 2
JellyBelly Warning Uso Rename PHP 2
M Warning: session_start(): Cannot send session cache... ???? PHP 5
W Warning: main(./WEB-INF/etc/config.php): PHP 3
M Warning: Cannot modify header information - headers already sent by (output started a PHP 1
C problema con un warning PHP 0
K form Inserimento record mysql PHP 2
P Mysql lento a cancellare MySQL 1
P Codifica caratteri speciali mysql php PHP 0
N MAX() + ADD_DATE - per update su Mysql MySQL 0
F Applicazione PHP/MySQL per prenotazioni: limitare il numero massimo di posti prenotabili PHP 20
L tipo boolean non funzionante su mariadb (mysql). E codice php 7.4. PHP 0
M PHP/MySQL - Estrarre valori min e max di ogni gruppo PHP 5
W MySQL ciclo in SELECT MySQL 0
L Mysql gestionale multipiattaforma MySQL 0
W MySQL SELECT list dinamica MySQL 0
M utilizzo mysql in nodejs - crea createdAt e updateAt MySQL 1
T colonne di tabelle mysql ordinate MySQL 0
M Sintassi "personalizzata" per mysql workbench? MySQL 0
A Mysql MySQL 0

Discussioni simili