Fw: [PHP] Can't store info on a mysql database...

From: Date: Fri, 01 Nov 2002 23:39:38 +0000
Subject: Fw: [PHP] Can't store info on a mysql database...
Groups: php.general 
Request: Send a blank email to php-general+get-122479@lists.php.net to get a copy of this message
$md = MD5($passwdtxt); $sql="INSERT INTO users (login,passwd) VALUES (\"$logintxt\", \"$md\")"; mysql_query($sql) or die(mysql_error()); next time, show the error messages you got. Also, ALWAYS USE mysql_error() when executing mysql_query() -- see above ===================================== "Mr. BuNgL3" <mrbungle@netcabo.pt> wrote in message news:20021101233214.19457.qmail@pb1.pair.com... > Hi... > My problem is that i can't store info in a mysql database... ex: > > I want to store this info in my database: login/passwd and i have the php > code... > > <? > $logintxt = $HTTP_POST_VARS['logintxt']; > $passwdtxt= $HTTP_POST_VARS['passwdtxt']; > > if (!$logintxt || !$passwdtxt) > { > include('registo.htm'); > } > else > { > $ligacao=mysql_connect("localhost","",""); > if (!$ligacao) > { > print("Problemas na ligação á base de dados!"); > } > else > { > //Procurar se user já existente > > //$sql="INSERT into users SET login='$logintxt', > passwd=MD5('$passwdtxt')"; > > $sql="INSERT INTO users (login,passwd) VALUES ('$logintxt', > 'passwd=MD5($passwdtxt))'"; > mysql_db_query("mysite",$sql); > } > mysql_close(); > } > ?> > > what i'm doing wrong? : |

« previous php.general (#122479) next »