Note that there are some explanatory texts on larger screens.

plurals
  1. POphp - populate products for every field in the table
    primarykey
    data
    text
    <p>I'm trying to populate the customers info in the table. I have acheived that with the code below. My problem is that in the last column I have the list of products with checkbox. The way how I coded it populates only for the first field(customer) in the table. I want it to have it with the unique id for every field as I'm planning to pass the POST function, create a row in SQL where I can assing the product to the customer. Any ideas ho to achieve this? Thanks</p> <pre><code> &lt;table border="1" cellpadding="5" cellspacing="0" class="list" id="assign"&gt; &lt;thead&gt; &lt;tr&gt; &lt;td class="left"&gt;First Name&lt;/td&gt; &lt;td class="left"&gt;Last Name&lt;/td&gt; &lt;td class="left"&gt;E-mail&lt;/td&gt; &lt;td class="left"&gt;Assign Product&lt;/td&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;?php if( mysql_num_rows( $selectRes )==0 ){ echo '&lt;tr&gt;&lt;td colspan="4" class="left"&gt;No Rows Returned&lt;/td&gt;&lt;/tr&gt;'; }else{ while( $row = mysql_fetch_assoc( $selectRes ) ){ echo "&lt;tr&gt;&lt;td class='left'&gt;{$row['firstname']}&lt;/td&gt;&lt;td class='left'&gt;{$row['lastname']}&lt;/td&gt;&lt;td class='left'&gt;{$row['email']}&lt;/td&gt;&lt;td&gt;&lt;div class='layer'&gt;&lt;p class='heading'&gt;Edit&lt;/p&gt;"; } } if( !( $selectRes2 = mysql_query( $selectSQL2 ) ) ){ echo 'Retrieval of data from Database Failed - #'.mysql_errno().': '.mysql_error(); }else{ } ?&gt; &lt;div class='area'&gt; &lt;div class='scrollbox'&gt; &lt;?php if( mysql_num_rows( $selectRes2 )==0 ){ echo '&lt;div&gt;No Rows Returned&lt;/div&gt;'; }else{ while( $row = mysql_fetch_assoc( $selectRes2 ) ){ echo "&lt;div id='inline'&gt;&lt;input type='checkbox'&gt;&lt;/input&gt;{$row['name']}&lt;/div&gt;"; } echo "&lt;input type='submit' value='Submit'&gt;&lt;/input&gt;"; } ?&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre>
    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