Questo sito utilizza cookies
solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi
l'informativa sui cookies
.
Accesso in corso...
Username:
Password:
oppure
Username o password invalidi
Forum
Sorgenti
C
C++
Managed C++
Visual Basic .NET
Visual Basic
Visual C++
Java
C#
Perl
Qbasic
Delphi
Python
Prolog
Lua
Scheme
Cobol
LabVIEW
Ruby
ASP
PHP/MySQL
x86 Assembly
MIPS Assembly
Pascal
Fortran
Bash
Gml
Javascript
Programmi
Animazioni
Desktop
Esempi
Giochi
Grafica e Fotografia
Insegnamento e hobby
Internet
Lavoro e finanza
Matematica e fisica
Moduli e librerie
Musica
Networking
Scripts
Sicurezza
System Tweak
Utility
Web authoring
Guide
Visual Basic .NET
Pascal
HTML
SDL
Typescript
VBScript
Batch scripting
GWBasic
Licenze Software
Recensioni
Manuali
Software
Tutorials
Linguaggi
ASP
C
C#
C++
Delphi
Java
Pascal
Perl
PHP
Prolog
Python
Ruby
Ruby On Rails
Scheme
Visual Basic
Google
Hardware
Informatica
Internet
iPhone
Masterizzare
CD
DVD
Files Immagine
Mp3 e Audio
Sicurezza e OS
Sistemi operativi
Linux
Windows
Video Digitale
Lezioni
Programmazione
Ruby
iOS
Tecnologie
Multi Touch
Project Zone
Che cos'č?
Progetti pių attivi
Editor mappe
Analisi testi
Parole
FILDER
2048
2D Mappy
RTDownloadCounter
SSBackUp
Estrazione
Codificatore
pSIMPLETRON
ErrorReporter.NET
Web Escape
Napoleon
Mini Cad
Tutti i progetti
Utility
News nel tuo sito
Blog
Compilatori
Masterizzare
Siti amici
Pubblica un sorgente
Programmare
Come imparare a programmare
Come diventare un buon programmatore
Community
Chi Siamo?
Membri
Dev Team
Join Us
Libreria
Premio Stallman
I Top 10
Medagliere
Mascotte
Foto raduni
Assumici
Scrivici
supportaci
Forum
-
PHP
- Problema messaggistica interna sito
MillenniumBug
(
Member
)
Rookie
Messaggi:
40
Iscritto:
08/04/2011
Postato alle
14:22
Venerdė, 29/07/2011
Ciao a tutti ho u problema nell'inserimento del messaggio di un utente ad un altro nel database.
Questo č il codice:
Codice sorgente - presumibilmente Php
<html>
<head>
<title>Scrivi Messaggio</title>
</head>
<body>
<?php
session_start
(
)
;
include
(
"conn.php"
)
;
class
pctmess
{
public
$user_m
;
public
$user_d
;
public
$ogg
;
public
$mess
;
public
function
__construct
(
$m
,
$d
,
$o
,
$me
)
{
$this
->
user_m
=
$m
;
$this
->
user_d
=
$d
;
$this
->
ogg
=
$o
;
$this
->
mess
=
$me
;
}
public
function
invia
(
)
{
if
(
$this
->
ogg
==
""
||
$this
->
mess
==
""
)
{
echo
"Inserisci oggetto o messaggio"
;
}
else
{
mysql_query
(
"INSERT INTO messaggi (user_m,user_d,ogg,mess) VALUES ('
$this->user_m
','
$this->user_d
',
$this->ogg
','
$this->mess
')"
)
;
echo
"Messaggio inviato con successo a
$this->user_d
"
;
}
}
}
$nomev
=
$_SESSION
[
'nome'
]
;
$dname
=
$_GET
[
'nome'
]
;
$mess
=
$_POST
[
'mess'
]
;
$ogg
=
$_POST
[
'ogg'
]
;
$oggetto
=
new
pctmess
(
$nomev
,
$dname
,
$ogg
,
$mess
)
;
if
(
isset
(
$_POST
[
'conferma'
]
)
)
{
$oggetto
->
invia
(
)
;
}
else
{
echo
"<form method=
\"
post
\"
action=
\"
$PHP_SELF
\"
>"
;
echo
"Mittente:
$nomev
<br>"
;
echo
"Destinatario:
$dname
<br>"
;
echo
"Oggetto: <input type=
\"
text
\"
name=
\"
ogg
\"
><br>"
;
echo
"Testo:<br>"
;
echo
"<textarea name=
\"
mess
\"
></textarea><br>"
;
echo
"<input type=
\"
submit
\"
value=
\"
Invia
\"
name=
\"
conferma
\"
>"
;
echo
"</form>"
;
}
?>
</body>
</html>
ed ecco il codice SQL della tabella:
Codice sorgente - presumibilmente Php
CREATE TABLE
IF
NOT EXISTS `messaggi`
(
`id` int
(
10
)
unsigned NOT
NULL
AUTO_INCREMENT
,
`user_m` varchar
(
30
)
NOT
NULL
,
`mess` text NOT
NULL
,
`data`
date
NOT
NULL
,
`user_d` varchar
(
30
)
NOT
NULL
,
`ogg` varchar
(
30
)
NOT
NULL
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
latin1 AUTO_INCREMENT
=
1
;
Il problema č che mi viene fuori il messaggio "Messaggio inviato a (nomeutentedestinatario)" ma quando guardo nel db mi dice che non c'č niente.
Grazie in anticipo.
Ultima modifica effettuata da
MillenniumBug
il 29/07/2011 alle 14:31
HeDo
(
Founder Member
)
Guru^2
Messaggi:
2765
Iscritto:
21/09/2007
2
Postato alle
15:38
Venerdė, 29/07/2011
per vedere se ti da errore la query aggiungi un "or die('errore')".
ad ogni modo prova a cambiare la sintassi della query in modo da utilizzare set al posto di values, potrebbe esserci qualche problema lė.
grazie mille hedo ho risolto infatti il problema era nella query -
MillenniumBug
- 29/07/11 19:22
di niente :) -
HeDo
- 30/07/11 02:16