jeudi 18 juin 2020

if ((select count(*) id from tbl)>1,req=1,req=2) [duplicate]

for example I am used to doing this in mysql

.
.
.
$strcon = "if ((select count(id) from tdl where id=1)>0, req=1, req=0)";

$result = $conn->query($strcon);
$dr = $result->fetch_assoc();   /*<<<<this line has error< Fatal error: Uncaught Error: Call to
                                 a member function fetch_assoc() on bool in 
                                 path:43 Stack trace: #0 path(54): runfunction() #1 {main} thrown 
                                 in path on line 43>*/

$samle=$dr["req"];

But it can't work in MySql or php Please help.

Aucun commentaire:

Enregistrer un commentaire