Note that there are some explanatory texts on larger screens.

plurals
  1. POmysqli array -> query not attaining correct data
    primarykey
    data
    text
    <p>my <code>mysqli_fetch_array(mysqi_query($db, $query))</code> doesn't appear to be getting the correct information from the database, and therefore, the PHP application is not working as it should.</p> <p>Here are the queries, </p> <pre><code>&lt;?php if($_GET){ $current = mysqli_fetch_array(mysqli_query($db, "SELECT * from `tbl_user` WHERE `userid` = '".$_GET['userid']."'")); $currentperms = mysqli_fetch_array(mysqli_query($db, "SELECT * from `tbl_perms` WHERE `userid` = '".$_GET['userid']."'")); } ?&gt; </code></pre> <p>Concurrently, the <code>if ($current['userid'] == "1") {echo(" selected ");}</code> isn't outputting anything at all, so the correct option isn't selected in the SELECT tag.</p> <p>So, where: I'd expect: echo($currentperms['newapp']); not to equal 1, becuase it is set so in the database, the result of which is "1". I have test this by echoing the string gained. Newapp is not a column in the table either, so it shouldn't be returning "1" as a result.</p> <p>With this:</p> <pre><code> if $current['userid'] == "1") { echo(" selected "); } </code></pre> <p>Nothing is being echoed, however, the variable has been used in the script earlier, and the output of which is "1". </p> <p>Please help me, I'm going through the roof :|</p> <p>@sasa: output: Success!Array ( [0] => 1 [userid] => 1 [1] => shamil.nunhuck [username] => shamil.nunhuck [2] => Shamil Nunhuck [userfullname] => Shamil Nunhuck [3] => shamil.nunhuck@localhost [useremail] => shamil.nunhuck@localhost [4] => 6363d731bd7492fe4c33fc3d90fd61bc [userpassword] => 6363d731bd7492fe4c33fc3d90fd61bc [5] => 1 [userlevel] => 1 [6] => Administrator [usertitle] => Administrator [7] => 1 [tos] => 1 ) Array ( [0] => 1 [userid] => 1 [1] => 0 [ptodo] => 0 [2] => 0 [usercp] => 0 [3] => 0 [pm] => 0 [4] => 0 [bug] => 0 [5] => 0 [abug] => 0 [6] => 0 [admincp] => 0 [7] => 0 [intmgs] => 0 [8] => 0 [adduser] => 0 [9] => 0 [pass] => 0 [10] => 0 [useredit] => 0 [11] => 0 [listuser] => 0 [12] => 0 [newapp] => 0 )</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload