OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

how to avoid memory overflow when selects are huge and included in a table [closed]

  • Thread starter Thread starter George Kourtis
  • Start date Start date
G

George Kourtis

Guest
I am really new to html, php and the surrounding world.

I need to present and interact with a database query and table, that holds some columns containing dropdowns that contain many options.

I managed to create a function that creates the select statement from the data given and the underlying table, and I managed too to create the table with all those select statements. The problem is that as soon as I increase the query limit from 80 to 100 rows the server goes on memory overflow. There are 4-5 select columns each around 300-500 options.

One solution would be to limit the output to 50 elements and navigate paging down (I understand that this may be the simplest and most straightforward option).

I am evaluating another option for select statements: Instead of having many repetitions of the same select, where among them the only difference is which element is selected by default, I could create a file with the select statement and include it many times while adding afterwards only an additional (duplicate) option with the currently selected selection. Eg.

Code:
<select> 
<option>opt1</select> <option>opt2</select> <option>opt3</select> <!-- the line with the previous options will be contained in file common for each different row -->
<option selected>opt2</select>
</select>

This will drop down massively the size of the dynamically created html data created by the php code, but I AM NOT SURE if anything would change regarding the memory overflow problem as at the end the same very huge data will be elaborated by the browser ( but may be not by the server ? ). SO FIRST QUESTION IS: will the previously describe approach have any effect in memory overflow on the server side ?

The second approach that was indicated by e.g. chatgpt is to include a javascript script that will populate dynamically the select statement. This approach obliges my to delve too in javascript while actually I have to manage at the same time: Postgres, php, html. So I am actually reluctant to take that route. So the SECOND QUESTION IS ON YOUR OPINION about and relative experience.

The optimal approach would be to have a library that manages all the above and takes care of all aspects without bothering me, and without requiring weeks to learn. So the THIRD QUESTION is: DOES IT EXIST SOMETHING SIMILAR ?

Any other ideas are welcome !

<p>I am really new to html, php and the surrounding world.</p>
<p>I need to present and interact with a database query and table, that holds some columns containing dropdowns that contain many options.</p>
<p>I managed to create a function that creates the select statement from the data given and the underlying table, and I managed too to create the table with all those select statements. The problem is that as soon as I increase the query limit from 80 to 100 rows the server goes on memory overflow. There are 4-5 select columns each around 300-500 options.</p>
<p>One solution would be to limit the output to 50 elements and navigate paging down (I understand that this may be the simplest and most straightforward option).</p>
<p>I am evaluating another option for select statements:
Instead of having many repetitions of the same select, where among them the only difference is which element is selected by default, I could create a file with the select statement and include it many times while adding afterwards only an additional (duplicate) option with the currently selected selection.
Eg.</p>
<pre><code><select>
<option>opt1</select> <option>opt2</select> <option>opt3</select> <!-- the line with the previous options will be contained in file common for each different row -->
<option selected>opt2</select>
</select>
</code></pre>
<p>This will drop down massively the size of the dynamically created html data created by the php code, but I AM NOT SURE if anything would change regarding the memory overflow problem as at the end the same very huge data will be elaborated by the browser ( but may be not by the server ? ). SO FIRST QUESTION IS: will the previously describe approach have any effect in memory overflow on the server side ?</p>
<p>The second approach that was indicated by e.g. chatgpt is to include a javascript script that will populate dynamically the select statement.
This approach obliges my to delve too in javascript while actually I have to manage at the same time: Postgres, php, html.
So I am actually reluctant to take that route. So the SECOND QUESTION IS ON YOUR OPINION about and relative experience.</p>
<p>The optimal approach would be to have a library that manages all the above and takes care of all aspects without bothering me, and without requiring weeks to learn.
So the THIRD QUESTION is: DOES IT EXIST SOMETHING SIMILAR ?</p>
<p>Any other ideas are welcome !</p>
 
Top