Wondering if anyone can help

  • Thread starter Thread starter Anonymous
  • Start date Start date
A

Anonymous

Guest
I have a lot of variables with the names in a format such as $name1, $name2, $name3 etc, and there can be differing amounts of these. I need to be able to read them in to seperate records within a table in my database and I was wondering if there is any useful code for doing it? If there is can someone post an example please.
 
it will be easiest if I show you the code to make the variables ok?

mysql_connect("localhost", "root", "homer");
mysql_select_db("Cruises",$db);
$sql = ("SELECT * FROM reports WHERE `reports`.'Criusenum' = '$cruisepage'");
$result = mysql_query($sql) or die("<b>Query Failed</b><br>\n".$sql."<br>\n".mysql_errno().": ".mysql_error());
$i=0;
while ($myrow = mysql_fetch_array($result)) {
$i=$i+1;
print "<tr>";
print "<td>";
echo "<input type='text' value='$myrow[document]' name='reportdocument$i' align='top'maxlength='30' size='60'>";
print "</td>";
print "<td>";
echo "<input type='text' value='$myrow[location]' name='reportlocation$i' align='top'maxlength='30' size='60'>";
Print"</td>";
print "<td>";
echo "<input type='text' value='$myrow[docname]' name='reportdocname$i' align='top'maxlength='30' size='60'>";
Print"</td>";
Print "</tr>";
}//end loop
?>

Basically, I need to return these variable to the database after being changed, what is a good way to add the variables in to the database?
 
Back
Top