Jump to content

niche

Members
  • Content count

    3,388
  • Joined

  • Last visited

Everything posted by niche

  1. 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.
  2. niche

    using dynamically named array inside foreach loop

    http://php.net/manual/en/language.variables.variable.php (3rd example).
  3. 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"
  4. niche

    Combining Select Queries

    My understanding is # is for comments
  5. niche

    Combining Select Queries

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

    Insert contact Page PHP file in html.

    where do define $from?
  7. niche

    Insert contact Page PHP file in html.

    What's in $_POST['Message']?
  8. 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
  9. niche

    Insert contact Page PHP file in html.

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

    Introduce Yourself

    Look forward to your questions!
  11. niche

    insert csv into mysql problem

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

    insert csv into mysql problem

    Great point!
  13. niche

    insert csv into mysql problem

    Why not use LOAD DATA?
  14. https://www.w3schools.com/sql/sql_alter.asp Then, use the CONCAT_WS keyword
  15. niche

    registry backup

    Experience tells me that If i'm thinking about restoring the registry, I'm probably going to get unexpected consequences. So, I'll probably just reinstall the system and get a good night's sleep. Having the backup is one thing. Using it is another.
  16. niche

    registry backup

    I agree that it's a bad idea. EDIT: I would opt for a fresh install.
  17. https://www.w3schools.com/cssref/pr_background-color.asp
  18. niche

    php put inside css file security

    this might help https://css-tricks.com/css-variables-with-php/
  19. niche

    Dropping a table

    Do a 'SELECT * FROM closed' . If no error, it's still there unless corrupted. closed is not a reserved word, but close is.
  20. niche

    php put inside css file security

    More context please
  21. niche

    How to mark visited images

    Not with CSS. I'd redesign the image with divs positioned around the image , with each div having a JS listener, in place of the finger points.
  22. niche

    sqlite startup

    You also can use python to display the results from your queries.
  23. niche

    Not exists with concatenated columns

    Voila ! SELECT nconnectz.itemandsize, nconnectz.pkg_quantity FROM nconnectz WHERE NOT EXISTS ( SELECT * FROM itemandsize WHERE CONCAT_WS(',', nconnectz.itemandsize, nconnectz.pkg_quantity) = CONCAT_WS(',', itemandsize.itemandsize, '0.00') )
  24. This code works with cols that are not concatenated: SELECT item3 FROM nconnectz t1 WHERE NOT EXISTS ( SELECT item3 FROM itemandsize t2 WHERE t1.item3 = t2.item3 ) GROUP BY item3 I think this is the same query with concatenated columns SELECT CONCAT_WS(',', itemandsize, pkg_quantity) item4 FROM nconnectz t1 WHERE NOT EXISTS ( SELECT CONCAT_WS(',', itemandsize, '0.00') item4 FROM itemandsize t2 WHERE t1.item4 = t2.item4 ) GROUP BY item4 the error is: Unknown column 't1.item4' in 'where clause' what's causing the error?
  25. niche

    JOINing a variable

    Anyone have a reference for how JOINing a variable works? As in: UPDATE nconnectz.test JOIN (SELECT @rank := 20) r SET route = @rank := @rank + 1
×