Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/ucp/domains/usachatplace.com/public_html/updateImageStatus.php on line 23
Mislim da je problem u tome sto je polje status tipa ENUM i da zbog toga ne moze da izvrsi komandu uspesno.
Trazila sam po netu kako resiti problem medjutim nigde ne pise kako izvuci informacije iz tabele kada kao uslov postavis polje koje je tipa ENUM.
Hvala Puno
Code:
<?php
error_reporting(E_ALL);
ini_set("display_errors", true);
$myServer = "****";
$myUser = "*****";
$myPass = "****";
$myDB = "*********;
//connection to the database
$dbhandle = mysql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");
//select a database to work with
$selected = mysql_select_db($myDB, $dbhandle);
$select = "SELECT * FROM gallery_images WHERE status='INACTIVE'";
$query = mysql_query($select);
$time =time();
while($row = mysql_fetch_assoc($query))
{
extract($row);
$id = $row['user_id'];
$timesubmited = $row['timesubmited'];
$difference = $time - $timesubmited;
echo "the id".$id."<br />";
echo "time: ".$timesubmited;
if($difference >= 300){
$update = " UPDATE gallery_images SET status = 0 WHERE id ='$id'";
$query = mysql_query($update) or die('MySQL Error:'.mysql_error());
echo "success!";
}
else
echo "failed";
}
?>
<?php
error_reporting(E_ALL);
ini_set("display_errors", true);
$myServer = "****";
$myUser = "*****";
$myPass = "****";
$myDB = "*********;
//connection to the database
$dbhandle = mysql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");
//select a database to work with
$selected = mysql_select_db($myDB, $dbhandle);
$select = "SELECT * FROM gallery_images WHERE status='INACTIVE'";
$query = mysql_query($select);
$time =time();
while($row = mysql_fetch_assoc($query))
{
extract($row);
$id = $row['user_id'];
$timesubmited = $row['timesubmited'];
$difference = $time - $timesubmited;
echo "the id".$id."<br />";
echo "time: ".$timesubmited;
if($difference >= 300){
$update = " UPDATE gallery_images SET status = 0 WHERE id ='$id'";
$query = mysql_query($update) or die('MySQL Error:'.mysql_error());
echo "success!";
}
else
echo "failed";
}
?>