Note that there are some explanatory texts on larger screens.

plurals
  1. POPull data from Mysql Into Dropdown
    primarykey
    data
    text
    <p>**UPDATED</p> <pre><code> &lt;?php // Get select box of courses to comment on $pID3 = filter_input(INPUT_GET, 'pID', FILTER_SANITIZE_NUMBER_INT); $username = "###"; $password = "###"; $pdo3 = new PDO('mysql:host=localhost;dbname=###', $username, $password); $pdo3-&gt;setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); $sth3 = $pdo3-&gt;prepare(' SELECT C.prefix, C.code FROM Department D, Course C WHERE D.dID = C.dID **AND pID = ?** '); $sth3-&gt;execute(array( $pID3 )); ?&gt; &lt;html&gt; &lt;?php echo "&lt;form action='inc/q/prof.php' method='post'&gt; &lt;select id='courseInfoDD' name='courseID' tabindex='1'&gt;"; ?&gt; &lt;?php while($row3 = $sth3-&gt;fetch(PDO::FETCH_ASSOC)) { echo "&lt;option&gt;".$row3['prefix'].", ".$row3['code']."&lt;/option&gt;"; } ?&gt; &lt;?php echo "&lt;/select&gt;"; ?&gt; &lt;/html&gt; </code></pre> <p>Okay, so right now its pulled all courses regardless of the pID or (Professor ID). I added a statement in the select saying where pID = ? , since the pID is in the url of the page. But now it throws and error about pID???</p> <p>Query: </p> <pre><code>SELECT C.prefix, C.code FROM Department D, Course C, Professor P WHERE pID = ? AND D.dID = C.dID AND D.dID = p.dID; </code></pre> <ul> <li><p>Phpmyadmin error</p> <p>: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? AND D.dID = C.dID AND D.dID = p.dID LIMIT 0, 30' at line 3</p></li> </ul> <p>Db Img: <a href="http://postimage.org/image/24gdqab8k/" rel="nofollow">http://postimage.org/image/24gdqab8k/</a></p> <p>and</p> <p><a href="http://postimage.org/image/24gfdtnqc/" rel="nofollow">http://postimage.org/image/24gfdtnqc/</a></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.
 

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