PDA

View Full Version : Inserting a html table contents into mysql database


tau9
05-13-2009, 05:11 PM
Hi,

Is it possible to insert the contents of a table without actually declaring the values but simply by using the table id. i.e.

<table id="thistable">
<td>******</td>
</table>

Then the contents of <td> would be inserted.

If yes are there any tutorials on how?

thanks in advance

brazenskies
05-13-2009, 05:22 PM
What you want to do is store the values in the database, then generate the html using some server side script

Fumigator
05-13-2009, 05:29 PM
brazenskies is correct, but you could store the HTML template in a separate MySQL table, using a unique character or string of characters or variable names to indicate the locations where a replacement string will go.

For example you could store in a table called template:


<table id="thistable">
<td>%__NAME__%</td>
</table>


And then in another table store your variable names and replacement values:


variable_name Value
-----------------------------------
%__NAME__% Maynard Higginbottom


Then your server side language (PHP or whatever) will select the template and the variable name and value from your tables and perform a string replacement to put it all together.