RE: [PHP-DB] Re: Problem with query
Yeah, Jim, please explain what u mean by Per the manual, associative arrays using string indices should always use ' ' around them. They work (as mentioned in the manual) but are wrong. As long as I remember I could use associative arrays in that way (ex. $_SESSION['Cust_Num']). There's another way to do that using string indices? Why do you say it's wrong? It's obsolete? I would like to make a call to all the members of this mailing list: knowledge is a wonderful gift so, why we don't share it politely and efficiency. Jim, I will take you as an example. You start saying Against my better judgement, here I go again. If it's against your better judgment please don't go anywhere, your conscience is a good adviser. After that you talked a little about standards and some manual. If you are not happy to help people who make some mistakes regarding to programming standards, you should inform them where they can find the glorious manual and what is the correct syntax to do what people need to do. This is a better way to show to others what you know in a humble way but I suppose that wasn't what you were trying to do. I consider this list is to HELP others and share what we know. Never break the silence if it's not to make it better. Ethan, I will check your problem and I'll write you back as soon as I can 'cause right now I don't have anything installed in my computer. I'll try to do it tomorrow, ok? Be nice and stay well!!! Osain. -Mensaje original- De: Ethan Rosenberg, PhD [mailto:erosenb...@hygeiabiomedical.com] Enviado el: domingo, junio 23, 2013 4:38 PM Para: php-db@lists.php.net; Jim Giner Asunto: [PHP-DB] Re: Problem with query On 6/23/2013 2:31 PM, Ethan Rosenberg, PhD wrote: Dear List - There is an error in my query, and I cannot find it. This fails: $_SESSION['Cust_Num'] = $_REQUEST['cnum']; $_SESSION['CustNum'] = $_REQUEST['cnum']; echo sessionbr /; //this has the proper values print_r($_SESSION); $sql10 = select Balance, Payments, Charges, Date from Charges where Cust_Num = $_SESSION[Cust_Num] order by Date; echo $sql10; //echos the correct query $result10 = mysqli_query($cxn, $sql10); var_dump($result1); // this returns NULL Against my better judgement, here I go again. Is this the actual code you executed, or is it once again a typeover? Your 1st error is in these two lines: $result10 = mysqli_query($cxn, $sql10); var_dump($result1); // this returns NULL Yes your dump returns null. And always will. Any further errors might be related to your non-standard syntax for the session variable. Per the manual, associative arrays using string indices should always use ' ' around them. They work (as mentioned in the manual) but are wrong. === Jim - Is this the actual code you executed, or is it once again a typeover? The actual code Any further errors might be related to your non-standard syntax for the session variable. Per the manual, associative arrays using string indices should always use ' ' around them. They work (as mentioned in the manual) but are wrong. Newbie is confused. Please explain. TIA Ethan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Este mensaje le ha llegado mediante el servicio de correo electronico que ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema Nacional de Salud. La persona que envia este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas Infomed: http://www.sld.cu/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Problem with query
What Jim means is here in the manual: http://www.php.net/manual/en/language.types.array.php#language.types.array.donts In a nutshell: Always use quotes around a string literal array index. For example, /$foo['bar']/ is correct, while /$foo[bar]/ is not. The reason is that without the quotes, you are generating an undefined constant (bar) rather than using a string index ('bar'). It works, but could have side effects in the future, so it's bad form to do it. As for general politeness, you seem to be unaware of recent history in this (an associated) groups. The OP has often committed the ultimate sine. Not posting slightly wild code (we've all been/are there!) He doesn't seem to listen or learn too well. Many posters (including Jim) have offered a lot of of extremely good (and detailed) advice which seems to be rarely taken... Toby On 6/25/2013 7:32 AM, OJFR wrote: Yeah, Jim, please explain what u mean by Per the manual, associative arrays using string indices should always use ' ' around them. They work (as mentioned in the manual) but are wrong. As long as I remember I could use associative arrays in that way (ex. $_SESSION['Cust_Num']). There's another way to do that using string indices? Why do you say it's wrong? It's obsolete? I would like to make a call to all the members of this mailing list: knowledge is a wonderful gift so, why we don't share it politely and efficiency. Jim, I will take you as an example. You start saying Against my better judgement, here I go again.
Re: [PHP-DB] Re: Problem with query
I'm sorry I've not been following the last three responses. In a nutshell, what EXACTLY does the poster of this issue want? On 25 June 2013 11:06, Toby Hart Dyke t...@hartdyke.com wrote: What Jim means is here in the manual: http://www.php.net/manual/en/**language.types.array.php#** language.types.array.dontshttp://www.php.net/manual/en/language.types.array.php#language.types.array.donts In a nutshell: Always use quotes around a string literal array index. For example, /$foo['bar']/ is correct, while /$foo[bar]/ is not. The reason is that without the quotes, you are generating an undefined constant (bar) rather than using a string index ('bar'). It works, but could have side effects in the future, so it's bad form to do it. As for general politeness, you seem to be unaware of recent history in this (an associated) groups. The OP has often committed the ultimate sine. Not posting slightly wild code (we've all been/are there!) He doesn't seem to listen or learn too well. Many posters (including Jim) have offered a lot of of extremely good (and detailed) advice which seems to be rarely taken... Toby On 6/25/2013 7:32 AM, OJFR wrote: Yeah, Jim, please explain what u mean by Per the manual, associative arrays using string indices should always use ' ' around them. They work (as mentioned in the manual) but are wrong. As long as I remember I could use associative arrays in that way (ex. $_SESSION['Cust_Num']). There's another way to do that using string indices? Why do you say it's wrong? It's obsolete? I would like to make a call to all the members of this mailing list: knowledge is a wonderful gift so, why we don't share it politely and efficiency. Jim, I will take you as an example. You start saying Against my better judgement, here I go again.
Re: [PHP-DB] Re: Problem with query
On 6/25/2013 6:06 AM, Toby Hart Dyke wrote: What Jim means is here in the manual: http://www.php.net/manual/en/language.types.array.php#language.types.array.donts In a nutshell: Always use quotes around a string literal array index. For example, /$foo['bar']/ is correct, while /$foo[bar]/ is not. The reason is that without the quotes, you are generating an undefined constant (bar) rather than using a string index ('bar'). It works, but could have side effects in the future, so it's bad form to do it. As for general politeness, you seem to be unaware of recent history in this (an associated) groups. The OP has often committed the ultimate sine. Not posting slightly wild code (we've all been/are there!) He doesn't seem to listen or learn too well. Many posters (including Jim) have offered a lot of of extremely good (and detailed) advice which seems to be rarely taken... Toby On 6/25/2013 7:32 AM, OJFR wrote: Yeah, Jim, please explain what u mean by Per the manual, associative arrays using string indices should always use ' ' around them. They work (as mentioned in the manual) but are wrong. As long as I remember I could use associative arrays in that way (ex. $_SESSION['Cust_Num']). There's another way to do that using string indices? Why do you say it's wrong? It's obsolete? I would like to make a call to all the members of this mailing list: knowledge is a wonderful gift so, why we don't share it politely and efficiency. Jim, I will take you as an example. You start saying Against my better judgement, here I go again. My humble thanks for your timely support. :) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Problem with query
The original post is here: http://news.php.net/php.db/48751 On 6/25/2013 1:02 PM, Michael Oki wrote: I'm sorry I've not been following the last three responses. In a nutshell, what EXACTLY does the poster of this issue want? On 25 June 2013 11:06, Toby Hart Dyke t...@hartdyke.com wrote: What Jim means is here in the manual: http://www.php.net/manual/en/**language.types.array.php#** language.types.array.dontshttp://www.php.net/manual/en/language.types.array.php#language.types.array.donts In a nutshell: Always use quotes around a string literal array index. For example, /$foo['bar']/ is correct, while /$foo[bar]/ is not. The reason is that without the quotes, you are generating an undefined constant (bar) rather than using a string index ('bar'). It works, but could have side effects in the future, so it's bad form to do it. As for general politeness, you seem to be unaware of recent history in this (an associated) groups. The OP has often committed the ultimate sine. Not posting slightly wild code (we've all been/are there!) He doesn't seem to listen or learn too well. Many posters (including Jim) have offered a lot of of extremely good (and detailed) advice which seems to be rarely taken... Toby On 6/25/2013 7:32 AM, OJFR wrote: Yeah, Jim, please explain what u mean by Per the manual, associative arrays using string indices should always use ' ' around them. They work (as mentioned in the manual) but are wrong. As long as I remember I could use associative arrays in that way (ex. $_SESSION['Cust_Num']). There's another way to do that using string indices? Why do you say it's wrong? It's obsolete? I would like to make a call to all the members of this mailing list: knowledge is a wonderful gift so, why we don't share it politely and efficiency. Jim, I will take you as an example. You start saying Against my better judgement, here I go again. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Problem with query
On 6/25/2013 2:32 AM, OJFR wrote: Yeah, Jim, please explain what u mean by Per the manual, associative arrays using string indices should always use ' ' around them. They work (as mentioned in the manual) but are wrong. As long as I remember I could use associative arrays in that way (ex. $_SESSION['Cust_Num']). There's another way to do that using string indices? Why do you say it's wrong? It's obsolete? If YOU had taken the time to check the manual as I DID, you would not have blown your top at me. When I said 'per the manual', I meant it. It was not something I made up to taunt Ethan with - it was from the place all of us here quote on a regular basis. Apology accepted. And if you were a regular participant in this helpful forum, you would know of my attitude when dealing with Mr. Rosenberg, PhD. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Problem with query
On 23 June 2013 21:37, Ethan Rosenberg, PhD erosenb...@hygeiabiomedical.com wrote: On 6/23/2013 2:31 PM, Ethan Rosenberg, PhD wrote: Dear List - There is an error in my query, and I cannot find it. This fails: $_SESSION['Cust_Num'] = $_REQUEST['cnum']; $_SESSION['CustNum'] = $_REQUEST['cnum']; echo sessionbr /; //this has the proper values print_r($_SESSION); $sql10 = select Balance, Payments, Charges, Date from Charges where Cust_Num = $_SESSION[Cust_Num] order by Date; echo $sql10; //echos the correct query $result10 = mysqli_query($cxn, $sql10); var_dump($result1); // this returns NULL Against my better judgement, here I go again. Is this the actual code you executed, or is it once again a typeover? Your 1st error is in these two lines: $result10 = mysqli_query($cxn, $sql10); var_dump($result1); // this returns NULL Yes your dump returns null. And always will. Any further errors might be related to your non-standard syntax for the session variable. Per the manual, associative arrays using string indices should always use ' ' around them. They work (as mentioned in the manual) but are wrong. === Jim - Is this the actual code you executed, or is it once again a typeover? The actual code Any further errors might be related to your non-standard syntax for the session variable. Per the manual, associative arrays using string indices should always use ' ' around them. They work (as mentioned in the manual) but are wrong. Newbie is confused. Please explain. Try ... $sql10 = select Balance, Payments, Charges, Date from Charges where Cust_Num = {$_SESSION['Cust_Num']} order by Date; -- Richard Quadling Twitter : @RQuadling EE : http://e-e.com/M_248814.html Zend : http://bit.ly/9O8vFY