Jump to content

Multiple Conditions Problem


tekrscom

Recommended Posts

MySQL 5.0.32

 

Hi everyone... It's been a while...

 

But anyway, I am having problems with a multiple condition query... It keeps giving me an error... "Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource"

 

The query is as follows...

 

$query = mysql_query("SELECT EndClients.EndClientBusinessName, Quotes.QuoteID, Quotes.QuoteTitle FROM Quotes LEFT JOIN EndClients ON Quotes.EndClientID = EndClients.EndClientID WHERE Quotes.QuoteID = '$_GET[quoteid]' AND Quotes.ITCompanyID = '$_SESSION[userID]' AND Quotes.QuoteStatus = 'Generation'") or die(mysql_error());

 

I know, you're probably wondering why I would be adding more conditions after already defining the ID of the row in which I am wanting,... it's merely added protection to ensure the right person is making the query and also that they're not trying to pull a row maliciously that is no longer in 'Generation' status...

 

The whole code is as follows:

<?
session_start();
if ($_SESSION['Condition'] !== 'Logged' || $_SESSION['UserType'] !== 'ITCo') {
    header("Location: login.php");
}
else {
    include_once "connection.php";
    include_once "emailnotification.php";
    $query = mysql_query("SELECT EndClients.EndClientBusinessName, Quotes.QuoteID, Quotes.QuoteTitle FROM Quotes LEFT JOIN EndClients ON Quotes.EndClientID = EndClients.EndClientID WHERE Quotes.QuoteID = '$_GET[quoteid]' AND Quotes.ITCompanyID = '$_SESSION[userID]' AND Quotes.QuoteStatus = 'Generation'") or die(mysql_error());
    while ($row = mysql_fetch_assoc($query)) {
        $TheCurrentDate = date("Y-m-d");
        $query = mysql_query("UPDATE Quotes SET QuoteDate = '$TheCurrentDate', QuoteStatus = 'Pending Admin Approval' WHERE QuoteID = '$row[QuoteID]'");
        ITCoSubmittedQuote_EmailAdmin($_SESSION['UserName'], $row['EndClientBusinessName'], $row['QuoteTitle']);
        header("itcoclientquotes.php?function=continueincompletequote&status=quotesubmitted");
    }
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.