Hello
I have the following MySQL statement and I was wondering how to go about creating a IF like statement round tbl_merchant.uniquemerchantid = tbl_questions.merchantid"); .
looking at: AND tbl_merchant.uniquemerchantid = tbl_questions.merchantid");
example
if not empty ( tbl_questions.merchantid")
{ tbl_merchant.uniquemerchantid = tbl_questions.merchantid"}
else
{ignore}
As of now the record is skipped due to the AND in the statement, not meeting the criteria.
PHP Code:$stmt = $this->dbcon1 ->query("SELECT tbl_merchant.merchantname, tbl_questions.projectid,
tbl_questions.merchantid, tbl_questions.question, tbl_questions.date
From tbl_questions, tbl_merchant
WHERE tbl_questions.projectid = '$this->projectId'
AND tbl_merchant.uniquemerchantid = tbl_questions.merchantid");
$this->questionArray = $stmt->fetchAll(PDO::FETCH_ASSOC);



Reply With Quote






Bookmarks