Hi!
I've set up a form that allows members to update they'r profile when they
wish.
After much debugging I got it working without any errors. The problem though
was that it won't update the info in the MySQL database.
Any ideas what I may be doing wrong?
Cato
Some source:
<?php $debris = explode("+","$crispy"); ?>
<?php
$db = mysql_connect("localhost", "God", "Secret");
mysql_select_db("xephiroth",$db);
$sql="SELECT * FROM memberinfo";
$result=mysql_query($sql,$db);
$num = mysql_num_rows($result);
$row = mysql_fetch_array($result);
$name = $row["name"];
$email = $row["email"];
$loc = $row["loc"];
$aim = $row["aim"];
$icq = $row["icq"];
$msn = $row["msn"];
$yahoo = $row["yahoo"];
$charname = $row["charname"];
$charsname = $row["charsname"];
$tit = $row["tit"];
$lvl = $row["lvl"];
$picurl = $row["picurl"];
$born = $row["born"];
$appearance = $row["appearance"];
$charac = $row["charac"];
$streng = $row["streng"];
$bio = $row["bio"];
$breed = $row["breed"];
$prof = $row["prof"];
$id = $row["id"];
?>
<?
$usr = "God";
$pwd = "Secret";
$db = "xephiroth";
$host = "localhost";
# connect to database
$cid = mysql_connect($host,$usr,$pwd);
if (!$cid) { echo("ERROR: " . mysql_error() . "\n"); }
# this is processed when the form is submitted
# back on to this page (POST METHOD)
if ($REQUEST_METHOD=="POST") {
# double-up apostrophes
$name = str_replace("'",""",$name);
$loc = str_replace("'",""",$loc);
$email = str_replace("'",""",$email);
$charname = str_replace("'",""",$charname);
$charsname = str_replace("'",""",$charsname);
$charnick = str_replace("'",""",$charnick);
$born = str_replace("'",""",$born);
$appearance = str_replace("'",""",$appearance);
$charac = str_replace("'",""",$charac);
$streng = str_replace("'",""",$streng);
$bio = str_replace("'",""",$bio);
# setup SQL statement
$SQL = " UPDATE memberinfo SET";
$SQL = $SQL . " name = '$name', ";
$SQL = $SQL . " loc = '$loc', ";
$SQL = $SQL . " email = '$email', ";
$SQL = $SQL . " password = '$password', ";
$SQL = $SQL . " aim = '$aim', ";
$SQL = $SQL . " icq = '$icq', ";
$SQL = $SQL . " msn = '$msn', ";
$SQL = $SQL . " yahoo = '$yahoo', ";
$SQL = $SQL . " charname = '$charname', ";
$SQL = $SQL . " charsname = '$charsname', ";
$SQL = $SQL . " tit = '$tit', ";
$SQL = $SQL . " lvl = '$lvl', ";
$SQL = $SQL . " picurl = '$picurl', ";
$SQL = $SQL . " born = '$born', ";
$SQL = $SQL . " appearance = '$appearance', ";
$SQL = $SQL . " charac = '$charac', ";
$SQL = $SQL . " streng = '$streng', ";
$SQL = $SQL . " bio = '$bio', ";
$SQL = $SQL . " breed = '$breed', ";
$SQL = $SQL . " prof = '$prof', ";
$SQL = $SQL . " charnick = '$debris[0]' ";
$SQL = $SQL . " WHERE id = $id ";
#execute SQL statement
$result = mysql_db_query($db,"$SQL",$cid);
if (($password=='') || ($password!=$password2))
die ("Your passwords don't match.");
# check for error
if (!$result) { echo ("ERROR! Please send an <a
href=\"mailto:[EMAIL PROTECTED]\">email to the webmaster</a> and copy
the error into the mail so we can fix this problem!<BR><BR><B>ERROR:</B> " .
mysql_error() . "\n$SQL\n"); }
echo ("<P><B> Profile Updated for $debris[0]</B></P><BR><BR><P><B>Click <a
href=default.php>here</a> to return to the members section.<P><B>\n");
}
?>
<form method="POST" ACTION="profileed.php">
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]