0
$qua1 = "5";

$queryNotification= "SELECT * from stock where stockQty <= :qua1 ";
$stmt3 = $conn->prepare($queryNotification);
$stmt3->bindParam(':qua1',$qua1);
$stmt3->execute();

while ($queryNotRow = $stmt3->fetch()){

$a=array("Qty"=>$queryNotRow['stockQty'],"name "=>$queryNotRow['stockName'],"cb "=>$queryNotRow['stockPrice']);
// $array[$queryNotRow['stockQty']] = $queryNotRow['stockName'];

foreach( $a as $row ):
$b = "stockqty = " . $queryNotRow['stockQty'] . " and StockName = " . $queryNotRow['stockName'] . "<br>";
endforeach;

echo $b;

} 

If I add send email code inside the foreach loop , the system will send many email according on how many data. How can I only send all the data by ONE EMAIL??

3
  • probably with print_r($a); ? Commented Oct 10, 2015 at 9:35
  • 2
    i want get display like Stockqty = ? and StockName = ? Commented Oct 10, 2015 at 9:44
  • 2
    [0] => Array ( [Qty] => 5 [name ] => 5 ) printr will show this == Commented Oct 10, 2015 at 9:44

3 Answers 3

2
$a=array("Qty"=>$queryNotRow['stockQty'],"name "=>$queryNotRow['stockName']);

foreach($a as $key=>$data){
echo 'stock'.$key.'='.$data.'<br/>';
}
Sign up to request clarification or add additional context in comments.

1 Comment

get this error (Notice: Array to string conversion in))
1
foreach( $a as $row ):
    echo "stockqty = " . $row['Qty'] . " and StockName = " . $row['name'] . "<br>";
endforeach;

2 Comments

if i want to send this all data through ONLY one email, is it possible??
of course it is. instead of echoing it, you can create string with those variables. I believe we have answered your question and you can go from here. If theres new problem you're facing, browse thru previously asked questions ( theres a lot covering these things ), in case of no luck with that, consider posting new question.
0

try this,

$a[] = array(
        "Qty" => 1,
        "name " => 2
    );

foreach ($a as $row) {
        echo $row['Qty']."===".$row['name'];
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.