Jump to content

Recommended Posts

I have tried altering my code below, but I continuously get "Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\setlastpurchase.php on line 82" and I cannot figure out what the problem is.  Here is the code below. I dont really care if you see my database connection info, cause it is on a network that is JUST an internal network, with no network access. If anyone can provide any help, I would greatfully appreciate that.

 

Dustin

???

 

<?php
$cfg['mysql_server'] = 'localhost';
$cfg['database'] = 'mailinglist';
$cfg['user'] = 'root';
$cfg['passwordbase'] = '';
$db = @mysql_connect($cfg['mysql_server'], $cfg['user'], $cfg['passwordbase']);
//////////////includied to show where $calldate is from////////////////
while ($query = "SELECT * FROM `mailinglist`.`calls` WHERE `processed` = 0 LIMIT 0, 1")
{
    $result = @mysql_query($query, $db);
    $row = mysql_fetch_assoc($result);
    $calldate = $row["Date"];
/////////////////////////////////////////////////////////////////////
$result8 = @mysql_query("SELECT * FROM `marketing` WHERE `Date` = '$calldate'", $db);
//Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\setlastpurchase.php on line 82 (next line)//
    $row8 = mysql_fetch_assoc($result8);
    $oldsalesmarketing = $row8["Sales"];
    $marketingdate = $row8["Date"];
    if (!$marketingdate)
    {// Run query
        mysql_query("INSERT INTO `marketing`(`Date`, 'Month', 'Day', 'Year', 'Sales') VALUES('$calldate', '$callmonth', '$callday', '$callyear', '1')", $db);
        echo "<br>WAS Empty";
        $newsalesmarketing = 1;
    }
    else
    {
        echo "<br>Not Empty";
    	$newsalesmarketing = $oldsalesmarketing + 5;
    	$query6 = "UPDATE `mailinglist`.`marketing` SET `Sales` = '$newsalesmarketing' WHERE `marketing`.`Date` = '$calldate'";
    	$result6 = @mysql_query($query6, $db);
    }
?>

Link to comment
https://forums.phpfreaks.com/topic/58121-need-some-help-with-mysql_fetch_assoc/
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.