RAN
02-07-2010, 01:56 PM
Hi,
I have a problem. I have a table named v2links and columns " id, url, caption, lastcheck, checked, fsize, keyword, type"
When I use this code to update only keyword column, gives me an error "Column count doesn't match value count at row 1 "
The code is:
<form name="auth" method="post" action="./customadd.php">
<textarea name="keywords" cols="30" rows="15"></textarea><br /><br />
<input type="submit" value="add custom words">
</form>';
mysql_query("UPDATE `v2links` SET `lastcheck`='1970-01-01 00:00:00' WHERE `lastcheck`<'1970-01-01 00:00:00'");
if(mysql_errno()) print mysql_error()."\n";
mysql_query("UPDATE `v2links` SET `lastcheck`=DATE_ADD(`lastcheck`,INTERVAL 1 MINUTE)");
if(mysql_errno()) print mysql_error()."\n";
if(isset($_POST['keywords']))
{
$kwds=split("\r\n",$_POST['keywords']);
if(count($kwds))
{
for($i=0;$i<count($kwds);$i++)
{
$kwds[$i]=mysql_real_escape_string(trim($kwds[$i]));
print $kwds[$i].": ";
mysql_query("INSERT INTO `v2links` VALUES(NULL,'".$kwds[$i]."',0)");
if(mysql_error()) print mysql_error()."\n";
else print "success!<br />\n";
}
}
}
print '</div>
</body>
';
?>
Can you help me please?
Thank you in advance
RAN
I have a problem. I have a table named v2links and columns " id, url, caption, lastcheck, checked, fsize, keyword, type"
When I use this code to update only keyword column, gives me an error "Column count doesn't match value count at row 1 "
The code is:
<form name="auth" method="post" action="./customadd.php">
<textarea name="keywords" cols="30" rows="15"></textarea><br /><br />
<input type="submit" value="add custom words">
</form>';
mysql_query("UPDATE `v2links` SET `lastcheck`='1970-01-01 00:00:00' WHERE `lastcheck`<'1970-01-01 00:00:00'");
if(mysql_errno()) print mysql_error()."\n";
mysql_query("UPDATE `v2links` SET `lastcheck`=DATE_ADD(`lastcheck`,INTERVAL 1 MINUTE)");
if(mysql_errno()) print mysql_error()."\n";
if(isset($_POST['keywords']))
{
$kwds=split("\r\n",$_POST['keywords']);
if(count($kwds))
{
for($i=0;$i<count($kwds);$i++)
{
$kwds[$i]=mysql_real_escape_string(trim($kwds[$i]));
print $kwds[$i].": ";
mysql_query("INSERT INTO `v2links` VALUES(NULL,'".$kwds[$i]."',0)");
if(mysql_error()) print mysql_error()."\n";
else print "success!<br />\n";
}
}
}
print '</div>
</body>
';
?>
Can you help me please?
Thank you in advance
RAN