Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
PHP - errore query sql
Forum - PHP - errore query sql

Avatar
alex1995 (Normal User)
Expert


Messaggi: 294
Iscritto: 27/01/2011

Segnala al moderatore
Postato alle 20:47
Venerdė, 10/04/2020
salve, ho un problema con questo sorgente:

Codice sorgente - presumibilmente Php

  1. <?php
  2.  
  3. require_once('config.php');
  4.  
  5. $databaseConnection = mysqli_connect(DBHOST, DBUSERNAME, DBPASSWORD, DBNAME);
  6.  
  7. if (!$databaseConnection)
  8. {
  9.     die('Could not connect: ' . mysql_error());
  10. }
  11.  
  12. mysqli_query($databaseConnection, "CREATE TABLE torrent (
  13.     torrentid MEDIUMINT NOT NULL AUTO_INCREMENT,
  14.          torrenthash text NOT NULL,
  15.          torrenttitle text NOT NULL,
  16.          torrentdescription text NOT NULL,
  17.     PRIMARY KEY (torrentid)
  18. );") or die("Error: %s\n", mysqli_error($databaseConnection)));
  19.  
  20.  
  21. ?>



mi da quest errore

Codice sorgente - presumibilmente PHP

  1. Parse error: syntax error, unexpected ',', expecting ')' in C:\xampp\htdocs\query.php on line 18



ma se inserisco la query in phpmyadmin funziona come mai?

PM Quote
Avatar
Goblin (Member)
Expert


Messaggi: 375
Iscritto: 02/02/2011

Segnala al moderatore
Postato alle 0:17
Sabato, 11/04/2020
Testo quotato

Postato originariamente da alex1995:

salve, ho un problema con questo sorgente:

Codice sorgente - presumibilmente Php

  1. <?php
  2.  
  3. require_once('config.php');
  4.  
  5. $databaseConnection = mysqli_connect(DBHOST, DBUSERNAME, DBPASSWORD, DBNAME);
  6.  
  7. if (!$databaseConnection)
  8. {
  9.     die('Could not connect: ' . mysql_error());
  10. }
  11.  
  12. mysqli_query($databaseConnection, "CREATE TABLE torrent (
  13.     torrentid MEDIUMINT NOT NULL AUTO_INCREMENT,
  14.          torrenthash text NOT NULL,
  15.          torrenttitle text NOT NULL,
  16.          torrentdescription text NOT NULL,
  17.     PRIMARY KEY (torrentid)
  18. );") or die("Error: %s\n", mysqli_error($databaseConnection)));
  19.  
  20.  
  21. ?>



mi da quest errore

Codice sorgente - presumibilmente PHP

  1. Parse error: syntax error, unexpected ',', expecting ')' in C:\xampp\htdocs\query.php on line 18



ma se inserisco la query in phpmyadmin funziona come mai?



bha forse dico una cavolata ... ma io conto una parentesi chiusa ")" di troppo proprio alla linea 18 ... infatti anche l'errore lo dice
G.


Ibis redibis non morieris in bello
PM Quote