“Done” in your code simply says that the query has executed without errors, it doesn’t suggest that any records have been updated. Would need to see more of the code to be able to figure out why not, along with the values of the data being passed into it.
When you run from phpmyadmin, you will be entering the values directly into the query rather than using variables as you do above, so the first thing is to check that the variables contain what you expect them to contain. For example if that date is going into a date-format column, does it contain a valid date?
Also look at moving on to mysqli or (my preference) PDO to access the database as the old-style calls you are using are removed from the current PHP version.
If you switch to PDO, you can use rowCount to find out how many rows your query affected, so I’m guessing in your case you would want to check whether it updated zero rows or one row. I don’t know how to do it with the older functions, if it’s possible.
$qrydate2="update cart_table set modify_date='$mddate' where session_id='$session_id' and name='$uname'";
mysql_query($qrydate2);
if (mysql_affected_rows() > 0)
{
echo "done";
}
else
{
echo "not done";
}
That being said: Please switch to a modern externsion to work with mysql, since mysql itself is deprecated and doesn’t support a lot of good stuff like prepared statements. Also, use prepared statements and don’t just drop variables in queries. You can either switch to mysqli or PDO, the latter being my personal preference.
The mysql_* extension which you’ve used was removed from PHP as of version 7. If you try to use your code on any PHP server running version 7 of PHP or newer it won’t work.
The mysql_* extension was superceeded a few years ago with the mysqli_* extension (note the “i” in there). Any code needing to access a MySQL database should now be using the mysqli_* extension or the alternative which is PDO. Whether you use the mysqli_* extenion or PDO you should always use prepared statements when sending sanitized/validated user submitted data to the database.
User submitted data is any data recieved into a PHP script via any of the following super-global arrays:
$_POST
$_GET
$_FILES
$_COOKIE
$_REQUEST
I can’t remember off-hand if either the $GLOALS or $_ENV super-global arrays can be altered by the user so it’s probably best to also treat data in them two as well as suspect
PDO has the advantage over mysqli_* of the ability to use named parameters
$_ENV can certainly be manipulated by the user since HTTP headers are put in there.
$GLOBALS can only be manipulated by the user if register_globals is enabled which has been removed in PHP 5.4. That being said, I don’t know of anything $GLOBALS can solve that can’t also be solved in a nice way. My advice would be to stay clear of $GLOBALS.