> greeting from gray, rainy days in berlin
It's even greyer here in Cambridge UK!

Anyway:

Book Title: "Fast and Easy Web Development"
By: Julie C Meloni
URL: www.thickbook.com 

Or on amazon.com:
http://www.amazon.com/exec/obidos/ASIN/076153055X/qid=1008083185/sr=2-1/ref=sr_2_75_1/002-6473897-5819259

Good luck!
Russ


On Tue, 11 Dec 2001 16:03:17 +0100 es said <[EMAIL PROTECTED]> wrote:

> dear russ,
> thanks a lot for the immediate help!!!
> theproblem i'm chewing on is in fact a bit more complicated, because i got
> this 'mysql_insert_id()' into this.
> i'm constantly reading the php-manual and a heap of different books as wll
> as searching the net and so on,
> but i still got a problem to bring mysql and php together, because i'm quite
> a newbie to this...
> so if you could recoomend a book or a website that could help me upon this -
> maybe with examples or stuff - i would be really grateful.
> and thanks a lot for your patience!
> greeting from gray, rainy days in berlin
> cornelia
> 
> _____________________________________________________
> 
> spacedealer GmbH
> 
> Paul-Lincke-Ufer 42-43
> 10999 Berlin
> 030 / 695350-0
> 
> 
> -----Ursprungliche Nachricht-----
> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]Im Auftrag von Russ
> Michell
> Gesendet: Dienstag, 11. Dezember 2001 15:37
> An: es said
> Cc: [EMAIL PROTECTED]
> Betreff: Re: [PHP-DB] how to get an array into a mysql-db-table
> 
> 
> the foreach() structure is a loop and you can't use it to assign to a
> variable.
> 
> Please do read the manual as it really does help you if you re stuck!
> http://uk.php.net/manual/en/control-structures.foreach.php
> 
> What you need to do is arrange the query around the loop itelse, so that the
> variables are the
> objects that are in the loop and the things that stay single ("INSERT INTO
> <table>") *do* stay
> single.
> 
> So something like the following:
> 
> //----start off the query
> $sql1 = "INSERT INTO <table_name> (";
> //----start looping thru the array
> foreach($array as $key=>$val) {
> //---declare data to insert (helps if you have the same database fieldnames
> as array key names!)
> $sql2 .= "$key,";
> //----remove the last auto-generated comma from array key (field) list and
> add closing bracket
> $sql3 = substr($sql2,0,-1) . ")";
> //----start insertion of values list, wrapping comma's and quotes around
> $val
> $sql4 = "VALUES (" . "'" . $val . "'" . ",";
> //----remove the last auto-generated comma from values list and add closing
> bracket
> $sql5 = substr($sql4,0,-1) . ")";
> }//----end loop
> //----build the parts to become a whole query and add the SQL 'WHERE' clause
> $sql = $sql1 . $sql3 . $sql5 . "WHERE X=Y";
> 
> 
> That should do it for ya.
> Russ
> 
> On Tue, 11 Dec 2001 14:59:27 +0100 es said <[EMAIL PROTECTED]> wrote:
> 
> > hello again,
> > russ gave me a wonderful tip, but now i'm standing in front of the next
> > problem:
> > if i try to insert these values out of the array into the table of the db,
> > i
> > probably don't know the correct way.
> > this is how i tried it:
> > /*
> > this works fine!
> > */
> > foreach($werbeform as $key=>$val) {
> > echo "<p><b>$key: </b>" . "$val</p>";
> > }
> >
> > /*
> > but this doesn't get the data into the db_table called 'werbe':
> > */
> > $anfrage_werbe=foreach($werbeform as $key=>$val) {
> > "INSERT INTO werbe (id_main,werbeform) VALUES ('$id','$val')";
> > };
> > can anybody tell me what i'm doing wrong?
> > the values of the checkboxes should be added to the db-table each as a new
> > line, e.g. not all into one field.
> >
> > -----Ursprungliche Nachricht-----
> > Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]Im Auftrag von Russ
> > Michell
> > Gesendet: Dienstag, 11. Dezember 2001 12:24
> > An: es said
> > Cc: [EMAIL PROTECTED]
> > Betreff: Re: [PHP-DB] how to access checkboxes & get them into database
> >
> > I don't think you need to get into global variables unless you *really*
> > need
> > to. In this case it
> > sounds as if you don't.
> > OK so you have an array of checked values, so what's next? You wanna get
> > those variables outta that
> > array in your process script, and perform whatever it is you want
> (inserts,
> > updates etc) upon those
> > variables.
> > so:
> > foreach($array as $key=>$val) {
> > echo "<p><b>$key: </b>" . "$val</p>";
> > }
> > This will echo the array's keys (labels, whatever) and their associated
> > values to the page. (just
> > so you can see what's going on)
> > You can now use these vars ($key and $val) to perform your DB inserts
> > updates etc.
> > I hope that was of use to you.
> > Regards:
> > Russ
> >
> > On Tue, 11 Dec 2001 12:14:01 +0100 es said <[EMAIL PROTECTED]> wrote:
> > > hi there,
> > > this time i've got another problem with my set of database-tables:
> > > i created a database (containing 6 tables) and some html-sheets for the
> > in-
> > > and output. so far, so good.
> > > some values should be added to ONE of those tables table by checking
> > > checkboxes in a form.
> > > okay, the checked values of the checkboxes go into an array, which is
> > given
> > > to the processing php-sheet as globals, but furtheri don't get yet.
> > > can someone please help me?
> > > all thanx !!!
> > > cornelia
> > >
> > "Believe nothing - consider everything"
> > Russ Michell
> > Anglia Polytechnic University Webteam
> > Room 1C 'The Eastings' East Road, Cambridge
> > e: [EMAIL PROTECTED]
> > w: www.apu.ac.uk/webteam
> > www.theruss.com
> 
> #-------------------------------------------------------#
> 
>   "Believe nothing - consider everything"
> 
>   Russ Michell
>   Anglia Polytechnic University Webteam
>   Room 1C 'The Eastings' East Road, Cambridge
> 
>   e: [EMAIL PROTECTED]
>   w: www.apu.ac.uk/webteam
> 
>   www.theruss.com
> 
> #-------------------------------------------------------#
> 

#-------------------------------------------------------#
                                
  "Believe nothing - consider everything"       
  
  Russ Michell
  Anglia Polytechnic University Webteam
  Room 1C 'The Eastings' East Road, Cambridge
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam

  www.theruss.com
                        
#-------------------------------------------------------#


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to