buddyh — 2011-06-22T13:07:42-04:00 — #1
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);
starlion — 2011-06-22T13:12:23-04:00 — #2
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.
buddyh — 2011-06-22T13:17:02-04:00 — #3
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
r937 — 2011-06-22T14:14:21-04:00 — #4
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()'
buddyh — 2011-06-22T18:29:21-04:00 — #5
Haha yes that was going to be my very next puzzle, you beat me to it!
Thanks guys, you rock!