You are here: Re: Update fails « PHP Language « IT news, forums, messages
Re: Update fails

Posted by Kevin Raleigh on 07/18/07 03:52

"Geoff" <fooooooool@hotmail.com> wrote in message
news:469c8bd8$0$31721$db0fefd9@news.zen.co.uk...
>
> "Kevin Raleigh" <kraleigh@sbcglobal.net> wrote in message
> news:ksednbFQpP3f3QHbnZ2dnUVZ_hKdnZ2d@giganews.com...
> >I tried removing the quotes from the query:
> > $check = mysql_query("SELECT * FROM user WHERE id = $userID")or
die("query
> > failed!");
> >
> > and it comes back with my die message "query failed";
> >
> > can you advise further?
> >
>
> put mysql_error() in your die bit
> or die(mysql_error())
>
> it'll tell you what mysql is failing on
>
After a major redesign I was able to get my validation script to work.
I don't know why when I used forms and the get method everything failed.
Maybe another day and another time I will have time to figure this out.
What I did was get rid of the form and just process the page.
Took the easy way ;-)

The code if your interested:
<?php
$userID = (int)$_GET['id'];
$secureID = (int)$_GET['code'];

if (!get_magic_quotes_gpc()) {
$userID = addslashes($_GET['id']);
}

$check = mysql_query("SELECT * FROM user WHERE id = $userID")or
die(mysql_error());


//Gives error if user dosen't exist
$check2 = mysql_num_rows($check);
if ($check2 == 0) {
die(mysql_error());
}

while($info = mysql_fetch_array( $check )){
$dbSecureID = stripslashes($info[secureID]);
$fName = stripslashes($info['fName']);
$lName = stripslashes($info['lName']);
$emailAdd = stripslashes($info['email']);
//gives error if the password is wrong
}
$userName = $fName . " " . $lName;

if ($secureID != $dbSecureID) {
die('This user has not registered yet!');
} else{
mysql_query("UPDATE user SET confirmIDFlag=1 WHERE id=$userID")or
die(mysql_error());

require("php/class.phpmailer.php");
$mail = new PHPMailer();
// set mailer to use SMTP
$mail->Host = "relay-hosting.secureserver.net";

$mail->From = "sermon@thel.org";
$mail->FromName = "Pastor Art Gorman";
$mail->AddAddress("email@sbcglobal.net", "$userName");
$mail->WordWrap = 40;
$mail->IsHTML(true);

// set email format to HTML

$emailBody = "This email is to inform $userName that your account is now
active<br/>";
$emailBody.= "If you are not $userName at $emailAdd ";
$emailbody.= "<a
href=\"http://www.mySite.org/userNot_UserID.php?email=$email\"> please click
here</a>";
$emailBody.= "<br/><br/>";
$emailBody.= "<a href =\"http://www.mySite.org/login.php\">Click Here to
login</a>";



$mail->Subject = "Welcome $userName";
$mail->Body = "$emailBody";
$mail->AltBody = "This email is to inform $userName<br/> that
you have been added to our mailing list";

if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
?>
<html><body><h1><?php echo $userName; ?> is now an active member of
1Purpose-Bethel.org</h1>
<h4>You may either close this page or browse the website!</h4>
<h5><a href="index.php">1 Purpose Home</a></body></html>
<?php
}
?>

insight always appreciated
Thank you
God Bless
Kevin Raleigh

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация