开发者

Define a SQL query to call on

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜