Jump to content

niche

Members
  • Content count

    3,391
  • Joined

  • Last visited

Community Reputation

129 Excellent

About niche

  • Rank
    Devoted Member
  • Birthday 01/01/1958

Profile Information

  • Location
    Lincoln, Nebraska, USA
  • Interests
    coding, inventing, selling, building large scale models, sci fi

Previous Fields

  • Languages
    php, mysql, html, css, javascript

Recent Profile Visitors

53,079 profile views
  1. niche

    PDO binding for a MYSQL LIKE

    Voila! Thanks for your help.
  2. niche

    PDO binding for a MYSQL LIKE

    Interesting. When I strip-out all the white space it works: $stmt2->execute(array(':itemandsize' => '%' . $var . '%')); I've heard of white space being a problem, but haven't knowingly experienced it. Any thoughts? Urban legend?
  3. niche

    PDO binding for a MYSQL LIKE

    This code works, but can someone tell me how I can use an array instead of bindParam in this situation. try { $sql = ' SELECT * FROM nconnectz WHERE itemandsize LIKE :itemandsize AND price > 0 ORDER BY price ASC '; $stmt2 = $db2->prepare($sql); } catch (PDOException $e) { echo $e->getMessage() . '<br>'; } $var = "%Flour%"; try { $stmt2->bindParam(':itemandsize',$var); $stmt2->execute(); } catch (PDOException $e) { echo $e->getMessage() . '<br>'; } Something like? $stmt2->execute(array( :itemandsize => '%Flour%' ));
  4. niche

    using dynamically named array inside foreach loop

    http://php.net/manual/en/language.variables.variable.php (3rd example).
  5. niche

    using dynamically named array inside foreach loop

    found the notation: ${$wkvar}[$i] = $val; If this has a name, pls let me know so I can get a ref? stumbled on to by finally googling: "dynamic naming arrays php"
  6. This works: $names = array( array("name"=>"tom","gender"=>"m"), array("name"=>"jane","gender"=>"f"), array("name"=>"steve","gender"=>"m"), array("name"=>"mary","gender"=>"f"), array("name"=>"renae","gender"=>"f") ); $num = 30; $wkvar = 'wk' . $num; foreach ($names AS $val) { $wk30[] = $val; //$$wkvar[] = $val; } var_dump($wk30); this doesn’t and gives me this error, “Fatal error: Cannot use [] for reading”, (goggle hasn’t helped me): $names = array( array("name"=>"tom","gender"=>"m"), array("name"=>"jane","gender"=>"f"), array("name"=>"steve","gender"=>"m"), array("name"=>"mary","gender"=>"f"), array("name"=>"renae","gender"=>"f") ); $num = 30; $wkvar = 'wk' . $num; foreach ($names AS $val) { //$wk30[] = $val; $$wkvar[] = $val; } var_dump($wk30); I need to use the 2nd (variable variable) approach. What am I doing wrong? I tried adding a dynamic index unsuccessfully.
  7. niche

    Combining Select Queries

    My understanding is # is for comments
  8. niche

    Combining Select Queries

    https://www.w3schools.com/sql/sql_insert_into_select.asp
  9. niche

    Insert contact Page PHP file in html.

    where do define $from?
  10. niche

    Insert contact Page PHP file in html.

    What's in $_POST['Message']?
  11. niche

    Combining Select Queries

    Sounds like you want something like this: https://stackoverflow.com/questions/14907863/insert-data-from-one-table-to-another-in-mysql
  12. niche

    Insert contact Page PHP file in html.

    For starters, is the action really named index.php?
  13. niche

    Introduce Yourself

    Look forward to your questions!
  14. niche

    insert csv into mysql problem

    this might help https://stackoverflow.com/questions/18342730/import-csv-file-with-php-using-pdo
  15. niche

    insert csv into mysql problem

    Great point!
×