0

帮助,我似乎无法将我的数据从特定表复制到另一个表。我已经尝试过这些尝试。

代码 1:

$queryzx = odbc_exec($conn, "SELECT * FROM tempmember WHERE userid='$usernamez'");

    $usernamexx = odbc_result($queryzx, 'userid');
    $passwordxx = odbc_result($queryzx, 'passwd');
    $ignxx = odbc_result($queryzx, 'usernick');
    $genderxx = odbc_result($queryzx, 'sex');
    $emailxx = odbc_result($queryzx, 'email');

$query = odbc_exec($conn, "INSERT INTO member (userid, usernick, sex, passwd, vip, email) 
                                       VALUES ('$usernamexx', '$ignxx', '$genderxx', '$passwordxx', 1, '$emailxx')");

结果:$查询错误

代码 2:

$queryzx = odbc_exec($conn, "SELECT * FROM tempmember WHERE userid='$usernamez'");
$resultx = odbc_free_result($queryzx);
while($transf = odbc_fetch_array($resultx))
{
    $usernamexx = $transf['userid'];
    $passwordxx = $transf['passwd'];
    $ignxx = $transf['usernick'];
    $genderxx = $transf['sex'];
    $emailxx = $transf['email'];
$query = odbc_exec($conn, "INSERT INTO member (userid, usernick, sex, passwd, vip, email) 
                                       VALUES ('$usernamexx', '$ignxx', '$genderxx', '$passwordxx', 1, '$emailxx')");
}

结果:$查询错误

任何帮助将不胜感激,在此先感谢^^

4

2 回答 2

1

if$genderxx是一个位值,你应该b在它之前使用,就像b'$genderxx'INSERT语句中一样

于 2013-05-30T09:59:29.400 回答
0

感谢所有的帮助。我强迫自己将 $genderxx 转换为 varchar。就我而言,这没关系。

于 2013-05-30T10:28:15.743 回答