开发者

Define a SQL query to call on

开发者 https://www.devze.com 2023-02-13 01:34 出处:网络
Say I have the following php code: $sql = \"SELECT firstname FROM contact WHERE \'{$_REQUEST[\'userid\']}\' = contactid\";

Say I have the following php code:

$sql = "SELECT firstname FROM contact WHERE '{$_REQUEST['userid']}' = contactid";
$rs = $conn->Execute($sql);
if (!$rs) {
print $conn->ErrorMsg();
}
else {
while (!$rs->EOF) {
print $rs->fields[0].'<br>';
$rs->MoveNext();  //  Moves to the next row
}}

Which works well, 开发者_JAVA百科however, how can I define that scrip/code to have the following in my form:

<p>First Name: <?php $whatever_it_can_be ?></p>


else {
    if (!$rs->EOF) {
        $firstname = $rs->fields[0];
    } else {
        // user id is invalid
    }
}

Then in the page:

<p>First Name: <?php echo $firstname; ?></p>
0

精彩评论

暂无评论...
验证码 换一张
取 消