www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] for each array problem

  1. #1
    Join Date
    Mar 2008
    Posts
    88

    resolved [RESOLVED] for each array problem

    Im trying to add a coma to my form results but its just returning

    'oak', 'wren'SELECT date FROM activities WHERE place IN (Array)Unknown column 'Array' in 'where clause'

    PHP Code:
    $out = array();
    foreach(
    $_POST['place'] as $place){
        
    array_push($out"'$place'");
    }
    echo 
    implode(', '$out); 

    HTML Code:
    $date = "SELECT date FROM activities WHERE place IN ($out)";
    echo $date;
    $grey = mysql_query($date)or die(mysql_error());
    

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,224
    PHP Code:
    $out = array();
    foreach(
    $_POST['place'] as $place){
        
    $out[] = "'".mysql_real_escape_string($place)."'");
    }
    $imploded implode(', '$out);
    echo 
    $imploded;  
    $date "SELECT date FROM activities WHERE place IN ($imploded)"
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Mar 2008
    Posts
    88
    Great thank you. Learnt something there!! Now to tackle the next part lol

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles