MySQL Table Loop using PHP -
I have an online form that collects consumer data and stores in a dedicated MySQL database. In some instances, in the URL Data is passed under the "RFID" variable which is also stored in the database and is connected to each registration.
I use 'mysql_num_rows ($ results)' to get all the agent details on any other page, but it only exchanges all the available details. My goal is as follows:
Target
I want to create an HTML table in which rows are automatically generated based on the list of all registrations on my site. A new row is created and only if a specific RefID is present on that particular record. In the event the field is zero, it is reported in a row.
In short, the HTML table may look like this:
RefID - The number of nominations
abc123 - 10
Baseball - 11
twonk - 7
NULL - 33
Where abc123 is a special RefID and 10 times that number is refid DB If new registration comes with REFID = "horses", then a new row has been created, showing "horse - 1"
Has anyone given any suggestions?
Div class = "post-text" itemprop = "text">I think this is what you want, I have tested it and returns the correct value:
& Lt ;? Php $ query = mysql_query ("select safe refID to test_this"); Echo & lt; Table & gt; '; While ($ data = mysql_fetch_array ($ query)) {$ uniq = mysql_num_rows (mysql_query ("selection from test_this where refID = '". $ Data [' refID ']. "' ')))); Anco '& lt; Tr & gt; & Lt; Td & gt; ' $ "Data [" RefID "]. & Lt; / Td> & Lt; TD & gt; '. $ Uniq. ' & Lt; / Td> & Lt; / Tr & gt; '; } Echo '& lt; / Table & gt; '; ? & Gt;
If your problem is not resolved, just tell me, I will try to help better! Edit: The result above was a table:
abc123 - 5
baseball - 4
twonk - 6 < / P>
Comments
Post a Comment