I just want to fetch customer id with email as parameter from the mysql database. How can i hit the sql query to get the customer_id.
$passphrase = "password";
$salt = "SC";
$password = md5($salt . $passphrase) . ":SC";
$write->query("update customer_entity_varchar set value='$password' where entity_id=$customer_id and attribute_id in (select attribute_id from eav_attribute where attribute_code='password_hash' and entity_type=1)");
This is the code which i been using to update password , I need dynamic customer id.
this is full code
<?php
include('app/Mage.php');
Mage::app();
if($_POST && $_POST["email"])
{
$collection = mage::getModel('customer/customer')->getCollection() ->addAttributeToSelect('email')
->addAttributeToFilter('myemail@domain.com')
->addAttributeToSort('email', 'ASC');
var_dump((string)$collection->getSelect());
die();
$passphrase = "password";
$salt = "SC";
$password = md5($salt . $passphrase) . ":SC";
$write->query("update customer_entity_varchar set value='$password' where entity_id=$customer_id and attribute_id in (select attribute_id from eav_attribute where attribute_code='password_hash' and entity_type=1)");
$send_data["success"]=true;
$send_data["message"]="Login Success";
$send_data["customer_id"]=$customer_id;
}
else
{
$send_data["success"]=false;
$send_data["message"]="Enter both Email and Password";
}
Mage::getSingleton('customer/session')->loginById($send_data["customer_id"]);
echo json_encode($send_data);
?>
Best Answer
You can try below code in magento
this will print following query