j3rmain3 Posted October 17, 2006 Share Posted October 17, 2006 I have a table which has been setup in HTML, but now i need to store a rating system for the documents. I really do not want to copy all the data and enter it into mysql manually because there are about 50 documents. Is there a way i could place the data from the html table into mysql by using variables or something like that?Here is some sample coding incase someone will need coding to work with[size=9pt]Table Coding[/size][code]echo "<tr>";echo "<td>Players Name</td>";echo "<td>Position</td>";echo "<td>Goals</td>";echo "</tr>";echo "<tr>";echo "<td>Jeremy Beadle</td>";echo "<td>Striker</td>";echo "<td>15</td>";echo "</tr>";[/code] [size=9pt]php[/size][code]mysql_connect(****,****,****) or die ("ERROR:".mysql_error());mysql_select_db(****) or die ("ERROR."mysql_error());$query = "INSERT INTO ( This is where i have no idea what to write to import the data from the exisiting data in the html table into mySQL db )";[/code]The table has already been setup in mysql. All i need to do is copy the info across.If more coding is need, just send a replythanksj3rmain3 Quote Link to comment https://forums.phpfreaks.com/topic/24198-copying-data-from-html-table-into-mysql/ Share on other sites More sharing options...
HuggieBear Posted October 17, 2006 Share Posted October 17, 2006 It can be done by using fopen() on the html files and then using preg_match() or preg_match_all() or something similar to extract the data.You'd need to read up on the preg_* functions first.If someone else has a better idea, I'm sure they'll post it soon. Maybe something XML related.RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/24198-copying-data-from-html-table-into-mysql/#findComment-109972 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.