I have created a new boolean column on my table and I want to update it when I have viewed the contents of a row.
So I have made a page where I can view the contents of a row where id = whatever. And I made the function below to update the boolean value and the date. But I get a warning saying missing argument 1 for my function.
Toi be honest I have never used booleans in mysql before, so I might be doing this completely wrong.
In the table, I have a row called leads and the boolean column is called sent which has a default value of 0. Here is my function, which I simply call when the view page is launched.
// Mark Sent
$id = $_GET['id'];
$connection = db_connect();
$query = ("UPDATE leads SET sent = '1', date = 'NOW()' WHERE id = '$id'" );
$result = mysql_query($query);
This function is expecting input in the form of a single parameter $params. If you are calling it as mark_sent(), you arnt sending anything through to fill $params, hence the error. You can remove the $params from the function definition, since you dont actually appear to be using it in the function.
Duh! Thanks StarLion!
I copied & edited an existing function which originally had sprintf stuff in it, another rookie mistake. Works a treat now, many thanks
you are updating the column to a string, not a datetime value
i'll bet you actually want to use the NOW() mysql function, instead of the string 'NOW()'
Haha yes that was going to be my very next puzzle, you beat me to it!
Thanks guys, you rock!