我在 现在如何编写代码脚本,以便使用 我试过了: p>
但它没有显示任何结果! p>
如果我想显示所有结果,可以轻松跳过 PHP code>中有一个脚本,它从
Mysql <中选择数据 / code>数据库使用
选择 code>&amp;
Where code>子句。 p>
$ lrn =“PU2017LN11K”;
$ stmt = $ user_home-&gt; runQuery('SELECT * FROM mcq WHERE LRN =:crn ORDER BY LRN,Sr ASC');
$ stmt-&gt; bindParam(':crn',$ lrn);
$ stmt-&gt; execute();
code> pre >
WHERE LRN =:crn code>从所有
LRN code>中进行选择。 p>
$ lrn =“*”;
$ stmt = $ user_home-&gt; runQuery('SELECT * FROM mcq WHERE LRN =: crn ORDER BY LRN,Sr ASC');
$ stmt-&gt; bindParam(':crn',$ lrn);
$ stmt-&gt; execute();
code> pre> \ n
WHERE code>子句,但是\
$ _ Gn code>方法将定义
$ lrn code>的值。 p>
div>
I have a script in PHP
, which selects data from a Mysql
Database using Select
& Where
clause.
$lrn= "PU2017LN11K";
$stmt = $user_home->runQuery('SELECT * FROM mcq WHERE LRN = :crn ORDER BY LRN,Sr ASC ');
$stmt->bindParam(':crn',$lrn);
$stmt->execute();
Now how to script the code so that it selects from all the LRN
, using WHERE LRN = :crn
.
I tried:
$lrn= "*";
$stmt = $user_home->runQuery('SELECT * FROM mcq WHERE LRN = :crn ORDER BY LRN,Sr ASC ');
$stmt->bindParam(':crn',$lrn);
$stmt->execute();
But it didn't show any results!
It's easy to skip the WHERE
clause if I want to show all results, but
the value of $lrn
will be defined by the $_GET
method.