Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Didattica > Corsi A - F > Basi di dati ~ comunicazione digitale > problema registrazione php
  Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
stell4r
.consigliere.

User info:
Registered: Nov 2007
Posts: 107 (0.02 al dì)
Location:
Corso:
Anno:
Time Online: 13:26:51 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
problema registrazione php

ciao ragà. Sto provando ad inserire un nuovo cliente nella tabella clienti. Lo faccio tramite form e metodo post. Ecco il codice.

Form:
<form name="form" method="post" action="aggiornaclienti.php"> <br />
Nome: <input type="text" name="nomec" value=""><br />
Cognome: <input type="text" name="cognomec" value=""><br />
Codice Fiscale: <input type="text" name="codfc" value=""><br />
Citta: <input type="text" name="citta" value="" />
Via: <input type="text" name="via" value=""> Numero civico: <input type="text" name="nciv" value="" /><br />
CAP: <input type="text" name="cap" value="" /> <br />
Nickname: <input type="text" name="nickname" value="" /><br />
Password: <input type="password" name="password" value="" /><br>
<input type="submit" name="aggiorna" value="invia">
</form>

Php:

<?php
include 'function.php';

if(isset($_POST['aggiorna']))
{
$sql = "INSERT INTO clienti (nomec,cognomec,codfc,via,cap,citta,nciv,nickname,
password)
VALUES
(".$_POST['nomec'].",".$_POST['cognomec'].",".$_POST['codfc'].",".$_POST['via'].",".$_POST['cap'].",".$_POST['citta'].",
".$_POST['nciv'].",".$_POST['nickname'].",".$_POST['password'].");";



$res=eseguiquery($sql);
}
?>

ho fatto anche dei vari echo dopo l'eseguiquery per vedere se prendeva i dati. e li prende.

Nel db però non li inserisce.
Se provo ad effettuare la query normale

INSERT INTO clienti (nomec,cognomec,codfc,via,cap,citta..ecc..) VALUES ('Andrea' ecc..)

mi inserisce la tupla.. cosa può essere? sto impazzendo!

27-11-2008 17:46
Click Here to See the Profile for stell4r Click here to Send stell4r a Private Message Find more posts by stell4r Add stell4r to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
WillyWonka
.consigliere.

User info:
Registered: Oct 2005
Posts: 142 (0.02 al dì)
Location: Desio
Corso: COM DIG
Anno: terzo
Time Online: 1 Day, 13:17:44 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ti connetti al db prima di eseguire la query?

27-11-2008 18:44
Click Here to See the Profile for WillyWonka Click Here to See the Blog of WillyWonka Click here to Send WillyWonka a Private Message Find more posts by WillyWonka Add WillyWonka to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
lordghost
Black Lord

User info:
Registered: Oct 2005
Posts: 232 (0.03 al dì)
Location: Milan
Corso: Informatica
Anno: 3
Time Online: 2 Days, 9:48:49 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

se fai echo mysql_error() o qualcosa del genere dovrebbe esserti d'aiuto (o guarda il LOG), oppure di pg ovviamente, se c'è l'equivalente.

__________________
My 3D blog: http://www.webgl.it

27-11-2008 18:56
Click Here to See the Profile for lordghost Click here to Send lordghost a Private Message Visit lordghost's homepage! Find more posts by lordghost Add lordghost to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
stell4r
.consigliere.

User info:
Registered: Nov 2007
Posts: 107 (0.02 al dì)
Location:
Corso:
Anno:
Time Online: 13:26:51 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

sisi certo.. scusate ho dimenticato di includere il file function.php


eccolo:


<?php

require_once 'MDB2.php';

function dbconnect()
{
$dsn = array('phptype' => "pgsql",'username' => "andrea",'password' => "12345",'hostspec' => "localhost",'database' => "mangiar_bene");
$mdb2 = MDB2::connect($dsn);
if (PEAR::isError($mdb2))
{
die($mdb2->getMessage());

}
return $mdb2;
}

function eseguiquery($sql)
{
$mdb2 = dbconnect();
$res = $mdb2->query($sql);
$mdb2->disconnect();
return $res;

}



?>

27-11-2008 20:48
Click Here to See the Profile for stell4r Click here to Send stell4r a Private Message Find more posts by stell4r Add stell4r to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
WillyWonka
.consigliere.

User info:
Registered: Oct 2005
Posts: 142 (0.02 al dì)
Location: Desio
Corso: COM DIG
Anno: terzo
Time Online: 1 Day, 13:17:44 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

devi mettere forse gi apici singoli, ad es. ".$_POST['nomec']." lo scrivi '".$_POST['nomec']."'

28-11-2008 09:17
Click Here to See the Profile for WillyWonka Click Here to See the Blog of WillyWonka Click here to Send WillyWonka a Private Message Find more posts by WillyWonka Add WillyWonka to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
stell4r
.consigliere.

User info:
Registered: Nov 2007
Posts: 107 (0.02 al dì)
Location:
Corso:
Anno:
Time Online: 13:26:51 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

siiiii!! funziona!! GRAZIE MILLE!!!!

28-11-2008 09:31
Click Here to See the Profile for stell4r Click here to Send stell4r a Private Message Find more posts by stell4r Add stell4r to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 02:18.    Post New Thread    Post A Reply
  Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.034 seconds (77.12% PHP - 22.88% MySQL) con 26 query.