onefootswill Posted April 15, 2008 Share Posted April 15, 2008 Hi There, I am newish to php and have just been learning how to use prepared statements. My 1st question is, the php manual says that functions like mysqli->prepare() and mysqli->execute() are deprecated. Does that mean that something in php6 will be replacing them? And my code question. In the following code, the only thing which is messing the query up is the binding of the parameter - $stmt->bind_params('s', "0000-00-00 00:00:00"); $q = 'SELECT task_id, parent_id, task FROM tasks WHERE date_completed = ? ORDER BY date_added ASC'; // Also store the tasks in an array for use later: $tasks = array(); // Prepare statement, execute, bind result variables, and place results into bound result variables $stmt = $conn->stmt_init(); if ($stmt = $conn->prepare($q)) { $stmt->bind_params('s', "0000-00-00 00:00:00"); $stmt->execute(); $stmt->bind_result($task_id, $parent_id, $task); while ($stmt->fetch()) { echo "<option value=\"$task_id\">$task</option>\n"; $tasks[] = array('task_id' => $task_id, 'parent_id' => $parent_id, 'task' => $task); } } If I don't bind the parameter, the rest works fine. Any thoughts on why binding the date parameter breaks it? Cheers Link to comment https://forums.phpfreaks.com/topic/101156-binding-a-date-param/ Share on other sites More sharing options...
ucffool Posted April 15, 2008 Share Posted April 15, 2008 # mysqli_execute — Alias for mysqli_stmt_execute Deprecated usually means it was replaced with something else and may be removed in future versions. Another example is mysql_db_query(): 4.0.6 This function is deprecated, do not use this function. Use mysql_select_db() and mysql_query() instead. Link to comment https://forums.phpfreaks.com/topic/101156-binding-a-date-param/#findComment-517419 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.