Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL update query not working
    primarykey
    data
    text
    <p>I have a MySQL table which has the following columns</p> <pre><code>urlByCustomer table ---------------------------------------------- |customerID | TeamID | date | numUrlsConsumed| ---------------------------------------------- | | | | | ---------------------------------------------- urlmapping Column Type Null Default Comments MIME urlMappingID bigint(20) No customerID int(11) Yes 0 activityID int(11) Yes 0 contactID int(11) Yes 0 fullURL mediumtext Yes NULL lastModified timestamp No CURRENT_TIMESTAMP developerSandbox varchar(25) Yes </code></pre> <p>I've got this code that is being executed to update the table</p> <pre><code> $start = strtotime(date('Y-m-d 00:00:00')); $end = strtotime(date('Y-m-d 23:59:59')); $countAllThisGuysVals = "SELECT COUNT( DISTINCT`customerID`,`fullURL`) FROM `urlmapping` WHERE `urlMappingID` &gt;= $ORIGINAL_COPY AND `customerID` = $currentCustomerID"; $countTheVals= $conn-&gt;query($countAllThisGuysVals); $countedfinal =0; foreach ($countTheVals as $countRow) { $countedfinal = array_sum($countRow)/2; } $tableUpdateQuery = "UPDATE `urlByCustomer` SET `date` = NOW() WHERE `customerID`= $currentCustomerID AND UNIX_TIMESTAMP(`date`) BETWEEN '{$start}' and '{$end}'"; $conn-&gt;exec($tableUpdateQuery); $tableUpdateQuery = "UPDATE `urlByCustomer` SET `numUrlsConsumed` = $countedfinal WHERE `customerID`= $currentCustomerID AND UNIX_TIMESTAMP(`date`) BETWEEN '{$start}' and '{$end}'"; $conn-&gt;exec($tableUpdateQuery); echo "update path &lt;br&gt;"; $tableModified = true; $originalLPID++; </code></pre> <p>Variables are pretty much all declared, but the declarations are spread out, so I'm just posting this part to shorten it. The update query to the date column seems to be working, but the second update isn't. It worked 17 minutes ago though, so I'm confused since the only thing that changed between the next test was that I added some new values that should be causing it to update that column.</p> <p>Idk. I guess one possiblity could be the UNIX_TIMESTAMP. I'm running this in Parallels on a Mac, so I'm not sure what that translates to for timestamps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload