Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><em><strong>ANSWER:</em></strong></p> <p>your code:</p> <pre><code> while($result = mysql_fetch_array($query)) { echo '&lt;div class="form"&gt;'.$result['employeeName'].'&lt;/div&gt;'; } </code></pre> <p>should be:</p> <pre><code> while($res = mysql_fetch_array($result)) //changed to the name of the variable that stores the query (can't store the array in a variable named after the query so i've changed it to $res...) { echo '&lt;div class="form"&gt;'.$res['employeeName'].'&lt;/div&gt;'; } </code></pre> <p><strong>OLD:</strong> Are you retrieving the result of the query? To return just one result use the mysql_fetch_assoc() function and to return an entire row (or more variables) use mysql_fetch_array().</p> <p>Example: </p> <pre><code> $test = mysql_fetch_assoc($query); $array = mysql_fetch_array($query); </code></pre> <p>Ps. To Select an array use a syntax similar to : </p> <pre><code> "SELECT * FROM table WHERE var = condition" </code></pre> <p>PPs. This was taken from php.net:</p> <pre><code> This extension is deprecated as of PHP 5.5.0, and is not recommended for writing new code as it will be removed in the future. Instead, either the mysqli or PDO_MySQL extension should be used. See also the MySQL API Overview for further help while choosing a MySQL API. </code></pre> <p><strong>EDIT:</strong></p> <p>Your code: </p> <pre><code> $query = mysql_query("SELECT employeeName FROM employeeForm WHERE companyName='$employeeName'") or die(mysql_error()); </code></pre> <p>You treat the variable as text (variable name not content :) )... use: </p> <pre><code> WHERE '".$employeeName."' </code></pre> <p>to parse variables into query... (observe the double quotes)</p> <p><strong>Also</strong>... to access the results of the query use something like:</p> <pre><code> $array['COLUMN NAME']; </code></pre> <p>..assuming you use : $array = mysql_fetch_array($query); </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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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