Note that there are some explanatory texts on larger screens.

plurals
  1. POconfusion with php function resulting in error on different server
    primarykey
    data
    text
    <p>i have problem which i dont know how to solved, this is a snapshot of my php script.</p> <pre><code> foreach($result as $row){ $Admin [] = array('id'=&gt;$row['id'],'username' =&gt; $row['username'], 'email' =&gt; $row['email'], 'password'=&gt;$row['password']); } include 'view_admins.php'; </code></pre> <p>and this is part of the <code>view_admins.php</code> thats relevent to my question</p> <pre><code> &lt;article id="admins"&gt;//html tag &lt;?php foreach($Admin as $admins)://this is line 75 ?&gt; &lt;form action="" method="post" &gt; &lt;div&gt; &lt;p&gt;&lt;tr&gt;&lt;td&gt;&lt;p&gt;&lt;?php htmlout($admins['username']); ?&gt;&lt;/p&gt;&lt;/td&gt;&lt;td&gt; &lt;input type="hidden" align="center" name="id" value="&lt;?php echo $admins['id'];?&gt;"&gt;&lt;/td&gt;&lt;td&gt; &lt;input type="submit" name="action" value="edit"&gt; &lt;input type="submit" name="action" value="delete"&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/div&gt; &lt;/form&gt; &lt;?php endforeach; ?&gt; &lt;/article&gt; </code></pre> <p>when this code runs it produces a "<code>Warning: Invalid argument supplied for foreach() in /home/a2516093/public_html/connect/view_admins.php on line 75</code>"</p> <p>my confusion is this code runs perfectly fine on my localhost however when uploaded to my host it produces the above mentioned Warning, can someone please tell me what could be causing the problem, im still learning php programming so any help would be highly appreciated.</p> <p>To my understanding <code>$Admin</code> should be visible in <code>view_admins.php</code>, correct me if im wrong. Thank you</p>
    singulars
    1. This table or related slice is empty.
    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.
    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