Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Wondering if anyone can help

Codes here !

Moderators: macek, egami, gesf

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.
Mh_0
New php-forum User
New php-forum User
 
Posts: 11
Joined: Thu Nov 14, 2002 7:13 am
Location: UK

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.
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

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

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

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

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

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


Return to mySQL & php coding

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron