Waqas_aamer Waqas_aamer - 2 years ago 65
SQL Question

retrieving data from database sql query

I have configuaration table in database. I want to get data from it. vName=ADMIN_EMAIL row has a column whose name is vValue. there is an email address stored in it. i want to get that value and store it in $toEmail. Kindly Someone guide me here.

$sqldata=mysqli_query($obj,"SELECT * FROM configuration WHERE vName='ADMIN_EMAIL'");
// $toEmail = "dev.waqas@designbee.us";
$mailHeaders = "From: " . $_POST["userName"] . "<". $_POST["userEmail"] .">\r\n";
if(mail($toEmail, $_POST["subject"], $_POST["content"], $mailHeaders)) {
echo "<p class='success'>Mail Sent.</p>";
} else {
echo "<p class='Error'>".$toEmail.".</p>";

Answer Source

You need to fetch data after executing query.

$row = $sqldata->fetch_array(MYSQLI_ASSOC);
$toEmail= $row['vName']
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download