Jump to content

Help


affordit

Recommended Posts

Can someone tell me why this is not updating

<?php
$reg = $_POST['registration'];
include("sharons_dbinfo.inc.php");
mysql_connect(mysql,$name,$password);
@mysql_select_db($database) or die( "Unable to select database"); 

//
// CHANGE QUERY TO GRAB THE ID
//
$query = "select id, email, end_date FROM test WHERE `email`='$email'";
$result=mysql_query($query) or die (mysql_error());
if (mysql_num_rows($result)<1)
{
echo "You entered the wrong username or password or your email has already been verified.";
}
else
{ 
$end_date = date("Y-m-d",strtotime("$reg"));
//
// UPDATE THE ROW
//
$update = "UPDATE `test` SET `end_date`=$end_date WHERE `id`=" . $rows['id'];
mysql_query($update);
(header("location: index.php")); 
}
  
?>

Link to comment
Share on other sites

First, you never pull the row for the SELECT statement. Also, put the date in single quotes:

 

<?php
$reg = $_POST['registration'];
include("sharons_dbinfo.inc.php");
mysql_connect(mysql,$name,$password);
@mysql_select_db($database) or die( "Unable to select database"); 

//
// CHANGE QUERY TO GRAB THE ID
//
$query = "select id, email, end_date FROM test WHERE `email`='$email'";
$result=mysql_query($query) or die (mysql_error());
if (mysql_num_rows($result)<1)
{
echo "You entered the wrong username or password or your email has already been verified.";
}
else
{ 
//Get Row
$row = mysql_fetch_array($result);
$end_date = date("Y-m-d",strtotime($reg));
//
// UPDATE THE ROW
//
$update = "UPDATE `test` SET `end_date`='$end_date' WHERE `id`=" . $row['id'];
mysql_query($update);
(header("location: index.php")); 
}
  
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.