Wondering if anyone can help

Codes here !

Moderators: macek, egami, gesf

Mh_0
New php-forum User
New php-forum User
Posts: 11
Joined: Thu Nov 14, 2002 7:13 am
Location: UK
Contact:

Wondering if anyone can help

Postby Mh_0 » Wed Nov 20, 2002 1:30 am

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.

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Wed Nov 20, 2002 3:01 am

try to explain me what are you want to do, becouse i did not understand nothing =(

P.S.
English not native language for me =(
Last edited by Oleg Butuzov on Wed Nov 20, 2002 3:11 am, edited 1 time in total.

Mh_0
New php-forum User
New php-forum User
Posts: 11
Joined: Thu Nov 14, 2002 7:13 am
Location: UK
Contact:

Postby Mh_0 » Wed Nov 20, 2002 3:08 am

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?

Mh_0
New php-forum User
New php-forum User
Posts: 11
Joined: Thu Nov 14, 2002 7:13 am
Location: UK
Contact:

Postby Mh_0 » Wed Nov 20, 2002 6:45 am

Sorted.

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Wed Nov 20, 2002 7:33 pm



Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 1 guest

cron