无法提交我的 drupal 表单;它有一个更新查询

发布于 2024-11-27 07:08:36 字数 490 浏览 0 评论 0原文

我正在制作一个自定义模块,它还允许编辑页面来编辑特殊节点。 字段下方有一个更新按钮;所以我为这一切制作了一个表格 以下是我的表单的 hook_submit

      function game_week_edit_form_submit($form_id, &$form_state) 
       {
$result = db_query("UPDATE {game_week} SET 
  start_time = %s, open_time = %s , close_time = %s WHERE game_week_id= %d", 
        $form_state['values']['start_time'], $form_state['values']['open_time'],   
           $form_state['values']['close_time'],$form_state['values']['game_week_id']);  
   }

I am making a custom module which also enables an edit page to edit the special node .
Below the feilds there is an update button ; so i have made a form for all this and
following is my hook_submit for the form

      function game_week_edit_form_submit($form_id, &$form_state) 
       {
$result = db_query("UPDATE {game_week} SET 
  start_time = %s, open_time = %s , close_time = %s WHERE game_week_id= %d", 
        $form_state['values']['start_time'], $form_state['values']['open_time'],   
           $form_state['values']['close_time'],$form_state['values']['game_week_id']);  
   }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

燃情 2024-12-04 07:08:36

您需要用引号将查询中的字符串括起来:

function game_week_edit_form_submit($form_id, &$form_state) 
{
  $result = db_query("UPDATE {game_week} SET 
    start_time = '%s', open_time = '%s' , close_time = '%s' WHERE game_week_id = %d", 
    $form_state['values']['start_time'], $form_state['values']['open_time'],   
    $form_state['values']['close_time'],$form_state['values']['game_week_id']);
}

如果不是这样,请在最近的日志条目中查找任何数据库失败 - admin/reports/dblog

You need to wrap your strings in the query with quotes:

function game_week_edit_form_submit($form_id, &$form_state) 
{
  $result = db_query("UPDATE {game_week} SET 
    start_time = '%s', open_time = '%s' , close_time = '%s' WHERE game_week_id = %d", 
    $form_state['values']['start_time'], $form_state['values']['open_time'],   
    $form_state['values']['close_time'],$form_state['values']['game_week_id']);
}

If that's not it, look in the recent log entries for any db fails - admin/reports/dblog

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文