LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-08-2004, 07:09 AM   #1
simpleguy
LQ Newbie
 
Registered: Jul 2004
Posts: 2

Rep: Reputation: 0
Arrow php arrays and mysql


can anyone help me with this?

i've got 3 values that will be dynamic rooms, rates and dates.

i'm posting them onto another page wherein it will be inserted into a database.

right now, i'm using room[], dates[] and rates[] and retreiving these values using the for..each loop

my problem is how do i insert the values to the corrosponding rooms and dates since i'm just able to insert only the last values generated.

is there a way out?
 
Old 07-08-2004, 07:13 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977
not totally sure what you're asking... can you provide the sample code you have got so far to explain why it's not sufficient?
 
Old 07-08-2004, 07:28 AM   #3
simpleguy
LQ Newbie
 
Registered: Jul 2004
Posts: 2

Original Poster
Rep: Reputation: 0
here's some code

file 1
<input type=text name=room>
<input type=text name=dateval[]>
<input type=text name=values[]>

file 2
$roomid = $_POST['room'];
$dateval =$_POST['dateval'];
$rvalues =$_POST['values'];


foreach($dateval as $dvals) {

$sql = "insert into tbl (id, datevalues) values ($roomid,'$dvals')";
$res = mysql_query($sql);

}

foreach($dateval as $dvals) {

foreach($rvalues as $s) {

$sql1 = "UPDATE tbl SET val= '$s' WHERE id=$roomid and dt='$dvals'";
$res1 = mysql_query($sql1);
}
}
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
php classes, arrays towlie Programming 10 06-07-2005 12:10 PM
Arrays, checkboxes in javascript & PHP Elijah Programming 21 11-16-2004 12:37 AM
Static Arrays in php Not working ElementNine Programming 4 03-05-2004 11:29 AM
PHP - Reading data from multidimentional arrays and mail it. zyrtech Programming 8 08-09-2003 09:03 PM
php - include, require and arrays gui10 Programming 1 02-05-2002 09:54 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration