0
 $table_name = 'tbl_users';
 $data = array('datetime'=>'NOW()',
                'ipadress' => $ipaddress, 
                'name' => $name,
                'dob' => $dob, 
                'nationality' => $nationality, 
                'address' => $address, 
                'city' => $city, 
                'state' => $state, 
                'pincode' => $pincode,
                'phone' => $phone,
                'email' => $email,
                'mobile' => $mobile,
                'weight' => $weight,
                'height'=> $height,
                'marital' => $marital,
                'degree' => $degree,
                'institute' => $institute,
                'special' => $special,
                'yearofpaas' => $yearofpaas,
                'grade' => $grade,
                'emplyment_history' => $emplyment_history,
                'merits' => $merits,
                'major_achivements' => $major_achivements,
                'interview_attended' => $interview_attended,
                'details' => $details,
                'minctc_position' => $minctc_position,
                'cv_file' => $cv_file,
                'declaration' => $declaration);
echo "<pre>";
print_r($data); 
drupal_write_record($table_name, $data);

我有这个插入查询,但不知何故记录没有进入表..谁能帮我...查询中的问题是什么??????

4

3 回答 3

1

drupal_write_record仅当 my_module.install 文件中存在表架构时才有效。

这里: drupal_write_record根据模式将记录保存(插入或更新)到数据库中。

因此,请确保tbl_users存在表架构。此外,正如Dan U.使用date("Y-m-d H:i:s")而不是'Now()'所提到的。

于 2013-07-02T17:58:06.747 回答
1

您将 NOW() 作为字符串传递,这是行不通的。请尝试:

$data = array('timestamp' => date("Y-m-d H:i:s"),
于 2013-07-01T14:01:05.277 回答
0

dblog可以让您很好地了解查询中的问题路径是admin/reports/dblog

于 2013-07-02T09:04:26.203 回答