Re: [PHP-DB] use php variable within postgresql query

2023-06-12 Thread Karl DeSaulniers
Oh I see now I am late to the conversation. Slow email load. Carry on.

> On Jun 12, 2023, at 1:42 PM, Karl DeSaulniers  wrote:
> 
> Hi,
> I am assuming this is just a typo in your post and not your code, correct? 
> (see quoted text below)
> If not, then try the other bracket?
> 
> $query=$_GET['databasecolumn'];
> 
> 
>> On Jun 9, 2023, at 4:05 AM, e-letter  wrote:
>> 
>> $query=$_GET['databasecolumn'[;
> 

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] use php variable within postgresql query

2023-06-12 Thread Karl DeSaulniers
Hi,
I am assuming this is just a typo in your post and not your code, correct? (see 
quoted text below)
If not, then try the other bracket?

$query=$_GET['databasecolumn'];


> On Jun 9, 2023, at 4:05 AM, e-letter  wrote:
> 
> $query=$_GET['databasecolumn'[;



Re: [PHP-DB] Realtime connection to postgres database

2020-11-09 Thread Karl DeSaulniers
Is this what you are looking for?

https://www.postgresql.org/docs/9.6/monitoring-stats.html 
<https://www.postgresql.org/docs/9.6/monitoring-stats.html>

or maybe this?

https://github.com/supabase/realtime <https://github.com/supabase/realtime>


Google Foo:  real-time connection to postgresql database (v9.6)

HTH,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com <http://designdrumm.com/>




> On Nov 9, 2020, at 11:41 PM, Rodrigo Sánchez  wrote:
> 
> connected to  postgresql
> database (v9.6)



Re: [PHP-DB] Realtime connection to postgres database

2020-10-26 Thread Karl DeSaulniers
Sounds like a good cron job candidate. 

Best,
Karl

Sent from losPhone

> On Oct 25, 2020, at 4:43 PM, Aziz Saleh  wrote:
> 
> Another way to do this is to have an ajax call on timeout to an update
> endpoint, if there is an update inject that update on the page (or refresh
> it).
> 
> Some js examples (both short/long polling):
> 
> https://stackoverflow.com/questions/42825972/update-html-when-change-is-noticed-in-mysql-database
> https://stackoverflow.com/questions/22577457/update-data-on-a-page-without-refreshing
> https://stackoverflow.com/questions/8100594/refresh-content-automatically-if-the-database-changes
> 
> 
>> On Sun, Oct 25, 2020 at 5:18 PM Rodrigo Sánchez 
>> wrote:
>> 
>> Hi everyone,
>> 
>>  I made a table in html that reads a table from a postgres database
>> (easy part).  The postgres database grows every time an earthquake
>> occurs. What is the best way to keep the table updated automatically,
>> each time a new earthquake is added to the database? (I mean, not having
>> to update by clicking on the browser). The ugly way to do it is by using
>> something like header ("refresh: 3"); for example ... but isn't there
>> something better?
>> 
>>  Excuse the question if it is very obvious, but I am not a "full" time
>> php programmer.
>> 
>>  (PHP 7.4.11, postgresql 9.6.19)
>> 
>> 
>> --
>> 
>>  Rodrigo Sánchez-Olavarría
>>  CSN, Centro Sismologico Nacional
>>  Universidad de Chile
>>  Celular : +56 9 42137243
>> 
>> 
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
>> 

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] MySQL connection

2017-03-05 Thread Karl DeSaulniers
That makes complete sense. 
Thank you Joshua.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com




> On Mar 5, 2017, at 6:44 PM, Arneson, Joshua  wrote:
> 
> If you have multiple calls to the database that are grouped, definitely 
> perform them during the same connection session. The bottom line is unless 
> the overhead associated with opening and closing the connection is going to 
> be an issue programmatically, keep connections brief and group your 
> transactions where possible. A good example would be you have a group of 
> calls (A, B, C) that need to happen. Calls A and B can run one after the 
> other, but C has to wait on a user input (no matter how small/simple), you 
> should open the connection, run calls A and B, close the connection waiting 
> on user input, then reopen, run call C, then close the connection. A good 
> exception to this rule would be if you have calls that have to run every 'x' 
> milliseconds and you anticipate that you MIGHT at ANY point run into 
> concurrency issues, you would hold a single open connection for that specific 
> case and adhere to the 'open'-'run calls'-'close' standard for all other 
> cases. Remember, we rarely know what new tasks our programs will be doing in 
> the future so building for scalability is always a good bet. 
> 
> Respectfully,
> 
> Joshua D. Arneson
> Data Manager, Mount Sinai NIH Brain & Tissue Repository (NBTR)
> 130 W Kingsbridge Rd, Rm 5F-04
> Bronx, NY 10468
> Email: joshua.arne...@mssm.edu
> Office: 718-584-9000 ext 6094
> Mobile: 347-915-8911
> Fax: 718-741-4746
> 
>> On Mar 5, 2017, at 7:29 PM, Karl DeSaulniers  wrote:
>> 
>> Ah, thanks for the reply Joshua.
>> 
>> Duly noted. So when is it bad to make multiple open and close connections 
>> then?
>> I am guessing that could have some impact with lots of users too. Yes?
>> 
>> If the website in question does not have a lot of users (less than 1,000), 
>> is this still a bad call to keep an open connection?
>> If so, should I be closing the connection after each page load that has 
>> multiple calls on the database?
>> Or after each call to the database? 
>> 
>> I am wanting to make sure I am not doing something bad or dangerous when 
>> holding these sessions open.
>> If it is a matter of taste, I'll leave it, but if it is a matter of best 
>> practices to open and close, I will change the method I am using.
>> 
>> Again, TIA!
>> 
>> Best,
>> 
>> Karl DeSaulniers
>> Design Drumm
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__designdrumm.com&d=DwIFAg&c=shNJtf5dKgNcPZ6Yh64b-A&r=HSbgyt8GFSyWQ53Nxworjip-dgIKnMlPBkQ0VGj7tYk&m=w7VxdOhlxCY27A_sfaFCxntsWMG8ZDA3nukN6fBstsA&s=JzvStr8fa_OyNaHOUe0Xp8_o6aDzZSgZ6OXyEk6WyIM&e=
>> 
>> 
>> 
>> 
>>> On Mar 5, 2017, at 6:19 PM, Arneson, Joshua  wrote:
>>> 
>>> Right off the bat, you need to consider concurrency issues. Depending on 
>>> the size of your user base and level of activity this could become a major 
>>> issue. In the end, why hold an open connection for 15 minutes just to 
>>> process 20-30 transactions that take 20-30ms each? Just better (under most 
>>> circumstances) to open the connection, process your transaction , then 
>>> close the connection. 
>>> 
>>> Respectfully,
>>> 
>>> Joshua D. Arneson
>>> Data Manager, Mount Sinai NIH Brain & Tissue Repository (NBTR)
>>> 130 W Kingsbridge Rd, Rm 5F-04
>>> Bronx, NY 10468
>>> Email: joshua.arne...@mssm.edu
>>> Office: 718-584-9000 ext 6094
>>> Mobile: 347-915-8911
>>> Fax: 718-741-4746
>>> 
>>>> On Mar 5, 2017, at 6:54 PM, Karl DeSaulniers  wrote:
>>>> 
>>>> Hello everyone,
>>>> Long time. Hope all are well.
>>>> 
>>>> Quick question. How should MySQL connections be treated?
>>>> Is it ok to leave them open or is it better to close them after 
>>>> transactions?
>>>> I have a website that uses sessions and was wondering if there was any 
>>>> situations where I should be closing the connection.
>>>> Either for performance reasons or security or best practices. 
>>>> 
>>>> Just wondering your professional.
>>>> 
>>>> TIA
>>>> 
>>>> Best,
>>>> 
>>>> Karl DeSaulniers
>>>> Design Drumm
>>>> https://urldefense.proofpoint.com/v2/url?u=http-3A__designdrumm.com&d=DwIFAg&c=shNJtf5dKgNcPZ6Yh64b-A&r=HS

Re: [PHP-DB] MySQL connection

2017-03-05 Thread Karl DeSaulniers
Ah, thanks for the reply Joshua.

Duly noted. So when is it bad to make multiple open and close connections then?
I am guessing that could have some impact with lots of users too. Yes?

If the website in question does not have a lot of users (less than 1,000), is 
this still a bad call to keep an open connection?
If so, should I be closing the connection after each page load that has 
multiple calls on the database?
Or after each call to the database? 

I am wanting to make sure I am not doing something bad or dangerous when 
holding these sessions open.
If it is a matter of taste, I'll leave it, but if it is a matter of best 
practices to open and close, I will change the method I am using.

Again, TIA!

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com




> On Mar 5, 2017, at 6:19 PM, Arneson, Joshua  wrote:
> 
> Right off the bat, you need to consider concurrency issues. Depending on the 
> size of your user base and level of activity this could become a major issue. 
> In the end, why hold an open connection for 15 minutes just to process 20-30 
> transactions that take 20-30ms each? Just better (under most circumstances) 
> to open the connection, process your transaction , then close the connection. 
> 
> Respectfully,
> 
> Joshua D. Arneson
> Data Manager, Mount Sinai NIH Brain & Tissue Repository (NBTR)
> 130 W Kingsbridge Rd, Rm 5F-04
> Bronx, NY 10468
> Email: joshua.arne...@mssm.edu
> Office: 718-584-9000 ext 6094
> Mobile: 347-915-8911
> Fax: 718-741-4746
> 
>> On Mar 5, 2017, at 6:54 PM, Karl DeSaulniers  wrote:
>> 
>> Hello everyone,
>> Long time. Hope all are well.
>> 
>> Quick question. How should MySQL connections be treated?
>> Is it ok to leave them open or is it better to close them after transactions?
>> I have a website that uses sessions and was wondering if there was any 
>> situations where I should be closing the connection.
>> Either for performance reasons or security or best practices. 
>> 
>> Just wondering your professional.
>> 
>> TIA
>> 
>> Best,
>> 
>> Karl DeSaulniers
>> Design Drumm
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__designdrumm.com&d=DwIFAg&c=shNJtf5dKgNcPZ6Yh64b-A&r=HSbgyt8GFSyWQ53Nxworjip-dgIKnMlPBkQ0VGj7tYk&m=09oI7Bn2rpePGXSl8CmHMTUqhm3Rjh676OnMYed0L_4&s=JBoK9bslzQegAxQDG_NbsuvcCBLw5_LIQkjMpEj4kE8&e=
>>  
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__designdrumm.com_&d=DwIFAg&c=shNJtf5dKgNcPZ6Yh64b-A&r=HSbgyt8GFSyWQ53Nxworjip-dgIKnMlPBkQ0VGj7tYk&m=09oI7Bn2rpePGXSl8CmHMTUqhm3Rjh676OnMYed0L_4&s=u_sgRk_DWdl5PZZinSHklw5DuV7oz5cv7MWZCJDsJzA&e=
>>  >
>> 
>> 
>> 
>> 
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] MySQL connection

2017-03-05 Thread Karl DeSaulniers
Hello everyone,
Long time. Hope all are well.

Quick question. How should MySQL connections be treated?
Is it ok to leave them open or is it better to close them after transactions?
I have a website that uses sessions and was wondering if there was any 
situations where I should be closing the connection.
Either for performance reasons or security or best practices. 

Just wondering your professional.

TIA

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com <http://designdrumm.com/>






Re: [PHP-DB] Any method to get primary key matching a given value ?

2016-10-10 Thread Karl DeSaulniers
You may be correct. Admittedly, I am stabbing in the dark here. I work on 
MySQL, not SQLite.
Just good at key word searches. :)  This link seems to be promising.

http://www.sqlite.org/c3ref/table_column_metadata.html

Sorry I can't help more.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com




> On Oct 10, 2016, at 7:48 PM, Ratin  wrote:
> 
> Hi Karl, Isnt it the same ? I am doing the check  if ($result['pk'] == 1),
> and you are doing  if ($result['pk'] !== null). I wanted to make sure I
> dont get false positives, what if $result['pk'] is set to zero, in your
> case it will be a match but thats probably not what we want, cuz the pk
> field is not set to 1..
> 
> Regards,
> Ratin
> 
> 
> On Mon, Oct 10, 2016 at 5:38 PM, Karl DeSaulniers 
> wrote:
> 
>> Hi Ratin,
>> I "think" you can just do this and not have to store the table name.
>> However, I have no way of testing this. You will have to test on your end.
>> 
>> while ($result = $query->fetchArray()) {
>>if ($result['pk'] !== null) {
>>$primary_key=$result['pk'];
>>}
>> }
>> 
>> Best,
>> 
>> Karl DeSaulniers
>> Design Drumm
>> http://designdrumm.com <http://designdrumm.com/>
>> 
>> 
>> 
>> 
>>> On Oct 10, 2016, at 7:12 PM, Ratin  wrote:
>>> 
>>> Sorry about my late reply but this was my function - a bit of a hack but
>> works properly on my version of php-sqlite3:
>>> 
>>> 
>>>  function get_primary_key_name($table)
>>>  {
>>>   $primary_key='';
>>>   $db = new MyDB();
>>>   if(!$db)
>>>   {
>>>   echo $db->lastErrorMsg();
>>>   }
>>>   else
>>>   {
>>>   $qstr = "PRAGMA table_info(" . $table . ");" ;
>>>       $query = $db->query($qstr);
>>>   while ($result = $query->fetchArray())
>>>   {
>>>  if ($result['pk'] == 1)
>>>  {
>>>$primary_key=$result['name'];
>>>   }
>>>}
>>>   }
>>>   $db->close();
>>>   return $primary_key;
>>>   }
>>> 
>>> 
>>> On Sat, Aug 20, 2016 at 3:35 AM, Karl DeSaulniers > <mailto:k...@designdrumm.com>> wrote:
>>> This may also shed some light for you.
>>> The accepted answer and possibly the one below it if you are on .NET
>>> 
>>> http://stackoverflow.com/questions/763516/information-
>> schema-columns-on-sqlite <http://stackoverflow.com/
>> questions/763516/information-schema-columns-on-sqlite>
>>> 
>>> HTH,
>>> 
>>> Best,
>>> 
>>> Karl DeSaulniers
>>> Design Drumm
>>> http://designdrumm.com <http://designdrumm.com/>
>>> 
>>> 
>>> 
>>> 
>>>> On Aug 20, 2016, at 5:30 AM, Karl DeSaulniers > <mailto:k...@designdrumm.com>> wrote:
>>>> 
>>>> Hey Ratin,
>>>> Have you looked into the table column named 'pk' inside table_info?
>>>> That is where a column is indicated to be a primary key or not.
>>>> 
>>>> Best,
>>>> 
>>>> Karl DeSaulniers
>>>> Design Drumm
>>>> http://designdrumm.com <http://designdrumm.com/> <
>> http://designdrumm.com/ <http://designdrumm.com/>>
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> On Aug 18, 2016, at 6:51 PM, Ratin > rat...@gmail.com>> wrote:
>>>>> 
>>>>> Hi Karl, Thanks a lot for your response, I think  INFORMATION_SCHEMA
>> is not available for sqlite database. I had to built up the whole query
>> with php using PRAGMA table_info(tablename), looking at the pk entry, when
>> its 1, get the column name, and then update the sql statement based on
>> that. A bit of work, wouldve been much simpler if a method was provided,
>> but oh well ..
>>>>> 
>>>>> Thanks again
>>>>> 
>>>>> Ratin
>>>>> 
>>>>> On Thu, Aug 18, 2016 at 2:53 PM, Karl DeSaulniers <
>> k...@designdrumm.com <mailto:k...@designdrumm.com> > k...@designdrumm.com <mailto:k...@designdrumm.com>>> wrote:
>>>&

Re: [PHP-DB] Any method to get primary key matching a given value ?

2016-10-10 Thread Karl DeSaulniers
Hi Ratin,
I "think" you can just do this and not have to store the table name.
However, I have no way of testing this. You will have to test on your end. 

while ($result = $query->fetchArray()) {
if ($result['pk'] !== null) {
$primary_key=$result['pk'];
    }
}

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com <http://designdrumm.com/>




> On Oct 10, 2016, at 7:12 PM, Ratin  wrote:
> 
> Sorry about my late reply but this was my function - a bit of a hack but 
> works properly on my version of php-sqlite3:
> 
>  
>   function get_primary_key_name($table)
>   {
>$primary_key='';
>$db = new MyDB();
>if(!$db)
>{
>echo $db->lastErrorMsg();
>}
>else
>{
>$qstr = "PRAGMA table_info(" . $table . ");" ;
>$query = $db->query($qstr);
>while ($result = $query->fetchArray())
>{
>   if ($result['pk'] == 1)
>   {
> $primary_key=$result['name'];
>    }
> }
>}
>$db->close();
>return $primary_key;
>}
> 
> 
> On Sat, Aug 20, 2016 at 3:35 AM, Karl DeSaulniers  <mailto:k...@designdrumm.com>> wrote:
> This may also shed some light for you.
> The accepted answer and possibly the one below it if you are on .NET
> 
> http://stackoverflow.com/questions/763516/information-schema-columns-on-sqlite
>  
> <http://stackoverflow.com/questions/763516/information-schema-columns-on-sqlite>
> 
> HTH,
> 
> Best,
> 
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com <http://designdrumm.com/>
> 
> 
> 
> 
> > On Aug 20, 2016, at 5:30 AM, Karl DeSaulniers  > <mailto:k...@designdrumm.com>> wrote:
> >
> > Hey Ratin,
> > Have you looked into the table column named 'pk' inside table_info?
> > That is where a column is indicated to be a primary key or not.
> >
> > Best,
> >
> > Karl DeSaulniers
> > Design Drumm
> > http://designdrumm.com <http://designdrumm.com/> <http://designdrumm.com/ 
> > <http://designdrumm.com/>>
> >
> >
> >
> >
> >> On Aug 18, 2016, at 6:51 PM, Ratin  >> <mailto:rat...@gmail.com>> wrote:
> >>
> >> Hi Karl, Thanks a lot for your response, I think  INFORMATION_SCHEMA is 
> >> not available for sqlite database. I had to built up the whole query with 
> >> php using PRAGMA table_info(tablename), looking at the pk entry, when its 
> >> 1, get the column name, and then update the sql statement based on that. A 
> >> bit of work, wouldve been much simpler if a method was provided, but oh 
> >> well ..
> >>
> >> Thanks again
> >>
> >> Ratin
> >>
> >> On Thu, Aug 18, 2016 at 2:53 PM, Karl DeSaulniers  >> <mailto:k...@designdrumm.com> <mailto:k...@designdrumm.com 
> >> <mailto:k...@designdrumm.com>>> wrote:
> >> Hi Ratin,
> >> Going to take a stab at this one.
> >> Have you looked into INFORMATION_SCHEMA.COLUMNS for your query?
> >> Might be where you want to look for what you are trying.
> >> Sorry can't help more.
> >>
> >> Best,
> >>
> >> Karl DeSaulniers
> >> Design Drumm
> >> http://designdrumm.com <http://designdrumm.com/> <http://designdrumm.com/ 
> >> <http://designdrumm.com/>>
> >>
> >>
> >>
> >>
> >>> On Aug 18, 2016, at 1:27 PM, Ratin  >>> <mailto:rat...@gmail.com> <mailto:rat...@gmail.com 
> >>> <mailto:rat...@gmail.com>>> wrote:
> >>>
> >>> I'm writing the generic get that works on different tables having 
> >>> different
> >>> primary keys but the argument of get is always the primary key , i.e. get
> >>> request is -
> >>>
> >>> get (column name, value)
> >>>
> >>> the value is always the primary key value.
> >>>
> >>> It looks like it would be a pretty standard method but I cant find a 
> >>> method
> >>> like that. Anybody have any clue?
> >>>
> >>> Thanks
> >>>
> >>> Ratin
> >>
> >>
> >> --
> >> PHP Database Mailing List (http://www.php.net/ <http://www.php.net/> 
> >> <http://www.php.net/ <http://www.php.net/>>)
> >> To unsubscribe, visit: http://www.php.net/unsub.php 
> >> <http://www.php.net/unsub.php> <http://www.php.net/unsub.php 
> >> <http://www.php.net/unsub.php>>
> >>
> >>
> >
> 
> 
> --
> PHP Database Mailing List (http://www.php.net/ <http://www.php.net/>)
> To unsubscribe, visit: http://www.php.net/unsub.php 
> <http://www.php.net/unsub.php>
> 
> 



Re: [PHP-DB] Corn job anomaly

2016-09-27 Thread Karl DeSaulniers
> On Sep 27, 2016, at 2:24 AM, Ford, Mike  wrote:
> 
>> -Original Message-----
>> From: Karl DeSaulniers [mailto:k...@designdrumm.com]
>> Sent: 25 September 2016 09:59
>> To: PHP List Database 
>> Subject: Re: [PHP-DB] Corn job anomaly
>> 
>> Now I am getting an error with mysql syntax.
>> 
>> "SELECT otn.*, cf.* FROM ".ORDER_TABLE." otn LEFT JOIN ".FIELDS_TABLE." cf
>> ON cf.Order_ID = otn.Order_ID WHERE cf.Earliest_Pickup >= DATE(NOW()) AND
>> cf.Earliest_Pickup <= DATE(NOW() + INTERVAL ".($Num_Days_Away+1)." DAY) AND
>> otn.Order_Status != 'Shipping' AND otn.Order_Status != 'Completed'"
>> 
>> is giving me this error:
>>  You have an error in your SQL syntax; check the manual that
>> corresponds to your MySQL server version for the right syntax to use near
>> '\"Shipping\" AND otn.Order_Status != \"Completed\"' at line 1
> 
> I don't think INTERVAL works like that - you probably need something like:
> 
>... cf.Earliest_Pickup <= DATE_ADD(CURDATE(), INTERVAL 
> ".($Num_Days_Away+1)." DAY) AND ...
> 
> Incidentally, as I understand it CURDATE() does exactly the same as 
> DATE(NOW()), and is probably more readable.
> 
> Cheers!
> 
> Mike
> 
> --
> Mike Ford,


Hi Mike,
I figured out what was wrong with my script on that error. 
I had mysqli_real_escape_string() wrapping the whole select statement. 
The INTERVAL part I got from PHP.net and it is working just fine. Just fyi.
Once I wrapped just ($Num_Days_Away+1) part it started working.

Thanks for responding!

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Corn job anomaly

2016-09-25 Thread Karl DeSaulniers
Oops. I actually ran it with single and double quotes and got the same error 
both times. I am using single quotes originally. 

I think the query is getting the \ (backslash) read literally. I did not add 
those manually. 

Best,
Karl

Sent from losPhone

> On Sep 25, 2016, at 9:17 AM, Richard 
>  wrote:
> 
> 
> 
>> Date: Sunday, September 25, 2016 08:37:14 -0400
>> From: Aziz Saleh 
>> Subject: Re: [PHP-DB] Corn job anomaly
>> 
>> On Sun, Sep 25, 2016 at 4:59 AM, Karl DeSaulniers
>>  wrote:
>> 
>>>> On Sep 23, 2016, at 5:38 AM, Richard wrote:
>>>> 
>>>> -- Try the mysql access and commands directly from the command
>>>>   line (using the mysql cli).
>>>> 
>>>> -- Put debug/print statements in your code so you can clearly
>>>>   see where you are getting.
>>>> 
>>>>   -- This includes printing out your mysql statements so that
>>>>  you know exactly what is being passed to mysql (both when
>>>>  you run the script by hand and via cron).
>>>> 
>>> 
>>> Thanks Richard,
>>> That got me thinking and I figured out my access issue...
>>> HALELUYA!
>>> 
>>> Now I am getting an error with mysql syntax.
>>> 
>>> "SELECT otn.*, cf.* FROM ".ORDER_TABLE." otn LEFT JOIN
>>> ".FIELDS_TABLE." cf ON cf.Order_ID = otn.Order_ID WHERE
>>> cf.Earliest_Pickup >= DATE(NOW()) AND cf.Earliest_Pickup <=
>>> DATE(NOW() + INTERVAL ".($Num_Days_Away+1)." DAY) AND
>>> otn.Order_Status != 'Shipping' AND otn.Order_Status != 'Completed'"
>>> 
>>> is giving me this error:
>>>You have an error in your SQL syntax; check the manual that
>>> corresponds to your MySQL server version for the right syntax to
>>> use near '\"Shipping\" AND otn.Order_Status != \"Completed\"' at
>>> line 1
>>> 
>>> 
>> 
>> Echo out the query, then manually run it.
>> 
> 
> Based on the quoting, it doesn't appear that the error you are
> reporting is actually based on the command syntax you are showing.
> 
> If after echoing your mysql query, so that you see all substitutions,
> you are still having trouble, then take your query apart and simplify
> it. When you get a trimmed down version to work, then add complexity.
> 
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Corn job anomaly

2016-09-25 Thread Karl DeSaulniers
> On Sep 23, 2016, at 5:38 AM, Richard 
>  wrote:
> 
> 
> 
>> Date: Friday, September 23, 2016 03:28:47 -0500
>> From: Karl DeSaulniers 
>> 
>> Ok, so I have run down all the possible things (that I know of)
>> that could be keeping this from working. I have checked with my
>> hosting service that:
>> 
>> 1. MySQL is accessible with the original user I started with (for
>> this case were using db123456) via ssh. 2. The cron is accessing my
>> php script fine.
>> 3. The cron is running the script and is attempting to access MySQL
>> but not allowing access still.
>> 
>> I tried running the script via ssh and it is timing out. No error
>> of not accessing MySQL, just telling me it is timing out.  This
>> tells me (I could be wrong) that it is in fact accessing MySQL and
>> that my calls to MySQL are making the script time out? What bothers
>> me is that the cron errors out saying access denied but ssh says
>> timeout error. Does anyone have any ideas for me to try at this
>> point? If I don't get this to work in the next couple of days, I am
>> toast!
>> 
> 
> -- Try the mysql access and commands directly from the command
>line (using the mysql cli).
> 
> -- Put debug/print statements in your code so you can clearly
>see where you are getting. 
> 
>-- This includes printing out your mysql statements so that
>   you know exactly what is being passed to mysql (both when
>   you run the script by hand and via cron).
> 

Thanks Richard,
That got me thinking and I figured out my access issue... HALELUYA!

Now I am getting an error with mysql syntax.

"SELECT otn.*, cf.* FROM ".ORDER_TABLE." otn LEFT JOIN ".FIELDS_TABLE." cf ON 
cf.Order_ID = otn.Order_ID WHERE cf.Earliest_Pickup >= DATE(NOW()) AND 
cf.Earliest_Pickup <= DATE(NOW() + INTERVAL ".($Num_Days_Away+1)." DAY) AND 
otn.Order_Status != 'Shipping' AND otn.Order_Status != 'Completed'"

is giving me this error:
You have an error in your SQL syntax; check the manual that corresponds 
to your MySQL server version for the right syntax to use near '\"Shipping\" AND 
otn.Order_Status != \"Completed\"' at line 1

I think at this point my brain is fried and I am not seeing what is wrong with 
this. 
Can anyone point out my folly? My guess is it is an obvious one, but I am not 
seeing it.

Thanks again for your help everyone. I think I am almost there!

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Corn job anomaly

2016-09-23 Thread Karl DeSaulniers
Ok, so I have run down all the possible things (that I know of) that could be 
keeping this from working.
I have checked with my hosting service that:

1. MySQL is accessible with the original user I started with (for this case 
were using db123456) via ssh.
2. The cron is accessing my php script fine.
3. The cron is running the script and is attempting to access MySQL but not 
allowing access still.

I tried running the script via ssh and it is timing out. No error of not 
accessing MySQL, just telling me it is timing out. 
This tells me (I could be wrong) that it is in fact accessing MySQL and that my 
calls to MySQL are making the script time out?
What bothers me is that the cron errors out saying access denied but ssh says 
timeout error.
Does anyone have any ideas for me to try at this point? If I don't get this to 
work in the next couple of days, I am toast!

TIA,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Corn job anomaly

2016-09-20 Thread Karl DeSaulniers

> On Sep 20, 2016, at 10:09 PM, Peter Beckman  wrote:
> 
> I suspect you are taking the pipe or semicolon literally.
> 
> Drop the pipe and semicolon entirely. This should work:
> 
>/usr/bin/php5 -c /home/123456/etc/php.ini -f 
> /home/123456/data/auto_reminder.php
> 
> The "pipe" (|) in unix (and I assume this is unix) means to pipe the output
> of php5 -c config to the command "-f /home...php". Which (-f) isn't a command.
> 
> The "semicolon" (;) in unix means "do this command first; then do this 
> command"
> so in your second part it is running /home/123456/data/auto_reminder.php 
> -udb123456  after it runs php5.
> 
> Usually php5 -c php.ini will run PHP in interactive mode, and sits and
> waits for input. When run from cron, there is no input, so it dies, unable
> to pipe the output (there is none) or just run the next command.
> 
> So -- lose the pipe, lose the semicolon, just run the command above in cron
> (and on the command line) and it should "just work."
> 
> Beckman
> 
> 


Hey thanks Peter for clearing that up. Yes, I was taking the pipe and semicolon 
literally.
I have since found this out on my own that my original code works. It is as 
Richard and Bert had said.
My cron runs under the server admin user and so I have to contact my client to 
find out what that password is or change it.

Much thanks to everyone for your time and responses with my issue. You guys are 
invaluable!

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Corn job anomaly

2016-09-20 Thread Karl DeSaulniers
Hi Richard & Bert,
Thanks for the responses. I think I understand what you are both saying. 

Not sure where my database is housed as I am using a hosting provider 
(Mediatemple)
and they allow limited access to such things or I am unaware how to access them.

For my current issue, lets just say my username is  db123456
db123456 is the root user who has access to all databases
However I am not sure if the cron job runs under this user.

This is the command line I have currently that is not working

/usr/bin/php5 -c /home/123456/etc/php.ini | -f 
/home/123456/data/auto_reminder.php

My hosting company says I can force my php.ini with -c |
but this errors out saying -f command can not be found.

I tried this:

/usr/bin/php5 -c /home/123456/etc/php.ini | /home/123456/data/auto_reminder.php

but then I get the same error I originally had saying php doesn't exist.
I tried a semicolon like I had seen on some message boards and the double &&
but still no dice.

I even tried to set the user in the args like so

/usr/bin/php5 -c /home/123456/etc/php.ini ; /home/123456/data/auto_reminder.php 
-udb123456

again, no dice.

@Bert  
I think it may be that the cron is under another user and that my original CL 
works, just not sure how to find out.
I would call my hosting provider to ask, but I always get the same response ... 

We don't troubleshoot peoples code it is out of our scope of support.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com




> On Sep 20, 2016, at 1:07 PM, Richard 
>  wrote:
> 
> 
> 
>  Original Message 
>> Date: Tuesday, September 20, 2016 12:54:38 -0500
>> From: Karl DeSaulniers 
>> 
>> On Sep 20, 2016, at 7:21 AM, Richard
>>  wrote:
>>> 
>>> 
>>> 
>>>> Date: Tuesday, September 20, 2016 03:26:39 -0500
>>>> From: Karl DeSaulniers 
>>>> 
>>>>> On Sep 20, 2016, at 3:22 AM, Lester Caine 
>>>>> wrote:
>>>>> 
>>>>>> On 20/09/16 09:14, Karl DeSaulniers wrote:
>>>>>> Pardon my ignorance, but what do you mean full path?
>>>>> Full path to php application.
>>>>> Cron jobs run as 'root' and so need and user account settings
>>>>> added manually if they do not match the 'root' environment.
>>>>> 
>>>> 
>>>> OH, ok, I did read something about root earlier.
>>>> I think it was something like:
>>>> 
>>>> root /usr/bin/php5 /home/(directory name
>>>> removed)/auto_reminder.php
>>>> 
>>>> But not positive. I will have to research that more.
>>>> Thank you.
>>>> 
>>>> 
>>> 
>>> Whether cron jobs run as root or a standard user depends on how
>>> they are set up. If set up under a user -- which is the better
>>> approach for general use -- they will run as that user. Really only
>>> system-type cron jobs (that require root access) should be set up
>>> to run as root.
>>> 
>>> If you use the command: 
>>> 
>>>  crontab -e
>>> 
>>> from a user account, then the crontab is set up as that user. The
>>> first 5 fields/values are time/date related, followed by the
>>> command to be invoked. See: man -s5 crontab  for more details.
>>> 
>>> In that case, the user that mysql sees is the user that is running
>>> the job. So, if your mysql authentication is set to accept
>>> connections/give access to say the user your web server is running
>>> as (which is how php will show by default), then you will either
>>> need to pass those credentials in your cron job php script or,
>>> give the user that's running the cron job access.
>>> 
>> 
>> Again, thank you for the response Richard.
>> 
>> Would you possibly have a link to how to set that up? I mean the
>> actual commands. My trouble is I don't know what commands and how
>> to write them. Like including a user, forcing the PHP.ini and
>> executing the script. All in one line. That is what I am trying to
>> accomplish and not sure how. Need to read up on the proper way to
>> do this. 
>> 
> 
> The php.ini that is used will be based on the php rules for the
> path(s) (and order) it searches for that file.
> 
> The user that is running the script will be the user that the cron
> job is set up under. If you set up a cron job as a standard user you
> can't assign it to run as a different user. If the issue is mysql
> access, you do that just the way you would in a [web]server parsed
> php file.
> 
> The script is whatever you put on the crontab line.
> 
> The script you reference from the crontab entry can be a shell script
> that does some setup, and then calls your php script.  Your php
> script can have include files (e.g., for mysql connection setup) just
> as you might have in a [web]server parsed php file.
> 
> 
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Corn job anomaly

2016-09-20 Thread Karl DeSaulniers
On Sep 20, 2016, at 7:21 AM, Richard  
wrote:
> 
> 
> 
>> Date: Tuesday, September 20, 2016 03:26:39 -0500
>> From: Karl DeSaulniers 
>> 
>>> On Sep 20, 2016, at 3:22 AM, Lester Caine 
>>> wrote:
>>> 
>>>> On 20/09/16 09:14, Karl DeSaulniers wrote:
>>>> Pardon my ignorance, but what do you mean full path?
>>> Full path to php application.
>>> Cron jobs run as 'root' and so need and user account settings added
>>> manually if they do not match the 'root' environment.
>>> 
>> 
>> OH, ok, I did read something about root earlier.
>> I think it was something like:
>> 
>> root /usr/bin/php5 /home/(directory name removed)/auto_reminder.php
>> 
>> But not positive. I will have to research that more.
>> Thank you.
>> 
>> 
> 
> Whether cron jobs run as root or a standard user depends on how they
> are set up. If set up under a user -- which is the better approach
> for general use -- they will run as that user. Really only
> system-type cron jobs (that require root access) should be set up to
> run as root.
> 
> If you use the command: 
> 
>   crontab -e
> 
> from a user account, then the crontab is set up as that user. The
> first 5 fields/values are time/date related, followed by the command
> to be invoked. See: man -s5 crontab  for more details.
> 
> In that case, the user that mysql sees is the user that is running
> the job. So, if your mysql authentication is set to accept
> connections/give access to say the user your web server is running as
> (which is how php will show by default), then you will either need to
> pass those credentials in your cron job php script or, give the user
> that's running the cron job access.
> 

Again, thank you for the response Richard.

Would you possibly have a link to how to set that up? I mean the actual 
commands. My trouble is I don't know what commands and how to write them. Like 
including a user, forcing the PHP.ini and executing the script. All in one 
line. That is what I am trying to accomplish and not sure how. Need to read up 
on the proper way to do this. 

TIA,

Best,
Karl

Re: [PHP-DB] Corn job anomaly

2016-09-20 Thread Karl DeSaulniers
> On Sep 20, 2016, at 3:22 AM, Lester Caine  wrote:
> 
> On 20/09/16 09:14, Karl DeSaulniers wrote:
>> Pardon my ignorance, but what do you mean full path?
> Full path to php application.
> Cron jobs run as 'root' and so need and user account settings added
> manually if they do not match the 'root' environment.
> 
> -- 
> Lester Caine - G8HFL
> -


OH, ok, I did read something about root earlier.
I think it was something like:

root /usr/bin/php5 /home/(directory name removed)/auto_reminder.php

But not positive. I will have to research that more.
Thank you.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Cron job anomaly

2016-09-20 Thread Karl DeSaulniers

> On Sep 20, 2016, at 3:20 AM, Lester Caine  wrote:
> 
> On 20/09/16 09:10, Karl DeSaulniers wrote:
>> Hi Lester,
>> They are listed inside the php file.
>> 
>> The error message I get is:
>> 
>> Access denied for user '(user name removed)'@'%' to database '(database name 
>> removed)'
>> 
>> Thanks for your response.
> 
> Need a mysql guy to deal with that ;)
> I have seen it myself when trying to use mysql and it's to do with the
> 'network path' but I'm on firebird which simply uses the
> '(user name removed)'
> 
> -- 
> Lester Caine - G8HFL


G, ok, thanks for the input. (: ))

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Corn job anomaly

2016-09-20 Thread Karl DeSaulniers
> On Sep 20, 2016, at 3:14 AM, Karl DeSaulniers  wrote:
> 
>> On Sep 20, 2016, at 3:06 AM, Lester Caine  wrote:
>> 
>> On 20/09/16 06:16, Karl DeSaulniers wrote:
>>> Was probably a newb question, however, now it is saying that my database 
>>> user is not allowed access.
>>> I have a mysql connection inside my script that reads the database to get 
>>> user email addresses to send a reminder email to.
>>> 
>>> Is there supposed to be a call or directive to load mysql in my command 
>>> line as well?
>>> Man this is frustrating.
>> 
>> The user name and password you are using from the web scripts SHOULD
>> work in the script you are using on the cron job. Although mysql does
>> seem to have a few extra security features that cut in. Are they listed
>> in the script, or loaded from the environment ... which is of cause
>> different for the cron jobs ... and why you needed the full path.
>> 
>> -- 
>> Lester Caine - G8HFL
>> -
> 
> 
> Pardon my ignorance, but what do you mean full path?
> Full path of the host name?
> 
> Best,
> 
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com



The command line I am using is as follows.

/usr/bin/php5 /home/(directory name removed)/auto_reminder.php

The time stamps (minute, hour, day, etc) that precede the /usr are loaded by my 
host. just fyi.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Corn job anomaly

2016-09-20 Thread Karl DeSaulniers
> On Sep 20, 2016, at 3:06 AM, Lester Caine  wrote:
> 
> On 20/09/16 06:16, Karl DeSaulniers wrote:
>> Was probably a newb question, however, now it is saying that my database 
>> user is not allowed access.
>> I have a mysql connection inside my script that reads the database to get 
>> user email addresses to send a reminder email to.
>> 
>> Is there supposed to be a call or directive to load mysql in my command line 
>> as well?
>> Man this is frustrating.
> 
> The user name and password you are using from the web scripts SHOULD
> work in the script you are using on the cron job. Although mysql does
> seem to have a few extra security features that cut in. Are they listed
> in the script, or loaded from the environment ... which is of cause
> different for the cron jobs ... and why you needed the full path.
> 
> -- 
> Lester Caine - G8HFL
> -


Pardon my ignorance, but what do you mean full path?
Full path of the host name?

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Corn job anomaly

2016-09-20 Thread Karl DeSaulniers

> On Sep 20, 2016, at 3:06 AM, Lester Caine  wrote:
> 
> On 20/09/16 06:16, Karl DeSaulniers wrote:
>> Was probably a newb question, however, now it is saying that my database 
>> user is not allowed access.
>> I have a mysql connection inside my script that reads the database to get 
>> user email addresses to send a reminder email to.
>> 
>> Is there supposed to be a call or directive to load mysql in my command line 
>> as well?
>> Man this is frustrating.
> 
> The user name and password you are using from the web scripts SHOULD
> work in the script you are using on the cron job. Although mysql does
> seem to have a few extra security features that cut in. Are they listed
> in the script, or loaded from the environment ... which is of cause
> different for the cron jobs ... and why you needed the full path.
> 
> -- 
> Lester Caine - G8HFL
> -

Hi Lester,
They are listed inside the php file.

The error message I get is:

Access denied for user '(user name removed)'@'%' to database '(database name 
removed)'

Thanks for your response.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Corn job anomaly

2016-09-20 Thread Karl DeSaulniers
> On Sep 20, 2016, at 12:16 AM, Karl DeSaulniers  wrote:
> 
>> On Sep 19, 2016, at 6:14 AM, Richard 
>>  wrote:
>> 
>> 
>> 
>>> Date: Monday, September 19, 2016 03:26:54 -0500
>>> From: Karl DeSaulniers 
>>> 
>>> I am hoping someone can enlighten me on this issue I am having.
>>> I am trying to set up a cron job to run a php file.
>>> I am getting a strange error though.
>>> 
>>> /home/(protected directory)/auto_reminder.php: line 1: ?php: No
>>> such file or directory /home/(protected
>>> directory)/auto_reminder.php: line 2: =: command not found
>>> /home/(protected directory)/auto_reminder.php: line 3: /*WordPress:
>>> No such file or directory
>>> 
>>> This is lines 1, 2 and 3 from my code.
>>> 
>>> >> $error_log = "";
>>> /*WordPress Optons Table*/
>>> 
>>> Am I correct in thinking that the error is saying that php doesn't
>>> exist? Has anyone ever experienced this? Is this a server related
>>> issue? Any clue on how to fix?
>> 
>> What do you have on the "command-line" part of your crontab entry?
>> Your php script will need to be called as a php cgi or cli. Because
>> of the way things get set up via cron, it's best to include the full
>> path to the php binary on the cron command-line.
>> 
> 
> Hey thanks Richard. That was the problem.
> Sorry, I am new to command line and cron jobs. 
> Was probably a newb question, however, now it is saying that my database user 
> is not allowed access.
> I have a mysql connection inside my script that reads the database to get 
> user email addresses to send a reminder email to.
> 
> Is there supposed to be a call or directive to load mysql in my command line 
> as well?
> Man this is frustrating.
> 
> Much thanks for your input!
> 
> Best,
> 
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
> 

Heh, I just noticed the subject line. Got to love auto-correct!
I feel like a corn job at this point...  (:  /)

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] MySQL two tables and an uneven number of rows

2016-09-19 Thread Karl DeSaulniers
Thanks Bert,
Sorry for late response, but I had to step away from this for a moment to work 
on other things.
Will most likely be back though as things are not working still.

Thank you for your responses.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com




> On Sep 13, 2016, at 2:15 AM, B. Aerts  wrote:
> 
> On 13/09/16 08:42, Karl DeSaulniers wrote:
>>> On Sep 12, 2016, at 2:53 PM, B. Aerts  wrote:
>>> 
>>> On 12/09/16 05:24, Karl DeSaulniers wrote:
>>>> Hello All,
>>>> Hoping you can help clear my head on this. I have two MySQL tables for 
>>>> custom fields data to be stored.
>>>> 
>>>>custom_fields   custom_fields_meta
>>>> 
>>>> custom_fields is the info for the actual field displayed in the html and 
>>>> custom_fields_meta is the data stored from entering a value on said field 
>>>> in the form.
>>>> 
>>>> Custom fields can be added and removed at will by the user and so when for 
>>>> instance, adding a field,
>>>> it currently creates an uneven number of rows in the custom_fields_meta if 
>>>> there were any entries with fields create prior to this new one.
>>>> 
>>>> Currently I have this code:
>>>> 
>>>> $SQL = "SELECT ft.*, mt.Meta_Value
>>>>FROM `CUSTOM_FIELDS` ft
>>>>LEFT JOIN `CUSTOM_FIELDS_META` mt
>>>>ON mt.Field_ID = ft.Field_ID
>>>>WHERE mt.Order_ID=%d
>>>>ORDER BY ft.Field_ID ASC";
>>>> 
>>>> I have tried JOIN, FULL JOIN, FULL OUTER JOIN, OUTER JOIN and LEFT JOIN.
>>>> If I manually put in the missing rows in the meta table, left join works.
>>>> However, manually updating prior entries is not going to happen.
>>>> 
>>>> So my question is how do I get all the table rows in both tables even if 
>>>> there is not a row to match on the meta table?
>>>> or
>>>> How would I update the prior entries to include this new field in the meta 
>>>> table and keep things orderly?
>>>> The meta is stored per order id and so there is groups of meta data per 
>>>> order id. I would like to avoid scattered data.
>>>> Is there a way to push the index down to fit them in or is this just going 
>>>> to be too costly on server resources?
>>>> 
>>>> TIA,
>>>> 
>>>> Best,
>>>> 
>>>> Karl DeSaulniers
>>>> Design Drumm
>>>> http://designdrumm.com <http://designdrumm.com/>
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>> Hi Karl,
>>> 
>>> I can't really follow your problem ... Any chance to post 2 dummy table 
>>> layouts to show what you want, and what you get ?
>>> 
>>> And it isn't something you could solve with a UNION ?
>>> 
>>> 
>> 
>> 
>> Hello,
>> Thanks fro your reply. I can try. :)
>> 
>> BEFORE:
>> 
>> CUSTOM_FIELDS:
>> 
>> `Field_ID`, `Field_Group`, `Field_Label`, `Field_Name`, `Field_Slug`, 
>> `Field_Type`, `Field_Description`, `Field_Values`, `Field_Display`, 
>> `Field_Required`, `Field_Date_Created`
>> ||
>> (1, 'Pickup Info', 'Phone 1', 'Origin_Phone1', 'origin-phone1', 'phone', 
>> 'Pickup Main phone number', '', 'Yes', 'No', '2015-04-19 08:46:10'),
>> (2, 'Pickup Info', 'Phone 2', 'Origin_Phone2', 'origin-phone2', 'phone', 
>> 'Pickup alternate phone number 1', '', 'Yes', 'No', '2015-04-19 08:46:11'),
>> (3, 'Pickup Info', 'Phone 3', 'Origin_Phone3', 'origin-phone3', 'phone', 
>> 'Pickup alternate phone number 2', '', 'Yes', 'No', '2015-04-19 08:46:12')
>> 
>> CUSTOM_FIELDS_META:
>> 
>> `Meta_ID`, `Field_ID`, `Order_ID`, `Meta_Value`
>> |—|
>> (1, 1, 1003, '555-123-4567'),
>> (2, 2, 1003, ''),
>> (3, 3, 1003, '')
>> 
>> 
>> Then lets say the user wants to add a cell phone field.
>> 
>> AFTER:
>> 
>> CUSTOM_FIELDS:
>> 
>> `Field_ID`, `Field_Group`, `Field_Label

Re: [PHP-DB] Corn job anomaly

2016-09-19 Thread Karl DeSaulniers
> On Sep 19, 2016, at 6:14 AM, Richard 
>  wrote:
> 
> 
> 
>> Date: Monday, September 19, 2016 03:26:54 -0500
>> From: Karl DeSaulniers 
>> 
>> I am hoping someone can enlighten me on this issue I am having.
>> I am trying to set up a cron job to run a php file.
>> I am getting a strange error though.
>> 
>> /home/(protected directory)/auto_reminder.php: line 1: ?php: No
>> such file or directory /home/(protected
>> directory)/auto_reminder.php: line 2: =: command not found
>> /home/(protected directory)/auto_reminder.php: line 3: /*WordPress:
>> No such file or directory
>> 
>> This is lines 1, 2 and 3 from my code.
>> 
>> > $error_log = "";
>> /*WordPress Optons Table*/
>> 
>> Am I correct in thinking that the error is saying that php doesn't
>> exist? Has anyone ever experienced this? Is this a server related
>> issue? Any clue on how to fix?
> 
> What do you have on the "command-line" part of your crontab entry?
> Your php script will need to be called as a php cgi or cli. Because
> of the way things get set up via cron, it's best to include the full
> path to the php binary on the cron command-line.
> 

Hey thanks Richard. That was the problem.
Sorry, I am new to command line and cron jobs. 
Was probably a newb question, however, now it is saying that my database user 
is not allowed access.
I have a mysql connection inside my script that reads the database to get user 
email addresses to send a reminder email to.

Is there supposed to be a call or directive to load mysql in my command line as 
well?
Man this is frustrating.

Much thanks for your input!

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Corn job anomaly

2016-09-19 Thread Karl DeSaulniers
I am hoping someone can enlighten me on this issue I am having.
I am trying to set up a cron job to run a php file.
I am getting a strange error though.

/home/(protected directory)/auto_reminder.php: line 1: ?php: No such file or 
directory
/home/(protected directory)/auto_reminder.php: line 2: =: command not found
/home/(protected directory)/auto_reminder.php: line 3: /*WordPress: No such 
file or directory

This is lines 1, 2 and 3 from my code.

http://designdrumm.com 






Re: [PHP-DB] MySQL two tables and an uneven number of rows

2016-09-12 Thread Karl DeSaulniers
> On Sep 12, 2016, at 2:53 PM, B. Aerts  wrote:
> 
> On 12/09/16 05:24, Karl DeSaulniers wrote:
>> Hello All,
>> Hoping you can help clear my head on this. I have two MySQL tables for 
>> custom fields data to be stored.
>> 
>>  custom_fields   custom_fields_meta
>> 
>> custom_fields is the info for the actual field displayed in the html and 
>> custom_fields_meta is the data stored from entering a value on said field in 
>> the form.
>> 
>> Custom fields can be added and removed at will by the user and so when for 
>> instance, adding a field,
>> it currently creates an uneven number of rows in the custom_fields_meta if 
>> there were any entries with fields create prior to this new one.
>> 
>> Currently I have this code:
>> 
>> $SQL = "SELECT ft.*, mt.Meta_Value
>>  FROM `CUSTOM_FIELDS` ft
>>  LEFT JOIN `CUSTOM_FIELDS_META` mt
>>  ON mt.Field_ID = ft.Field_ID
>>  WHERE mt.Order_ID=%d
>>  ORDER BY ft.Field_ID ASC";
>> 
>> I have tried JOIN, FULL JOIN, FULL OUTER JOIN, OUTER JOIN and LEFT JOIN.
>> If I manually put in the missing rows in the meta table, left join works.
>> However, manually updating prior entries is not going to happen.
>> 
>> So my question is how do I get all the table rows in both tables even if 
>> there is not a row to match on the meta table?
>> or
>> How would I update the prior entries to include this new field in the meta 
>> table and keep things orderly?
>> The meta is stored per order id and so there is groups of meta data per 
>> order id. I would like to avoid scattered data.
>> Is there a way to push the index down to fit them in or is this just going 
>> to be too costly on server resources?
>> 
>> TIA,
>> 
>> Best,
>> 
>> Karl DeSaulniers
>> Design Drumm
>> http://designdrumm.com <http://designdrumm.com/>
>> 
>> 
>> 
>> 
>> 
> Hi Karl,
> 
> I can't really follow your problem ... Any chance to post 2 dummy table 
> layouts to show what you want, and what you get ?
> 
> And it isn't something you could solve with a UNION ?
> 
> 


Hello,
Thanks fro your reply. I can try. :)

BEFORE:

CUSTOM_FIELDS:

`Field_ID`, `Field_Group`, `Field_Label`, `Field_Name`, `Field_Slug`, 
`Field_Type`, `Field_Description`, `Field_Values`, `Field_Display`, 
`Field_Required`, `Field_Date_Created`
||
(1, 'Pickup Info', 'Phone 1', 'Origin_Phone1', 'origin-phone1', 'phone', 
'Pickup Main phone number', '', 'Yes', 'No', '2015-04-19 08:46:10'),
(2, 'Pickup Info', 'Phone 2', 'Origin_Phone2', 'origin-phone2', 'phone', 
'Pickup alternate phone number 1', '', 'Yes', 'No', '2015-04-19 08:46:11'),
(3, 'Pickup Info', 'Phone 3', 'Origin_Phone3', 'origin-phone3', 'phone', 
'Pickup alternate phone number 2', '', 'Yes', 'No', '2015-04-19 08:46:12')

CUSTOM_FIELDS_META:

`Meta_ID`, `Field_ID`, `Order_ID`, `Meta_Value`
|—|
(1, 1, 1003, '555-123-4567'),
(2, 2, 1003, ''),
(3, 3, 1003, '')


Then lets say the user wants to add a cell phone field.

AFTER:

CUSTOM_FIELDS:

`Field_ID`, `Field_Group`, `Field_Label`, `Field_Name`, `Field_Slug`, 
`Field_Type`, `Field_Description`, `Field_Values`, `Field_Display`, 
`Field_Required`, `Field_Date_Created`
||
(1, 'Pickup Info', 'Phone 1', 'Origin_Phone1', 'origin-phone1', 'phone', 
'Pickup Main phone number', '', 'Yes', 'No', '2015-04-19 08:46:10'),
(2, 'Pickup Info', 'Phone 2', 'Origin_Phone2', 'origin-phone2', 'phone', 
'Pickup alternate phone number 1', '', 'Yes', 'No', '2015-04-19 08:46:11'),
(3, 'Pickup Info', 'Phone 3', 'Origin_Phone3', 'origin-phone3', 'phone', 
'Pickup alternate phone number 2', '', 'Yes', 'No', '2015-04-19 08:46:12'),
(4, 'Pickup Info', 'Cell', 'Origin_Cell', 'origin-cell', 'phone', 'Pickup cell 
phone number', '', 'Yes', 'No', '2015-04-19 08:46:13')

CUSTOM_FIELDS_META:

`Meta_ID`, `Field_ID`, `Order_ID`, `Meta_Value`
|—|
(1, 1, 1003, '555-123-4567'),
(2, 2, 1003, ''),
(3, 3, 1003, '')

The 4th field id is not in the meta table. So when I read out what is in the 
custom fields and matching meta data, cell phone does not show up for order 
that were processed before adding the custom field cell phone. I am trying to 
show the cell phone field on old orders as well even if there is not a row 
representing data in the meta table.

Hope that clears it up and not mud it up.. :P

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] MySQL two tables and an uneven number of rows

2016-09-11 Thread Karl DeSaulniers
Hello All,
Hoping you can help clear my head on this. I have two MySQL tables for custom 
fields data to be stored.

custom_fields   custom_fields_meta

custom_fields is the info for the actual field displayed in the html and 
custom_fields_meta is the data stored from entering a value on said field in 
the form.

Custom fields can be added and removed at will by the user and so when for 
instance, adding a field, 
it currently creates an uneven number of rows in the custom_fields_meta if 
there were any entries with fields create prior to this new one.

Currently I have this code:

$SQL = "SELECT ft.*, mt.Meta_Value 
FROM `CUSTOM_FIELDS` ft 
LEFT JOIN `CUSTOM_FIELDS_META` mt 
ON mt.Field_ID = ft.Field_ID 
WHERE mt.Order_ID=%d 
ORDER BY ft.Field_ID ASC";

I have tried JOIN, FULL JOIN, FULL OUTER JOIN, OUTER JOIN and LEFT JOIN. 
If I manually put in the missing rows in the meta table, left join works.
However, manually updating prior entries is not going to happen. 

So my question is how do I get all the table rows in both tables even if there 
is not a row to match on the meta table?
or
How would I update the prior entries to include this new field in the meta 
table and keep things orderly?
The meta is stored per order id and so there is groups of meta data per order 
id. I would like to avoid scattered data.
Is there a way to push the index down to fit them in or is this just going to 
be too costly on server resources?

TIA,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com <http://designdrumm.com/>






Re: [PHP-DB] Any method to get primary key matching a given value ?

2016-08-20 Thread Karl DeSaulniers
This may also shed some light for you.
The accepted answer and possibly the one below it if you are on .NET

http://stackoverflow.com/questions/763516/information-schema-columns-on-sqlite

HTH,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com




> On Aug 20, 2016, at 5:30 AM, Karl DeSaulniers  wrote:
> 
> Hey Ratin,
> Have you looked into the table column named 'pk' inside table_info?
> That is where a column is indicated to be a primary key or not.
> 
> Best,
> 
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com <http://designdrumm.com/>
> 
> 
> 
> 
>> On Aug 18, 2016, at 6:51 PM, Ratin  wrote:
>> 
>> Hi Karl, Thanks a lot for your response, I think  INFORMATION_SCHEMA is not 
>> available for sqlite database. I had to built up the whole query with php 
>> using PRAGMA table_info(tablename), looking at the pk entry, when its 1, get 
>> the column name, and then update the sql statement based on that. A bit of 
>> work, wouldve been much simpler if a method was provided, but oh well ..
>> 
>> Thanks again
>> 
>> Ratin 
>> 
>> On Thu, Aug 18, 2016 at 2:53 PM, Karl DeSaulniers > <mailto:k...@designdrumm.com>> wrote:
>> Hi Ratin,
>> Going to take a stab at this one.
>> Have you looked into INFORMATION_SCHEMA.COLUMNS for your query?
>> Might be where you want to look for what you are trying.
>> Sorry can't help more.
>> 
>> Best,
>> 
>> Karl DeSaulniers
>> Design Drumm
>> http://designdrumm.com <http://designdrumm.com/>
>> 
>> 
>> 
>> 
>>> On Aug 18, 2016, at 1:27 PM, Ratin >> <mailto:rat...@gmail.com>> wrote:
>>> 
>>> I'm writing the generic get that works on different tables having different
>>> primary keys but the argument of get is always the primary key , i.e. get
>>> request is -
>>> 
>>> get (column name, value)
>>> 
>>> the value is always the primary key value.
>>> 
>>> It looks like it would be a pretty standard method but I cant find a method
>>> like that. Anybody have any clue?
>>> 
>>> Thanks
>>> 
>>> Ratin
>> 
>> 
>> --
>> PHP Database Mailing List (http://www.php.net/ <http://www.php.net/>)
>> To unsubscribe, visit: http://www.php.net/unsub.php 
>> <http://www.php.net/unsub.php>
>> 
>> 
> 


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Any method to get primary key matching a given value ?

2016-08-20 Thread Karl DeSaulniers
Hey Ratin,
Have you looked into the table column named 'pk' inside table_info?
That is where a column is indicated to be a primary key or not.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com <http://designdrumm.com/>




> On Aug 18, 2016, at 6:51 PM, Ratin  wrote:
> 
> Hi Karl, Thanks a lot for your response, I think  INFORMATION_SCHEMA is not 
> available for sqlite database. I had to built up the whole query with php 
> using PRAGMA table_info(tablename), looking at the pk entry, when its 1, get 
> the column name, and then update the sql statement based on that. A bit of 
> work, wouldve been much simpler if a method was provided, but oh well ..
> 
> Thanks again
> 
> Ratin 
> 
> On Thu, Aug 18, 2016 at 2:53 PM, Karl DeSaulniers  <mailto:k...@designdrumm.com>> wrote:
> Hi Ratin,
> Going to take a stab at this one.
> Have you looked into INFORMATION_SCHEMA.COLUMNS for your query?
> Might be where you want to look for what you are trying.
> Sorry can't help more.
> 
> Best,
> 
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com <http://designdrumm.com/>
> 
> 
> 
> 
> > On Aug 18, 2016, at 1:27 PM, Ratin  > <mailto:rat...@gmail.com>> wrote:
> >
> > I'm writing the generic get that works on different tables having different
> > primary keys but the argument of get is always the primary key , i.e. get
> > request is -
> >
> > get (column name, value)
> >
> > the value is always the primary key value.
> >
> > It looks like it would be a pretty standard method but I cant find a method
> > like that. Anybody have any clue?
> >
> > Thanks
> >
> > Ratin
> 
> 
> --
> PHP Database Mailing List (http://www.php.net/ <http://www.php.net/>)
> To unsubscribe, visit: http://www.php.net/unsub.php 
> <http://www.php.net/unsub.php>
> 
> 



Re: [PHP-DB] Any method to get primary key matching a given value ?

2016-08-18 Thread Karl DeSaulniers
Hi Ratin,
Going to take a stab at this one. 
Have you looked into INFORMATION_SCHEMA.COLUMNS for your query?
Might be where you want to look for what you are trying. 
Sorry can't help more.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com




> On Aug 18, 2016, at 1:27 PM, Ratin  wrote:
> 
> I'm writing the generic get that works on different tables having different
> primary keys but the argument of get is always the primary key , i.e. get
> request is -
> 
> get (column name, value)
> 
> the value is always the primary key value.
> 
> It looks like it would be a pretty standard method but I cant find a method
> like that. Anybody have any clue?
> 
> Thanks
> 
> Ratin


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] PDO and SAP HANA prepared statements issue

2016-01-26 Thread Karl DeSaulniers
Oh ok, thanks for the clarification. Sorry for the noise.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



On Jan 26, 2016, at 1:07 PM, Alko Kotalko  wrote:

> It shouldn't be like that because I'm preparing a statement, which would 
> later have had parameters passed to. I'm not trying to concatenate a string.
> (Sorry, forgot to reply to all before)
> 
> On Tue, Jan 26, 2016 at 8:18 AM, Karl DeSaulniers  
> wrote:
> On Jan 26, 2016, at 7:10 AM, Alko Kotalko  wrote:
> 
> > Hi,
> >
> > I have a working connection from PHP to SAP HANA through PDO and regular
> > ODBC commands.
> >
> > The issue is that through PDO I can not get any prepared statements to
> > work. None of the notations (?, $, :) work. The response from the server
> > (fetch) gets me empty field values for all selected columns and if I try
> > fetchAll the PHP script runs out of memory.
> >
> > ODBC commands actually work with the ? and colon ($) notations. But not
> > with colon (:). I suppose this is due to the lack of named parameters
> > support in ODBC commands (haven't actually confirmed that though). The $
> > notation brings me the closest to named parameters because a specific
> > number can be repeated.
> >
> > For example:
> > "SELECT * FROM dummy WHERE col1=$1 AND col2=$2 AND col3=$1" works.
> >
> > However it is not ideal. I would like to know if anyone has any experience
> > with SAP HANA and I can offer my help and participation in order to debug
> > the possible problems with PDO<->HANA connectivity issues (in regards to
> > prepared statements).
> >
> > BR Aleš
> 
> 
> Pardon me for asking, but shouldn't this line..
> 
> "SELECT * FROM dummy WHERE col1=$1 AND col2=$2 AND col3=$1"
> 
> be
> 
> "SELECT * FROM dummy WHERE col1=".$1." AND col2=".$2." AND col3=".$1."  "
> 
> or like this
> 
> "SELECT * FROM dummy WHERE col1='".$1."' AND col2='".$2."' AND col3='".$1."'  
> "
> 
> ?
> 
> I have found that letting php create the string without the quotes and 
> periods in a SQL statement can cause issues.
> Don't ask me why it causes issues, I couldn't tell you :)  Just my experience.
> 
> Best,
> 
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
> 
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 



Re: [PHP-DB] PDO and SAP HANA prepared statements issue

2016-01-26 Thread Karl DeSaulniers
On Jan 26, 2016, at 7:10 AM, Alko Kotalko  wrote:

> Hi,
> 
> I have a working connection from PHP to SAP HANA through PDO and regular
> ODBC commands.
> 
> The issue is that through PDO I can not get any prepared statements to
> work. None of the notations (?, $, :) work. The response from the server
> (fetch) gets me empty field values for all selected columns and if I try
> fetchAll the PHP script runs out of memory.
> 
> ODBC commands actually work with the ? and colon ($) notations. But not
> with colon (:). I suppose this is due to the lack of named parameters
> support in ODBC commands (haven't actually confirmed that though). The $
> notation brings me the closest to named parameters because a specific
> number can be repeated.
> 
> For example:
> "SELECT * FROM dummy WHERE col1=$1 AND col2=$2 AND col3=$1" works.
> 
> However it is not ideal. I would like to know if anyone has any experience
> with SAP HANA and I can offer my help and participation in order to debug
> the possible problems with PDO<->HANA connectivity issues (in regards to
> prepared statements).
> 
> BR Aleš


Pardon me for asking, but shouldn't this line..

"SELECT * FROM dummy WHERE col1=$1 AND col2=$2 AND col3=$1"

be

"SELECT * FROM dummy WHERE col1=".$1." AND col2=".$2." AND col3=".$1."  "

or like this

"SELECT * FROM dummy WHERE col1='".$1."' AND col2='".$2."' AND col3='".$1."'  "

?

I have found that letting php create the string without the quotes and periods 
in a SQL statement can cause issues.
Don't ask me why it causes issues, I couldn't tell you :)  Just my experience. 

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Select on Group

2015-11-16 Thread Karl DeSaulniers
Hello All,
Hoping someone can help me with this query.

I want to select some custom fields from my database that are part of a group 
of custom fields.
There are several of these groups. I want to (in one sql statement) grab these 
fields, all of them
and have them grouped in the results like so.


$custom_fields = array(
'Group1' => array(
'field_ID' => '1', 
'field_name' => 'myAddressField',
'filed_slug' => 'my-address-field'
),
'Group2' => array(
'field_ID' => '2', 
'field_name' => 'myCityField',
'filed_slug' => 'my-city-field'
),
'Group3' => array(
'field_ID' => '3', 
'field_name' => 'myStateField',
'filed_slug' => 'my-state-field'
)
)

Here is the clincher... not all the info is in the same table.
This is what I am doing currently and it works, however I would like to 
eliminate calling the database in a foreach loop as well as multiple times to 
get my results.

[code]

$FieldGroups = $wpdb->get_results("SELECT DISTINCT Field_Group FROM 
".table_name1."");

foreach($FieldGroups as $i=>$FieldGroup) {
$field_group = stripslashes_deep($FieldGroup->Field_Group);

$SQL = "SELECT ft.*, mt.* 
FROM ". table_name1." ft 
LEFT JOIN ". table_name2." mt 
ON mt.Field_ID = ft.Field_ID 
WHERE ft.Field_Group='%s' AND mt.Page_ID=%d AND 
ft.Field_Display='%s' 
ORDER BY ft.Field_ID ASC";  
$Fields = $wpdb->get_results($wpdb->prepare($SQL, $field_group, 
$Page_ID, $display));
}

[end code]

How can I combine these into one query that fills the result array the way 
described above?
I thought of a SELECT inside a SELECT, but my php foo is a little under trained 
at the moment.
Not sure how to do such and achieve the results I am after. Any help would be 
appreciated. 

TIA

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com





Re: [PHP-DB] Correct Syntax?

2015-10-30 Thread Karl DeSaulniers
Hi, I have since moved on from this as it wasn't what I needed. 
Thanks for your response though.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



On Oct 30, 2015, at 3:32 AM, chimurenga chimurenga 
 wrote:

> make vehicle licence the unique key
> 
> On 14 Oct 2015 00:28, "Karl DeSaulniers"  wrote:
>> 
>> Quick question. Is this viable in MySQL?
>> 
>> UNIQUE KEY `Vehicle_Name`
> (`Vehicle_Make`+`Vehicle_Model`+`Vehicle_Style`+`Vehicle_License`)
>> 
>> TIA
>> 
>> Best,
>> 
>> Karl DeSaulniers
>> Design Drumm
>> http://designdrumm.com
>> 
>> 
>> 


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Correct Syntax?

2015-10-13 Thread Karl DeSaulniers
On Oct 13, 2015, at 8:40 PM, Roberto Spadim  wrote:

> instead of +, use ",'
> 
> 2015-10-13 20:21 GMT-03:00 Karl DeSaulniers :
> Quick question. Is this viable in MySQL?
> 
> UNIQUE KEY `Vehicle_Name` 
> (`Vehicle_Make`+`Vehicle_Model`+`Vehicle_Style`+`Vehicle_License`)
> 
> TIA
> 
> Best,
> 
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
> 


!

Thank you!
I realize now I should have known that... sigh.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com

[PHP-DB] Correct Syntax?

2015-10-13 Thread Karl DeSaulniers
Quick question. Is this viable in MySQL?

UNIQUE KEY `Vehicle_Name` 
(`Vehicle_Make`+`Vehicle_Model`+`Vehicle_Style`+`Vehicle_License`)

TIA

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com





Re: [PHP-DB] Zero Values

2015-09-02 Thread Karl DeSaulniers
On Sep 2, 2015, at 11:02 PM, Ethan Rosenberg  
wrote:

> Dear list -
> 
> I know that I am making a mistake somewhere. but am lost for an answer.
> 
> mysql> select Payments  from Charges where if(Payments,  Payments, 0);
> +--+
> | Payments |
> +--+
> |13.00 |
> |55.00 |
> |65.00 |
> |65.00 |
> |65.00 |
> |65.00 |
> |   123.00 |
> |   150.00 |
> 
> mysql> select Balance, Payments, Charges from Charges where ifnull(Balance,0);
> +-+--+-+
> | Balance | Payments | Charges |
> +-+--+-+
> |  -13.00 |13.00 |0.00 |
> |  123.00 | 0.00 |  123.00 |
> |  325.00 | 0.00 |  325.00 |
> |   10.00 | 0.00 |   23.00 |
> |  270.00 |55.00 |0.00 |
> |   58.00 |65.00 |0.00 |
> |   -7.00 |65.00 |0.00 |
> |  -72.00 |65.00 |0.00 |
> 
> TIA
> 
> Ethan

Something like?

$SQL = "SELECT * FROM `Charges` 
WHERE Cust_Num=".$Cust_Num." 
AND Charges!='NULL' AND Ballance!='NULL' AND Payments!='NULL' 
ORDER BY Date ASC";

Not sure why you would have a column name the same as your database table 
though.
Could get confusing.  

HTH,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Zero Values

2015-09-02 Thread Karl DeSaulniers
On Sep 1, 2015, at 10:36 PM, Ethan Rosenberg  
wrote:

> Dear List -
> 
> I have a payment/charges table -
> 
> mysql> describe Charges;
> +--+--+--+-+-+---+
> | Field| Type | Null | Key | Default | Extra |
> +--+--+--+-+-+---+
> | Indx | mediumint(9) | NO   | PRI | 0   |   |
> | Cust_Num | smallint(5) unsigned | NO   | | NULL|   |
> | Balance  | decimal(10,2)| YES  | | NULL|   |
> | Payments | decimal(10,2)| YES  | | NULL|   |
> | Charges  | decimal(10,2)| YES  | | NULL|   |
> | Notes2   | text | YES  | | NULL|   |
> | Date | date | YES  | | NULL|   |
> | PH1  | char(4)  | YES  | | NULL|   |
> | PH2  | char(4)  | YES  | | NULL|   |
> | PH3  | char(5)  | YES  | | NULL|   |
> +--+--+--+-+-+---+
> 10 rows in set (0.11 sec)
> 
> If Balance, Payments and Charges all equal 0, and then
> 
> select * from Charges,
> 
> the rows w/ all zero values will not be displayed.
> 
> Why?
> 
> TIA
> 
> Ethan
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

I would recommend storing the zero value if you plan on using that value for 
calculation later. 
Just makes things easier than having to do a if(NULL) statement.
2¢

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] For my understanding

2015-07-25 Thread Karl DeSaulniers
Hello,
This might be a question better suited for the general php list.
If it is, please let me know.

I have inherited some pages that have a code on it I don't recognize.
Can anyone enlighten me as to what this code is doing?

[code]
array_walk($Options, create_function('&$val', '$val = trim($val);'));

Is this creating php variables from the contents of the $Options array?
TIA

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com





Re: [PHP-DB] Grouping results

2015-07-23 Thread Karl DeSaulniers
Well, I figured it out. It took two queries.
Probably a better way I'm not thinking about, but this works in case anyone 
needs/wants.

Was hoping to do it all in the SQL statement I guess.

$FieldGroups = $wpdb->get_results("SELECT DISTINCT Field_Group FROM 
".table_name);

foreach($FieldGroups as $FieldGroup) {
$ReturnString .= ''.$FieldGroup->Field_Group.'';
$Fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". 
table_name.' WHERE Field_Group=%s', $FieldGroup->Field_Group));
foreach($Fields as $i=>$Field) {
$ReturnString .= /*Other code to build html*/
}
}
return $ReturnString;

I am working on a WordPress site. Hence the $wpdb->get_results().
FYI, for those who aren't familiar. 

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


PS: Thanks teddy bear


On Jul 22, 2015, at 11:19 PM, Karl DeSaulniers  wrote:

> Hello All,
> How can I group database results in a foreach loop?
> I have a field_group column that can have a value or not.
> 
> I want to read from the database then display results and if the results have 
> a matching field_group, I want to have them group in the html.
> 
> This is my current SQL. I am using MySQL.
> 
> $Sql = "SELECT * FROM ".table_name.' GROUP BY Field_ID, Field_Group';
> 
> From this I want to be able to wrap the groups in a div and add a h3 with the 
> group name.
> So if there are 5 entries in the BOB group, then the html would look like 
> this.
> 
> //empty Field_Group
> //Field_Group = BOB
>   
>   
>   
>   
> 
> //empty Field_Group
> //empty Field_Group
> //Field_Group = Charlie
>   
>   
>   
> 
> 
> Am I setting this up right?  
> 
> TIA
> 
> Best,
> 
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
> 
> 
> 


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Grouping results

2015-07-22 Thread Karl DeSaulniers
Hello All,
How can I group database results in a foreach loop?
I have a field_group column that can have a value or not.

I want to read from the database then display results and if the results have a 
matching field_group, I want to have them group in the html.

This is my current SQL. I am using MySQL.

$Sql = "SELECT * FROM ".table_name.' GROUP BY Field_ID, Field_Group';

From this I want to be able to wrap the groups in a div and add a h3 with the 
group name.
So if there are 5 entries in the BOB group, then the html would look like this.

//empty Field_Group
//Field_Group = BOB





//empty Field_Group
//empty Field_Group
//Field_Group = Charlie





Am I setting this up right?  

TIA

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com





Re: [PHP-DB] SQL Injection

2015-05-16 Thread Karl DeSaulniers
On May 16, 2015, at 8:42 AM, Lester Caine  wrote:

> On 16/05/15 10:00, Karl DeSaulniers wrote:
>> That does clarify things a bit better on both the @ question
>> and prepared statements. Thank you for the link as well.
>> 
>> So new question.. what is the best type of database to use
>> for someone who wants to start small and grow big?
>> 
>> My findings led me to MySQL InnoDB.
> 
> I'm somewhat biased since much of my data goes back to a time before
> MySQL even existed. Using Interbase which is now open source as
> Firebird. Early versions of MySQL were never stable enough to use in the
> environments I work, and while Postgres was also appearing on the radar,
> I've no reason to change. Little things like being able to run backups
> automatically even if I've never actually had to use one. And some SQL
> functions available in Firebird have yet to appear in other engines, and
> having to decide if you want the security InnoDB provides is simply
> standard in other engines.
> 
> The first question is are you hosting yourself or using third party
> hosting? MySQL tends to be available on all third party posting, with
> some providing Postgres, while Firebird tends to be privately hosted. If
> you are hosting yourself, then of cause MySQL may actually be MariaDB
> and you end up with a mix of sources. It's a bit like Internbase and
> Firebird where the commercial charges can affect one installation where
> the other is totally free.
> 
> If you are only looking for a single installation, then MySQL is
> probably fine. I'm running 50+ databases and with Firebird each is
> isolated in it's own directory and automatically backs up to the website
> storage area.
> 
> -- 
> Lester Caine - G8HFL
> -

Interesting. I program in MySQL on a hosting plan by a third party.
I have heard/read MySQL is not an enterprise solution, but 
for the basic business with say less than 100,000 customers,
it does the job and well. Larger than that I had hear Postgres
and oracle were good to look at. Havent heard any good things about
SQL server (.NET), but did't have too much trouble working with one a few years 
back.
I guess I don't know enough about what is available to do with a good database 
and which
to pick to do what I want with. There are so many. Hence my question here.

Again, thanks for your response.


Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] SQL Injection

2015-05-16 Thread Karl DeSaulniers

On May 16, 2015, at 3:51 AM, Lester Caine  wrote:

> On 15/05/15 06:21, Karl DeSaulniers wrote:
>> Oh ok. Now it makes a little more sense. 
>> I have worked in ASP before, but I am programming in PHP and MySQL at the 
>> moment. 
>> 
>> I am going to look into Prepared Statements. Thanks for your feedback.
> 
> Just to clarify things a little here and explain
> http://php.net/manual/en/pdo.prepared-statements.php a little more ...
> 
> Many of the legacy injection problems where/are caused by building up
> the query as a fully self contained string. Various methods like
> 'magic_quotes' and wrapping $var in things like makesafe($var) were the
> only way some database engines could handle adding variables to the SQL
> string and much code still follows that style even today. Other database
> engines have always had the ability to pass the variables as a separate
> array of data, and the @x is more normally seen as a simple ? in the SQL
> string, so PDO and other frameworks map the ':var' elements of the first
> example to the relevant style used by the database. Actually naming
> parameters is not the norm, so one has to have the right number of '?'
> elements to go with the array of data passed, so PDO is adding a layer
> of code which hides the underlying execute(sql_query, array_of_data);
> 
> -- 
> Lester Caine - G8HFL
> -
> Contact - http://lsces.co.uk/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk
> Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

Thank you Lester. 
That does clarify things a bit better on both the @ question
and prepared statements. Thank you for the link as well.

So new question.. what is the best type of database to use
for someone who wants to start small and grow big?

My findings led me to MySQL InnoDB.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] SQL Injection

2015-05-14 Thread Karl DeSaulniers
On May 14, 2015, at 11:11 PM, Onatawahtaw  wrote:

> Hi Karl,
> 
> If you look at the link you provided you'll notice that some of the code is 
> for ASP.net and some is for PHP. What of the two are you programming in? If 
> you are programming in ASP.net you are asking your question to the wrong 
> mailing list as this list is for PHP. If you are programming in PHP, then the 
> @ symbol does not apply to you.
> 
> Both prepared statements and mysqli_real_escape_string do provide adequate 
> security (if used correctly).  However, my recommendation is to learn how to 
> use PDO with prepared statements. PDO also offers the benefit of being able 
> to connect to multiple types of databases without needing to change your 
> code. If you use mysqli and down the road you decide you want to use Oracle, 
> MS SQL Server, or some other database server, you will ned to rework a lot of 
> your code. Not so with PDO.
> 
> Hope this helps,
> 
> -Kevin Waddell
> Proverbs 3:5-6

Oh ok. Now it makes a little more sense. 
I have worked in ASP before, but I am programming in PHP and MySQL at the 
moment. 

I am going to look into Prepared Statements. Thanks for your feedback. 

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] SQL Injection

2015-05-14 Thread Karl DeSaulniers
On May 14, 2015, at 8:37 PM, Jigme Datse Yli-Rasku  
wrote:

> On 15/05/14 18:19 , Karl DeSaulniers wrote:
>> On May 14, 2015, at 8:09 PM, Aziz Saleh  wrote:
>> 
>>> 
>>> 
>>> On Thu, May 14, 2015 at 9:05 PM, Karl DeSaulniers  
>>> wrote:
>>> Hello Everyone,
>>> Have a quick question. Was reading some material and wanted some Players 
>>> perspective.
>>> I know w3schools is not the de-facto on everything, so I wanted to know how 
>>> reliable is the information on this page.
>>> 
>>> http://www.w3schools.com/sql/sql_injection.asp
>>> 
>>> Namely the @ symbol before SQL Values and because this talks about SQL and 
>>> not MySQL specifically, does this not apply to MySQL?
>>> To my uneducated eyes it seems legit. Any clarification is greatly 
>>> appreciated.
>>> 
>>> TIA,
>>> 
>>> Best,
>>> 
>>> Karl DeSaulniers
>>> Design Drumm
>>> http://designdrumm.com
>>> 
>>> 
>>> 
>>> That is preferred in PHP as well. The SQL/MySQL isn't specifically doing 
>>> the replacement, but rather the driver object. Using parametrized queries:
>>> 
>>> http://php.net/manual/en/pdo.prepared-statements.php
>>> 
>> 
>> 
>> Thank you Aziz,
>> Interesting link, thank you for that. I have not worked with prepared 
>> statements on my own, just in WordPress.
>> 
>> So the @ symbol is a preferred method even outside the SQL world because?
>> 
>> What specifically is the @ symbol doing?
>> 
>> From what I read, and from what you just mentioned,
>> it's the PHP->SQL driver that check this @ symbol and treats the data as 
>> literal text?
>> Meaning it will not execute the text that comes after the @ symbol as code.


> 
> If I understand correctly it is not the @ symbol itself which is the thing 
> you should be looking at.  What you should be looking at is how your 
> programming language handles prepared statements.  What I see is that the @ 
> symbol is how ASP.Net defines the variable name, and also the variable 
> position.
> 
> I am not sure about this, but it looks like PHP uses : for the same function.
> 
> I am even less sure about this, but I think with prepared statements you can 
> also define what "type" of data is being passed.  So if you try to pass a 
> "string" (ie. something that cannot be converted to a number) to a "number" 
> defined variable, you will get an error thrown.  If you use a catch statement 
> that error can be handled by your code, rather than PHP handling it in 
> default manner.
> 
> It really has been a long time since I have been hands on with any of this, 
> and there is a good chance at least some of what I am saying is wrong.
> 
> The point of prepared statements is that what variables you are passing 
> through them, they are passed as literal values, rather than simply putting 
> them through as straight text put into your string you are passing to SQL.
> 
> Even if the string ends up "breaking" your query in a way that can harm 
> either security of data, or your database itself (also a security issue), it 
> is not passed in a way that SQL handles as such.
> 
> I discovered an issue on one of the web apps I used where I would get a SQL 
> error message if I entered certain strings into the input field. Even though 
> what I was doing wasn't at all trying to test for it, my inputs made it clear 
> what was going on.
> 
> With that amount of "what is going on" figured out.  I could send a 
> meaningful bug report that got this issue fixed.  Most people using the site 
> would have had no idea what was happening.
> 
> If I recall, I was putting a " or ' in my input, thus closing the string, 
> which then left the rest being interpreted as SQL code.



Thanks Jigme,

Ok, so understand my own situation, the method I have been using, mysqli real 
escape string is suffice?
Or is the @ symbol is the better preferred method?

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com










--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] SQL Injection

2015-05-14 Thread Karl DeSaulniers
On May 14, 2015, at 8:09 PM, Aziz Saleh  wrote:

> 
> 
> On Thu, May 14, 2015 at 9:05 PM, Karl DeSaulniers  
> wrote:
> Hello Everyone,
> Have a quick question. Was reading some material and wanted some Players 
> perspective.
> I know w3schools is not the de-facto on everything, so I wanted to know how 
> reliable is the information on this page.
> 
> http://www.w3schools.com/sql/sql_injection.asp
> 
> Namely the @ symbol before SQL Values and because this talks about SQL and 
> not MySQL specifically, does this not apply to MySQL?
> To my uneducated eyes it seems legit. Any clarification is greatly 
> appreciated.
> 
> TIA,
> 
> Best,
> 
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
> 
> 
> 
> That is preferred in PHP as well. The SQL/MySQL isn't specifically doing the 
> replacement, but rather the driver object. Using parametrized queries:
> 
> http://php.net/manual/en/pdo.prepared-statements.php  
> 


Thank you Aziz,
Interesting link, thank you for that. I have not worked with prepared 
statements on my own, just in WordPress.

So the @ symbol is a preferred method even outside the SQL world because?

What specifically is the @ symbol doing? 

From what I read, and from what you just mentioned,
it's the PHP->SQL driver that check this @ symbol and treats the data as 
literal text?
Meaning it will not execute the text that comes after the @ symbol as code.

Yes?

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



[PHP-DB] SQL Injection

2015-05-14 Thread Karl DeSaulniers
Hello Everyone,
Have a quick question. Was reading some material and wanted some Players 
perspective.
I know w3schools is not the de-facto on everything, so I wanted to know how 
reliable is the information on this page.

http://www.w3schools.com/sql/sql_injection.asp

Namely the @ symbol before SQL Values and because this talks about SQL and not 
MySQL specifically, does this not apply to MySQL?
To my uneducated eyes it seems legit. Any clarification is greatly appreciated.

TIA,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com





Re: [PHP-DB] Input Mathematical symbol in HTML textbox

2015-05-07 Thread Karl DeSaulniers
^ is the caret in ascii

Best,
Karl

Sent from losPhone

> On May 7, 2015, at 9:18 AM, Guru  wrote:
> 
> Hi All,
> 
> I need help with a tool I am developing for my client. What I want is, how
> can I type X^2 square or M Cube (M^3) in html text box. Is there any method
> I can follow. Also it should store in mysql database in same format. If I
> echo out the same variable it should print the same format. Thank you.
> 
> -- 
> 
> *Best,*
> 
> 
> 
> *Gu®uCEO & Founder at,www.skynetwebservices.in *

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Waiting for localhost

2015-04-02 Thread Karl DeSaulniers
My apology to the list. 

That was meant for Ethan's email only.
I hit reply all when I though I just hit reply.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



On Apr 2, 2015, at 2:18 PM, Karl DeSaulniers  wrote:

> Bro. Pick a SQL. mysql_ or mysqli_.
> 
> Best,
> Karl
> 
> Sent from losPhone

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Waiting for localhost

2015-04-02 Thread Karl DeSaulniers
Bro. Pick a SQL. mysql_ or mysqli_.

Best,
Karl

Sent from losPhone

> On Apr 2, 2015, at 12:48 PM, Ethan Rosenberg 
>  wrote:
> 
>> On 04/02/2015 06:17 AM, Richard wrote:
> 
> 
>>> Here are some hints
>>> 
>>> service apache2 restart
>>> [] Restarting web server: apache2AH00558: apache2: Could not
>>> reliably determine the server's fully qualified domain name, using
>>> 127.0.1.1. Set the 'ServerName' directive globally to suppress
>>> this message
>>> . ok
>>> 
>>> 
>>>   using 127.0.1.1 OUCH
>>> 
>>> Added this as last line in  /etc/apache2/apache2.conf
>>> 
>>> ServerName localhost
>>> 
>>> root@meow:/var/www# service apache2 restart
>>> [ ok ] Restarting web server: apache2
>>> 
>>> OK ...good
>>> 
>>> But ... I am still getting the same performance - TestConnect [the
>>> code above] gives the same result, and HandleWeight hangs!!!
>> 
>> As I pointed out on the apache list, 127.0.1.1 != localhost. It's
>> not clear where all you've stapled that incorrect value in at this
>> point, but that will account for why apache gave you that error.
>> 
>> In the php code, you are not handling the output from
>> mysqli_fetch_array correctly. Read the documentation, there are many
>> examples -- including q/a responses that almost exactly match your
>> code.
>> 
>> You have shown no debugging effort on "HandleWeight", so we have no
>> way of providing any insights on it.
>> 
>> You additionally need to provide the version/release level
>> information for your installed versions of:
>> 
>>   - OS
>>   - apache
>>   - mysql
>>   - php
> 
> Richard -
> 
> Thanks.
> 
> service Apache2 restart
> >> [] Restarting web server: apache2AH00558: apache2: Could not
> >> reliably determine the server's fully qualified domain name, using
> >> 127.0.1.1. Set the 'ServerName' directive globally to suppress
> >> this message
> 
> This is what was returned on a restart of Apache.
> 
> Modified the configuration file.
> 
> Added this as last line in  /etc/apache2/apache2.conf
> >>
> >> ServerName localhost
> 
> Now on a restart...
> 
> root@meow:/var/www# service apache2 restart
> >> [ ok ] Restarting web server: apache2
> 
> Fixed the mysqli_fetch_array.
> 
> OS Debian Jessie
> Apache/2.4.9 (Debian)
> MySQL  Ver 14.14 Distrib 5.5.37, for debian-linux-gnu (x86_64) using readline 
> 6.3
> PHP  5.6.0RC2 (cli)
> 
> Debug
> 
> Here is the connection block w/ debug.
> 
> $hostname="localhost";
> $database="Store";
> $username="ethan";
> $password="x";
> 
> 
> $link = mysqli_connect($hostname, $username, $password);
> if (!$link) {
> die('Connection failed: ' . mysqli_error());
> }
> else{
> echo "Connection to MySQL server " .$hostname . " successful!
> " . PHP_EOL;
> }
> 
> $db_selected = mysql_select_db( $link,$database);
> if (!$db_selected) {
>die ('Can\'t select database: ' . mysql_error());
> }
> else {
>echo 'Database ' . $database . ' successfully selected!';
> }
> 
> Never connects. Hangs
> 
> 
> TIA
> 
> Ethan
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Waiting for localhost

2015-04-01 Thread Karl DeSaulniers
Question to list, since I have not had to venture to the mysqli territory just 
yet, 
but is it proper to use mysql_error() with mysqli transactions?

This may be what your missing Ethan.
mysql_error() looks for a mysql_ transactions doesn't it?
Or are they interchangeable?

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



On Apr 1, 2015, at 10:35 PM, Ethan Rosenberg  
wrote:
>>> 
> 
> 
> Richard -
> 
> Thanks.
> 
> The problem is in the database connection.
> 
> from MySQL
> 
> mysql> show tables;
> +-+
> | Tables_in_Store |
> +-+
> | Charges |
> | Customers   |
> | Food|
> | Inventory   |
> | Orders  |
> | Purchases   |
> +-+
> 
> This code works...
> 
> $hostname="localhost";
> $database="Store";
> $username="ethan";
> $password="x";
> 
> 
> $link = mysqli_connect($hostname, $username, $password);
> if (!$link) {
> die('Connection failed: ' . mysql_error());
> }
> else{
> echo "Connection to MySQL server " .$hostname . " successful!
> " . PHP_EOL;
> }
> 
> $db_selected = mysqli_select_db($link, $database);
> if (!$db_selected) {
>die ('Can\'t select database: ' . mysql_error());
> }
> else {
>echo 'Database ' . $database . ' successfully selected!';
> }
> 
> $sql1 = "show tables";
> $result1 = mysqli_query($link, $sql1);
> $row1 = mysqli_fetch_array($result1);
>   echo 'row1';
>   print_r($row1);
> 
> BUT
> 
> The output is 
> 
> Connection to MySQL server localhost successful! Database Store successfully 
> selected!
> row1
> Array ( [0] => Charges [Tables_in_Store] => Charges )
> 
> What am I missing??
> 
> TIA
> 
> Ethan
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Waiting for localhost

2015-03-17 Thread Karl DeSaulniers
No, can't say I do.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



On Mar 17, 2015, at 11:48 PM, "Ethan Rosenberg, PhD" 
 wrote:

> Karl -
> 
> Thanks to you and all others that have replied.
> 
> With a little bit of patience [which I should have used previously], I reran 
> the the program both with form and with the JavaScript.  The program went to 
> the next step [handleweight] BUT it took 5 min or more.  So...Apache is slow. 
>  Any ideas??


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Waiting for localhost

2015-03-15 Thread Karl DeSaulniers
Is this a weight that is entered in by your friend or a weight that is grabbed 
from a database or a scale per chance?
If it is the latter, you don't need this form, just store the value some other 
way and incorporate into your other script that directs to this form.


Also, I noticed you spelt weight wrong.

> value= 'WEIGH'

Could that be it or just a keyboard error in your mail program?
Did you copy and paste that code?

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



On Mar 15, 2015, at 11:02 PM, Ethan Rosenberg  
wrote:

> 
> Jayson, Karl -
> 
> It could be a bad variable, or lack of access to an include file possibly? 
> Put some echo statements in right before and right after some major blocks of 
> code... It will help narrow down the problem since it will show you where 
> it's holding up. The. You can concentrate on fixing just that part instead of 
> the entire site.
> 
> Done that already.  No luck
> 
> Also, if it is a matter of calling this script.
> 
> I have this in the program  --
> 
> 
> echo "";
> echo " 'WEIGH'>";
> echo "";
> 
> I'm testing from a form, which previously worked perfectly -
> 
> TIA
> 
> Ethan

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Waiting for localhost

2015-03-15 Thread Karl DeSaulniers
Also, if it is a matter of calling this script.
Maybe try curl instead of echoing a javascript file?

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



On Mar 15, 2015, at 8:25 PM, Karl DeSaulniers  wrote:

> Why are you not calling a database for the weight? Or is that what the 
> handleweight.php does?
> If it is a matter of echoing the results from this page, can it's code be 
> merged into the current?
> Then instead of echoing the  you just echo the results.
> 
> Best,
> 
> Karl DeSaulniers
> Design Drumm
> <a  rel="nofollow" href="http://designdrumm.com">http://designdrumm.com</a>
> 
> 
> 
> On Mar 15, 2015, at 1:40 PM, Ethan Rosenberg 
> <erosenb...@hygeiabiomedical.com> wrote:
> 
>> On 03/15/2015 09:44 AM, Jason Pruim wrote:
>>> If you load up handleweight.php outside of the script does it load 
>>> normally? Trying to pin down where the actual problem is.
>>> 
>>> Jason Pruim
>>> 352.359.0002
>>> 
>>> 
>>> 
>>> 
>>>> On Mar 14, 2015, at 10:17 PM, Ethan Rosenberg 
>>>> <erosenb...@hygeiabiomedical.com> wrote:
>>>> 
>>>>> On 03/09/2015 08:27 AM, Ethan Rosenberg, PhD wrote:
>>>>>> On 03/09/2015 06:55 AM, Karl DeSaulniers wrote:
>>>>>> Don't know what to tell you bub.
>>>>>> Time for the books?
>>>>>> 
>>>>>> I "think" that it has to do with php parsing or not parsing the echo 
>>>>>> because its echoing a script.
>>>>>> Can't remember off the top, but along those lines I would search.
>>>>>> 
>>>>>> GL,
>>>>>> 
>>>>>> Best,
>>>>>> 
>>>>>> Karl DeSaulniers
>>>>>> Design Drumm
>>>>>> <a  rel="nofollow" href="http://designdrumm.com">http://designdrumm.com</a>
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> On Mar 8, 2015, at 10:11 PM, Ethan Rosenberg 
>>>>>>> <erosenb...@hygeiabiomedical.com> wrote:
>>>>>>> 
>>>>>>>> On 03/08/2015 09:30 PM, Karl DeSaulniers wrote:
>>>>>>>> Try...
>>>>>>>> window.location.href = "HandleWeight.php";
>>>>>>>> 
>>>>>>>> Sent from losPhone
>>>>>>>> 
>>>>>>>>>> On Mar 8, 2015, at 7:13 PM, Ethan Rosenberg 
>>>>>>>>>> <erosenb...@hygeiabiomedical.com> wrote:
>>>>>>>>>> 
>>>>>>>>>> On 03/08/2015 07:00 PM, Karl DeSaulniers wrote:
>>>>>>>>>> Sorry, missed a parenthesis.
>>>>>>>>>> 
>>>>>>>>>> if($row7[0] === 1)
>>>>>>>>>> {
>>>>>>>>>> echo('<script type="text/javascript">window.location = 
>>>>>>>>>> "HandleWeight.php";');
>>>>>>>>>> }
>>>>>>>>>> 
>>>>>>>>>> Best,
>>>>>>>>>> 
>>>>>>>>>> Karl DeSaulniers
>>>>>>>>>> Design Drumm
>>>>>>>>>> http://designdrumm.com <http://designdrumm.com/>
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> Begin forwarded message:
>>>>>>>>>> 
>>>>>>>>>>> *From: *Karl DeSaulniers >>>>>>>>>> <mailto:k...@designdrumm.com>>
>>>>>>>>>>> *Subject: **Re: [PHP-DB] Waiting for localhost*
>>>>>>>>>>> *Date: *March 8, 2015 5:58:29 PM CDT
>>>>>>>>>>> *To: *erosenb...@hygeiabiomedical.com 
>>>>>>>>>>> <mailto:erosenb...@hygeiabiomedical.com>
>>>>>>>>>>> 
>>>>>>>>>>> Try...
>>>>>>>>>>> 
>>>>>>>>>>> if($row7[0] === 1)
>>>>>>>>>>> {
>>>>>>>>>>> echo('window.location = 
>>>>>>>>>>> "HandleWeight.php";';

Re: [PHP-DB] Waiting for localhost

2015-03-15 Thread Karl DeSaulniers
Why are you not calling a database for the weight? Or is that what the 
handleweight.php does?
If it is a matter of echoing the results from this page, can it's code be 
merged into the current?
Then instead of echoing the  you just echo the results.

Best,

Karl DeSaulniers
Design Drumm
<a  rel="nofollow" href="http://designdrumm.com">http://designdrumm.com</a>



On Mar 15, 2015, at 1:40 PM, Ethan Rosenberg <erosenb...@hygeiabiomedical.com> 
wrote:

> On 03/15/2015 09:44 AM, Jason Pruim wrote:
>> If you load up handleweight.php outside of the script does it load normally? 
>> Trying to pin down where the actual problem is.
>> 
>> Jason Pruim
>> 352.359.0002
>> 
>> 
>> 
>> 
>>> On Mar 14, 2015, at 10:17 PM, Ethan Rosenberg 
>>> <erosenb...@hygeiabiomedical.com> wrote:
>>> 
>>>> On 03/09/2015 08:27 AM, Ethan Rosenberg, PhD wrote:
>>>>> On 03/09/2015 06:55 AM, Karl DeSaulniers wrote:
>>>>> Don't know what to tell you bub.
>>>>> Time for the books?
>>>>> 
>>>>> I "think" that it has to do with php parsing or not parsing the echo 
>>>>> because its echoing a script.
>>>>> Can't remember off the top, but along those lines I would search.
>>>>> 
>>>>> GL,
>>>>> 
>>>>> Best,
>>>>> 
>>>>> Karl DeSaulniers
>>>>> Design Drumm
>>>>> <a  rel="nofollow" href="http://designdrumm.com">http://designdrumm.com</a>
>>>>> 
>>>>> 
>>>>> 
>>>>>> On Mar 8, 2015, at 10:11 PM, Ethan Rosenberg 
>>>>>> <erosenb...@hygeiabiomedical.com> wrote:
>>>>>> 
>>>>>>> On 03/08/2015 09:30 PM, Karl DeSaulniers wrote:
>>>>>>> Try...
>>>>>>> window.location.href = "HandleWeight.php";
>>>>>>> 
>>>>>>> Sent from losPhone
>>>>>>> 
>>>>>>>>> On Mar 8, 2015, at 7:13 PM, Ethan Rosenberg 
>>>>>>>>> <erosenb...@hygeiabiomedical.com> wrote:
>>>>>>>>> 
>>>>>>>>> On 03/08/2015 07:00 PM, Karl DeSaulniers wrote:
>>>>>>>>> Sorry, missed a parenthesis.
>>>>>>>>> 
>>>>>>>>> if($row7[0] === 1)
>>>>>>>>> {
>>>>>>>>> echo('<script type="text/javascript">window.location = 
>>>>>>>>> "HandleWeight.php";');
>>>>>>>>> }
>>>>>>>>> 
>>>>>>>>> Best,
>>>>>>>>> 
>>>>>>>>> Karl DeSaulniers
>>>>>>>>> Design Drumm
>>>>>>>>> http://designdrumm.com <http://designdrumm.com/>
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Begin forwarded message:
>>>>>>>>> 
>>>>>>>>>> *From: *Karl DeSaulniers >>>>>>>>> <mailto:k...@designdrumm.com>>
>>>>>>>>>> *Subject: **Re: [PHP-DB] Waiting for localhost*
>>>>>>>>>> *Date: *March 8, 2015 5:58:29 PM CDT
>>>>>>>>>> *To: *erosenb...@hygeiabiomedical.com 
>>>>>>>>>> <mailto:erosenb...@hygeiabiomedical.com>
>>>>>>>>>> 
>>>>>>>>>> Try...
>>>>>>>>>> 
>>>>>>>>>> if($row7[0] === 1)
>>>>>>>>>> {
>>>>>>>>>> echo('window.location = 
>>>>>>>>>> "HandleWeight.php";';
>>>>>>>>>> }
>>>>>>>>>> 
>>>>>>>>>> Best,
>>>>>>>>>> 
>>>>>>>>>> Karl DeSaulniers
>>>>>>>>>> Design Drumm
>>>>>>>>>> http://designdrumm.com
>>>>>>>> Karl -
>>>>>>>> 
>>>>>>>> Thanks.
>>>>>>>> 
>>>>>>>> The === avoids the infinite loop, but the call to the script is never 
>

Re: [PHP-DB] Waiting for localhost

2015-03-14 Thread Karl DeSaulniers
Fresh out of ideas. Sorry Ethan.
Maybe try an different approach to calling that file?
Seems like your trying to fit a square peg in a hexagon hole.
Might get it in there but it wont be a perfect fit.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



On Mar 14, 2015, at 9:17 PM, Ethan Rosenberg  
wrote:

> On 03/09/2015 08:27 AM, Ethan Rosenberg, PhD wrote:
>> On 03/09/2015 06:55 AM, Karl DeSaulniers wrote:
>>> Don't know what to tell you bub.
>>> Time for the books?
>>> 
>>> I "think" that it has to do with php parsing or not parsing the echo 
>>> because its echoing a script.
>>> Can't remember off the top, but along those lines I would search.
>>> 
>>> GL,
>>> 
>>> Best,
>>> 
>>> Karl DeSaulniers
>>> Design Drumm
>>> http://designdrumm.com
>>> 
>>> 
>>> 
>>> On Mar 8, 2015, at 10:11 PM, Ethan Rosenberg 
>>>  wrote:
>>> 
>>>> On 03/08/2015 09:30 PM, Karl DeSaulniers wrote:
>>>>> Try...
>>>>> window.location.href = "HandleWeight.php";
>>>>> 
>>>>> Sent from losPhone
>>>>> 
>>>>>> On Mar 8, 2015, at 7:13 PM, Ethan Rosenberg 
>>>>>>  wrote:
>>>>>> 
>>>>>>> On 03/08/2015 07:00 PM, Karl DeSaulniers wrote:
>>>>>>> Sorry, missed a parenthesis.
>>>>>>> 
>>>>>>> if($row7[0] === 1)
>>>>>>> {
>>>>>>> echo('window.location = 
>>>>>>> "HandleWeight.php";');
>>>>>>> }
>>>>>>> 
>>>>>>> Best,
>>>>>>> 
>>>>>>> Karl DeSaulniers
>>>>>>> Design Drumm
>>>>>>> http://designdrumm.com <http://designdrumm.com/>
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> Begin forwarded message:
>>>>>>> 
>>>>>>>> *From: *Karl DeSaulniers >>>>>>> <mailto:k...@designdrumm.com>>
>>>>>>>> *Subject: **Re: [PHP-DB] Waiting for localhost*
>>>>>>>> *Date: *March 8, 2015 5:58:29 PM CDT
>>>>>>>> *To: *erosenb...@hygeiabiomedical.com 
>>>>>>>> <mailto:erosenb...@hygeiabiomedical.com>
>>>>>>>> 
>>>>>>>> Try...
>>>>>>>> 
>>>>>>>> if($row7[0] === 1)
>>>>>>>> {
>>>>>>>> echo('window.location = 
>>>>>>>> "HandleWeight.php";';
>>>>>>>> }
>>>>>>>> 
>>>>>>>> Best,
>>>>>>>> 
>>>>>>>> Karl DeSaulniers
>>>>>>>> Design Drumm
>>>>>>>> http://designdrumm.com
>>>>>> Karl -
>>>>>> 
>>>>>> Thanks.
>>>>>> 
>>>>>> The === avoids the infinite loop, but the call to the script is never 
>>>>>> executed.
>>>>>> 
>>>>>> TIA
>>>>>> 
>>>>>> Ethan
>>>>> 
>>>> 
>>>> Karl -
>>>> 
>>>> Thanks.
>>>> 
>>>> No improvement.
>>>> 
>>>> TIA
>>>> 
>>>> Ethan
>>> 
>> -
>> Karl -
>> 
>> Thanks.
>> 
>> We all run up against brick walls.
>> 
>> Anybody else have ideas?
>> 
>> TIA.
>> 
>> Ethan
>> 
>> 
> Karl -
> 
> Thanks.
> 
> Here are some debug info.  Hope it helps.
> 
> root@meow:/home/ethan/BluBev# apache2 -S
> [Fri Mar 13 00:19:23.651029 2015] [core:warn] [pid 21435] AH00111: Config 
> variable ${APACHE_LOCK_DIR} is not defined
> [Fri Mar 13 00:19:23.651100 2015] [core:warn] [pid 21435] AH00111: Config 
> variable ${APACHE_PID_FILE} is not defined
> [Fri Mar 13 00:19:23.651117 2015] [core:warn] [pid 21435] AH00111: Config 
> variable ${APACHE_RUN_USER} is not defined
> [Fri Mar 13 00:19:23.651124 2015] [core:warn] [pid 21435] AH00111: Config 
> variable ${APACHE_RUN_GROUP} is not defined
> [Fri Mar 13 00:19:23.651142 2015] [core:warn] [pid 21435] AH00111: Config 
> variable ${APACHE_LOG_DIR} is not defined
> [Fri Mar 13 00

Re: [PHP-DB] Code Security

2015-02-13 Thread Karl DeSaulniers
And in the same way, don't let him withdraw money from your account while your 
logged into the ATM. I mean it sounds like mr. Nice shouldn't have a business. 
At all. 

Best,
Karl

Sent from losPhone

> On Feb 13, 2015, at 8:17 AM, "Arneson, Joshua"  
> wrote:
> 
> Ethan,
> 
>It seems like you're looking for a programmatic solution to a physical 
> security problem. In the end, your most viable solution will likely be to 
> train Mr. Goodguy to remove the key the same way he needs to remember his ATM 
> card after a withdrawal. I've seen programmatic work-arounds to solve similar 
> issues, but they have always ended up being significantly arduous for the end 
> users...
> 
> Respectfully,
>  
> Joshua D. Arneson
> 
> -Original Message-
> From: Ethan Rosenberg [mailto:erosenb...@hygeiabiomedical.com] 
> Sent: Friday, February 13, 2015 9:12 AM
> To: php-db@lists.php.net
> Subject: Re: [PHP-DB] Code Security
> 
>> On 02/13/2015 02:58 AM, Karl DeSaulniers wrote:
>> Prevent THIS from ever happening.
>> 
>>> On Feb 12, 2015, at 11:03 PM, Ethan Rosenberg 
>>>  wrote:
>>> 
>>> He asks Mr.[naive]Nice if he could look at the computer while it is logged 
>>> in.
>> 
>> 
>> Otherwise, I would say an external key that has a salt stored on it that the 
>> user has to insert in the computer before the system can be accessed.
>> Like an access key card. Immediate shut down when tampered and/or removed.
>> 
>> Just a stab in the dark though.
>> 
>> Best,
>> 
>> Karl DeSaulniers
>> Design Drumm
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__designdrumm.com&d=
>> AwIC-g&c=4R1YgkJNMyVWjMjneTwN5tJRn8m8VqTSNCjYLg1wNX4&r=pRBqy2P3JaV_0yI
>> qjAsPRpV2yZymYr9X5J_0Y74t654&m=kIedOn0p3VGnUZ1gfYdWWnG5241UJdD7tnYY_Ju
>> HC18&s=ig7LiGzP4X2ZJJMrsq4695g43cu8ghuBAAdEq6F3jrY&e=
> ---
> 
> Karl -
> 
> Thanks.
> 
> The key is already plugged in.  Mr [Naive] Nice is using the computer, and is 
> logged in.  Mr. Ugly just want to "look at" the computer.
> 
> Ethan
> 
> 
> 
> --
> PHP Database Mailing List 
> (https://urldefense.proofpoint.com/v2/url?u=http-3A__www.php.net_&d=AwIC-g&c=4R1YgkJNMyVWjMjneTwN5tJRn8m8VqTSNCjYLg1wNX4&r=pRBqy2P3JaV_0yIqjAsPRpV2yZymYr9X5J_0Y74t654&m=kIedOn0p3VGnUZ1gfYdWWnG5241UJdD7tnYY_JuHC18&s=saaG6YC7fWss2eAYUsXw7GU0vdZKj74Uz3iVA1Enu40&e=
>  ) To unsubscribe, visit: 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.php.net_unsub.php&d=AwIC-g&c=4R1YgkJNMyVWjMjneTwN5tJRn8m8VqTSNCjYLg1wNX4&r=pRBqy2P3JaV_0yIqjAsPRpV2yZymYr9X5J_0Y74t654&m=kIedOn0p3VGnUZ1gfYdWWnG5241UJdD7tnYY_JuHC18&s=b2pGut3zlmECebRRBhfyRBYokCPeQHk8ZPkcdNA2RzQ&e=
>  
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Re: Code Security

2015-02-13 Thread Karl DeSaulniers
Set up a password or a salt that Mr. Nice has to call you to get and expires on 
logout.  

Lol

Best,
Karl


Sent from losPhone

> On Feb 13, 2015, at 8:47 AM, erosenb...@hygeiabiomedical.com wrote:
> 
> 
> Ethan,
> It seems like you're looking for a programmatic solution to a physical
> security problem. In the end, your most viable solution will likely
> be to train Mr. Goodguy to remove the key the same way he needs to
> remember his ATM card after a withdrawal. I've seen programmatic
> work-arounds to solve similar issues, but they have always ended up
> being significantly arduous for the end users...
> Respectfully,
> Joshua D. Arneson
> -Original Message-From: Ethan Rosenberg
> [mailto:erosenb...@hygeiabiomedical.com] Sent: Friday, February 13,
> 2015 9:12 AMTo: php...@lists.php.netSubject: Re: [PHP-DB] Code
> Security
> On 02/13/2015 02:58 AM, Karl DeSaulniers wrote:> Prevent THIS from
> ever happening.>> On Feb 12, 2015, at 11:03 PM, Ethan Rosenberg
> wrote:>>> He asks Mr.[naive]Nice if he could look at the computer
> while it is logged in.>>> Otherwise, I would say an external key that
> has a salt stored on it that the user has to insert in the computer
> before the system can be accessed.> Like an access key card. Immediate
> shut down when tampered and/or removed.>> Just a stab in the dark
> though.>> Best,>> Karl DeSaulniers> Design Drumm
> Karl -
> Thanks.
> The key is already plugged in. Mr [Naive] Nice is using the computer,
> and is logged in. Mr. Ugly just want to "look at" the computer.
> Ethan--
> Joshua -
> My apologies for an HTML message.  That is all I have at work.
> 
> How about this -
> Block access to Ctrl-Alt-Del for Mr. Nice. 
> TIA
> Ethan
> 
> 

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Code Security

2015-02-12 Thread Karl DeSaulniers
Prevent THIS from ever happening.

On Feb 12, 2015, at 11:03 PM, Ethan Rosenberg  
wrote:

> He asks Mr.[naive]Nice if he could look at the computer while it is logged in.


Otherwise, I would say an external key that has a salt stored on it that the 
user has to insert in the computer before the system can be accessed. 
Like an access key card. Immediate shut down when tampered and/or removed.

Just a stab in the dark though. 

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] MySQLi

2014-09-15 Thread Karl DeSaulniers
On Sep 15, 2014, at 11:51 AM, Jasper Kips  wrote:

> 
> 
>> Op 15 sep. 2014 om 01:08 heeft Karl DeSaulniers  het 
>> volgende geschreven:
>> 
>> Procedural php. Haven't had a chance to learn OOP. Would love to though. : /
>> I think I may be moling it a bit too. Guess I was hoping for an easy fix, 
>> don't judge me.. :P
>> Thanks for all your responses everyone. 
>> 
>> Best,
>> 
>> Karl DeSaulniers
>> Design Drumm
>> http://designdrumm.com
>> 
>> 
>> 
>>> On Sep 14, 2014, at 2:48 AM, Lester Caine  wrote:
>>> 
>>>> On 14/09/14 04:57, Karl DeSaulniers wrote:
>>>> Awesome, thanks for the link. I know even less about PDO then I do regular 
>>>> MySQL however.
>>>> I am hoping MySQLi isn't too far off a shoot. Just need to sit down with 
>>>> it all and figure out a path.
>>> 
>>> PDO is still a bit of a grey area. It was intended to make changes
>>> between database engines more transparent, and MySQL to MySQLi is
>>> essentially just a different front end both targeting MySQL. The problem
>>> is that it only ever did half the job, trying to make the data returned
>>> 'transparent' while ignoring the SQL. Aziz's approach is one way of
>>> going, but just like the e_strict problems with PHP itself, it's the
>>> subtle changes to the language used which cause problems when
>>> 'translating' from one to the other. It will depend on the style of
>>> MySQL you are using currently as to how easy it is to 'translate'. My
>>> own database is Firebird which has SQL functions that have yet to appear
>>> in MySQL, some of those are exposed in MySQLi so you can ignore them
>>> when upgrading but it is always those fringe cases that take the most
>>> time to resolve? :(
>>> 
>>> -- 
>>> Lester Caine - G8HFL
>> 
>> 
>> 
>> 
>> -- 
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
> 
> Problem with easy fixes is that they lead to tremendous problems. Best is to 
> take the more difficult road, it'll be way quicker.
> Yup off topic I know
> 
> Jasper
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


Truth. Thanks.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] MySQLi

2014-09-14 Thread Karl DeSaulniers
Procedural php. Haven't had a chance to learn OOP. Would love to though. : /
I think I may be moling it a bit too. Guess I was hoping for an easy fix, don't 
judge me.. :P
Thanks for all your responses everyone. 

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



On Sep 14, 2014, at 2:48 AM, Lester Caine  wrote:

> On 14/09/14 04:57, Karl DeSaulniers wrote:
>> Awesome, thanks for the link. I know even less about PDO then I do regular 
>> MySQL however.
>> I am hoping MySQLi isn't too far off a shoot. Just need to sit down with it 
>> all and figure out a path.
> 
> PDO is still a bit of a grey area. It was intended to make changes
> between database engines more transparent, and MySQL to MySQLi is
> essentially just a different front end both targeting MySQL. The problem
> is that it only ever did half the job, trying to make the data returned
> 'transparent' while ignoring the SQL. Aziz's approach is one way of
> going, but just like the e_strict problems with PHP itself, it's the
> subtle changes to the language used which cause problems when
> 'translating' from one to the other. It will depend on the style of
> MySQL you are using currently as to how easy it is to 'translate'. My
> own database is Firebird which has SQL functions that have yet to appear
> in MySQL, some of those are exposed in MySQLi so you can ignore them
> when upgrading but it is always those fringe cases that take the most
> time to resolve? :(
> 
> -- 
> Lester Caine - G8HFL




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] MySQLi

2014-09-13 Thread Karl DeSaulniers
Awesome, thanks for the link. I know even less about PDO then I do regular 
MySQL however.
I am hoping MySQLi isn't too far off a shoot. Just need to sit down with it all 
and figure out a path.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



On Sep 13, 2014, at 10:52 PM, Aziz Saleh  wrote:
> 
> I am not sure about any MySQL -> MySQLI wrappers, but I did built a MySQL -> 
> PDO Wrapper a while back that you can use if you have PDO_MySQL enabled:
> 
> https://github.com/azizsaleh/mysql



Re: [PHP-DB] MySQLi

2014-09-13 Thread Karl DeSaulniers
On Sep 13, 2014, at 7:40 AM, Lester Caine  wrote:

> On 13/09/14 11:40, Karl DeSaulniers wrote:
>> Hope this message finds you well. Quick question about MySQLi and PHP.
>> I have a website that was built back in 2012 that is still on PHP 5.2 and 
>> MySQL 
>> and I am wanting to update it to PHP 5.7 with MySQLi without headaches.
>> I am dreading this like a spoonful of molasses. Is there any sugar remedy 
>> for this medicine 
>> or do I just grow a pair and take it?
> 
> Well a few problems 5ere ...
> PHP5.2 had already been shelved at end of 2010, but I know why it was
> probably used 2 years later. I'm STILL running 5.2 on servers as the
> time needed to convert those sites is just not available and can't be
> justified cost wise :(
> 
>> Any MySQL => MySQLi converters out there?
>> Any PHP5.2 => PHP 5.7 cheat sheets?
>> 
>> If I update my server to PHP 5.7 is everything going to break? Or stupid 
>> question of course it is?
> PHP5.7 will not be around any time soon, PHP5.6 has just been released.
> But converting from 5.2 all the way to 5.6 is not something that is easy
> to do. I'm still only moving 5.2 to 5.4 at presnt.
> 
> http://php.net/manual/en/migration53.php and
> http://php.net/manual/en/migration54.php is the starting point, but
> things depricated in 5.3 were removed in 5.4 so if you are using any of
> those methods then they need removing. You can switch the later PHP
> servers to ignore e_strict warning/errors, but this is the major problem
> area. and really the only way to move forward is clear all of those
> problems before moving forward. Unless you caa ensure your server will
> always be switched bak to a compatible mode of working.
> 
> And all that before even looking at MySQL ... I've never used it, so
> hopefully someone else will cover that side.
> 
> -- 
> Lester Caine - G8HFL

Ah, I see. Now Glob Design's comment makes sense. 
Thanks Lester.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] MySQLi

2014-09-13 Thread Karl DeSaulniers
Hello All,
Hope this message finds you well. Quick question about MySQLi and PHP.
I have a website that was built back in 2012 that is still on PHP 5.2 and MySQL 
and I am wanting to update it to PHP 5.7 with MySQLi without headaches.
I am dreading this like a spoonful of molasses. Is there any sugar remedy for 
this medicine 
or do I just grow a pair and take it?

Any MySQL => MySQLi converters out there?
Any PHP5.2 => PHP 5.7 cheat sheets?

If I update my server to PHP 5.7 is everything going to break? Or stupid 
question of course it is?
lol

TIA,
Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com





Re: [PHP-DB] Number of Lines in Table.

2014-09-02 Thread Karl DeSaulniers
On Sep 3, 2014, at 12:13 AM, Karl DeSaulniers  wrote:
>> 
>> 
>>> Dear List -
>>> 
>>> This works:
>>> 
>>> mysql> describe Purchases;
>>> +---+-+--+-+-++
>>> | Field | Type| Null | Key | Default | Extra  |
>>> +---+-+--+-+-++
>>> | indx  | smallint(6) | NO   | PRI | NULL| auto_increment |
>>> | manf  | varchar(20) | YES  | | NULL||
>>> | itm   | varchar(50) | YES  | | NULL||
>>> | prc   | float   | YES  | | NULL||
>>> +---+-+--+-+-++
>>> 4 rows in set (0.00 sec)
>>> 
>>> What is my error?
>>> 
>>> TIA
>>> 
>>> Ethan



Just for a little redemption.. :) 
I think this is what your looking for Ethan. 

http://stackoverflow.com/questions/5060366/mysql-fastest-way-to-count-number-of-rows

SELECT SQL_CALC_FOUND_ROWS [itm] FROM Purchases LIMIT 50 OFFSET 0;
SELECT FOUND_ROWS();


It says that FOUND_ROWS() has to be called immediately after the data selecting 
query.

HTH,
Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Number of Lines in Table.

2014-09-02 Thread Karl DeSaulniers
I see. Ok thanks Matt. Will look into that if I start working with those size 
databases.
My apology Ethan, wasn't aware of the scope.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



On Sep 3, 2014, at 12:09 AM, Matt Pelmear  wrote:

> Karl,
> 
> This works for small datasets, but when you have a large amount of data 
> (either in terms of storage or row count) it is no longer practical.
> This is why people typically use the SQL row count instead of transferring 
> all of the data to php and doing the work there. It is much more efficient.
> (You may wish to read about buffered vs unbuffered queries)
> 
> Matt
> 
> On Sep 2, 2014 9:57 PM, "Karl DeSaulniers"  wrote:
> On Sep 2, 2014, at 9:37 PM, Ethan Rosenberg  
> wrote:
> 
> > Dear List -
> >
> > This works:
> >
> > mysql> describe Purchases;
> > +---+-+--+-+-++
> > | Field | Type| Null | Key | Default | Extra  |
> > +---+-+--+-+-++
> > | indx  | smallint(6) | NO   | PRI | NULL| auto_increment |
> > | manf  | varchar(20) | YES  | | NULL||
> > | itm   | varchar(50) | YES  | | NULL||
> > | prc   | float   | YES  | | NULL||
> > +---+-+--+-+-++
> > 4 rows in set (0.00 sec)
> >
> > What is my error?
> >
> > TIA
> >
> > Ethan
> 
> Hi Ethan,
> Is it terribly important for you to get the count from MySQL?
> Php does a nice job of this very easily.
> 
> $sql = "SELECT itm FROM Purchases";
> 
> $result = mysqli_query($cxn, $sql);
> 
> if (!mysqli_query($cxn, $sql27))
>printf("Errormessage: %s\n", mysqli_error($cxn));
> 
> if(!$result || (mysql_numrows($result) < 1)){
> return NULL;
> }
> /* Return result array */
> $rowarray = mysqli_fetch_array($result);
> $numrows = count($rowarray);
> 
> //return $rowarray;
> 
> print_r('Number of rows: '.$numrows);
> print_r('Results { '.$row.' }');
> 
> Haven't tested this, but I believe it should work out the box. May need to 
> tweek to taste.
> HTH,
> 
> Best,
> 
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
> 
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



Re: [PHP-DB] Number of Lines in Table.

2014-09-02 Thread Karl DeSaulniers
Whoops, this should be..

print_r('Results { '.$rowarray.' }');

Karl DeSaulniers
Design Drumm
http://designdrumm.com



On Sep 2, 2014, at 11:57 PM, Karl DeSaulniers  wrote:

> print_r('Results { '.$row.' }');


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Number of Lines in Table.

2014-09-02 Thread Karl DeSaulniers
On Sep 2, 2014, at 9:37 PM, Ethan Rosenberg  
wrote:

> Dear List -
> 
> This works:
> 
> mysql> describe Purchases;
> +---+-+--+-+-++
> | Field | Type| Null | Key | Default | Extra  |
> +---+-+--+-+-++
> | indx  | smallint(6) | NO   | PRI | NULL| auto_increment |
> | manf  | varchar(20) | YES  | | NULL||
> | itm   | varchar(50) | YES  | | NULL||
> | prc   | float   | YES  | | NULL||
> +---+-+--+-+-++
> 4 rows in set (0.00 sec)
> 
> What is my error?
> 
> TIA
> 
> Ethan

Hi Ethan,
Is it terribly important for you to get the count from MySQL?
Php does a nice job of this very easily.

$sql = "SELECT itm FROM Purchases";

$result = mysqli_query($cxn, $sql);

if (!mysqli_query($cxn, $sql27))
   printf("Errormessage: %s\n", mysqli_error($cxn));

if(!$result || (mysql_numrows($result) < 1)){
return NULL;
}
/* Return result array */
$rowarray = mysqli_fetch_array($result);
$numrows = count($rowarray);

//return $rowarray;

print_r('Number of rows: '.$numrows);
print_r('Results { '.$row.' }');

Haven't tested this, but I believe it should work out the box. May need to 
tweek to taste.
HTH,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] www-data file

2014-08-25 Thread Karl DeSaulniers
On Aug 25, 2014, at 11:20 PM, Ethan Rosenberg  
wrote:

> Dear list -
> 
> When I use  fopen, the  file owner and group are both www-data.
> 
> How can I ensure that the owner and group will be ethan?
> 
> TIA
> 
> Ethan

Are we talking about file permissions?

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] What is my Mistake?

2014-06-24 Thread Karl DeSaulniers
On Jun 24, 2014, at 2:53 AM, Karl DeSaulniers  wrote:

> On Jun 24, 2014, at 2:46 AM, Karl DeSaulniers  wrote:
> 
>> On Jun 24, 2014, at 12:27 AM, Ethan Rosenberg 
>>  wrote:
>> 
>>> Dear List -
>>> 
>>> I know I have a mistake here, but I cannot find it.
>>> 
>>> This is a part of a switch.
>>> 
>>> The switch is fed with a formatted phone number [123-456-7890], which is 
>>> then tested for validity, and if valid the results of the query are 
>>> displayed.  I cannot get to the display part.
>>> 
>>> Here is the code:
>> 
>> ...
>>> 
>>> 
>>> TIA
>>> 
>>> Ethan
>>> 
>> 
>> Hi Ethan,
>> Try this. I did it on the fly and haven't tested, but I think it will put 
>> you on the right path.
>> You most likely will have to put your own juice on $return_string. 
>> I tried to follow as best as I could to the type of output your wanting.
>> HTH.
>> 
>> [CODE]
>> 
>> switch (step) {
>>  case 'step28':
>>  $return_string = 'Here we are, Step 28';
>>  $Phone = "";
>>  $phn = $_POST['phone'];
>>  $dsh = '-';
>>  $i = 0;
>>  while($i < strlen($phn)) {
>>  if($i === 2 || $i === 6) {
>>  $Phone .= $phn[$i].$dsh;
>>  } else {
>>  $Phone .= $phn[$i];
>>  }
>>  $i++;
>>  }
>>  $sql1 ="SELECT Cust_Num, Lname, Fname FROM Customers WHERE Phone = 
>> '".mysqli_real_escape_string($Phone)."' ";
>>  $result1 = mysqli_query($cxn, $sql1);
>>  $return_string .= 'here2';  
>> 
>>  if ( 0 === $result1->num_rows ) {   
>>  $return_string = '> style="margin-bottom:32px;">No Match Found';
>>  } else {
>>  $return_string .= 'here3';
>>  $return_string .= 'result.  '.$result1;
>>  $result = 0;
>>  $return_string .= '
>>  > frame="box">
>>  
>>  Cust. Number
>>  Last Name
>>  First Name
>>  '; 
>>  $row1 = mysqli_fetch_row($result1); 
>>  while($row1) {
>>  $return_string .= '
>>      '.htmlspecialchars($row1[0]).'
>>  '.htmlspecialchars($row1[1]).'
>>  '.htmlspecialchars($row1[2]).'
>>  ';
>>  }
>>  }
>>  $return_string .= '';
>>  break;
>> }
>> 
>> [END CODE]
>> 
>> Best,
>> 
>> Karl DeSaulniers
>> Design Drumm
>> http://designdrumm.com
> 
> Oh and you might have to check if $i is equal to the string length to get the 
> 10th number.
> So swap this part.
> 
> 
> while($i < strlen($phn)) {
> 
> 
> with this...
> 
> 
> while($i <= strlen($phn)) {
> 
> 
> Thought of it after the fact.. sorry.
> 
> Best,
> 
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com

Also Ethan,
Here are some links I'd like to share with you which I think if you peruse 
through these, 
will give you a better understanding on, 

one: how to protect the database

http://us2.php.net//manual/en/mysqli.real-escape-string.php


two: how to display the data from that database.

http://www.php.net//manual/en/function.htmlspecialchars.php

Both are pretty quick reads and will give you more familiarity with what your 
working on I believe.
I noticed you never use these and IMO they are essential to good database 
programming.
HTH,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com

PS: Others may have a better way then I, but this was a quick throw together. 
Forgive me if it isn't 100% on the money.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] What is my Mistake?

2014-06-24 Thread Karl DeSaulniers
On Jun 24, 2014, at 2:46 AM, Karl DeSaulniers  wrote:

> On Jun 24, 2014, at 12:27 AM, Ethan Rosenberg 
>  wrote:
> 
>> Dear List -
>> 
>> I know I have a mistake here, but I cannot find it.
>> 
>> This is a part of a switch.
>> 
>> The switch is fed with a formatted phone number [123-456-7890], which is 
>> then tested for validity, and if valid the results of the query are 
>> displayed.  I cannot get to the display part.
>> 
>> Here is the code:
> 
> ...
>>  
>> 
>> TIA
>> 
>> Ethan
>> 
> 
> Hi Ethan,
> Try this. I did it on the fly and haven't tested, but I think it will put you 
> on the right path.
> You most likely will have to put your own juice on $return_string. 
> I tried to follow as best as I could to the type of output your wanting.
> HTH.
> 
> [CODE]
> 
> switch (step) {
>   case 'step28':
>   $return_string = 'Here we are, Step 28';
>   $Phone = "";
>   $phn = $_POST['phone'];
>   $dsh = '-';
>   $i = 0;
>   while($i < strlen($phn)) {
>   if($i === 2 || $i === 6) {
>   $Phone .= $phn[$i].$dsh;
>   } else {
>   $Phone .= $phn[$i];
>   }
>   $i++;
>   }
>   $sql1 ="SELECT Cust_Num, Lname, Fname FROM Customers WHERE Phone = 
> '".mysqli_real_escape_string($Phone)."' ";
>   $result1 = mysqli_query($cxn, $sql1);
>   $return_string .= 'here2';  
> 
>   if ( 0 === $result1->num_rows ) {   
>   $return_string = ' style="margin-bottom:32px;">No Match Found';
>   } else {
>   $return_string .= 'here3';
>   $return_string .= 'result.  '.$result1;
>   $result = 0;
>   $return_string .= '
>frame="box">
>   
>   Cust. Number
>   Last Name
>   First Name
>   '; 
>   $row1 = mysqli_fetch_row($result1); 
>   while($row1) {
>   $return_string .= '
>   '.htmlspecialchars($row1[0]).'
>   '.htmlspecialchars($row1[1]).'
>   '.htmlspecialchars($row1[2]).'
>   ';
>   }
>   }
>   $return_string .= '';
>   break;
> }
> 
> [END CODE]
> 
> Best,
> 
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com

Oh and you might have to check if $i is equal to the string length to get the 
10th number.
So swap this part.


while($i < strlen($phn)) {


with this...


while($i <= strlen($phn)) {


Thought of it after the fact.. sorry.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] What is my Mistake?

2014-06-24 Thread Karl DeSaulniers
On Jun 24, 2014, at 12:27 AM, Ethan Rosenberg  
wrote:

> Dear List -
> 
> I know I have a mistake here, but I cannot find it.
> 
> This is a part of a switch.
> 
> The switch is fed with a formatted phone number [123-456-7890], which is then 
> tested for validity, and if valid the results of the query are displayed.  I 
> cannot get to the display part.
> 
> Here is the code:

...
>   
> 
> TIA
> 
> Ethan
> 

Hi Ethan,
Try this. I did it on the fly and haven't tested, but I think it will put you 
on the right path.
You most likely will have to put your own juice on $return_string. 
I tried to follow as best as I could to the type of output your wanting.
HTH.

[CODE]

switch (step) {
case 'step28':
$return_string = 'Here we are, Step 28';
$Phone = "";
$phn = $_POST['phone'];
$dsh = '-';
$i = 0;
while($i < strlen($phn)) {
if($i === 2 || $i === 6) {
$Phone .= $phn[$i].$dsh;
} else {
$Phone .= $phn[$i];
}
$i++;
}
$sql1 ="SELECT Cust_Num, Lname, Fname FROM Customers WHERE Phone = 
'".mysqli_real_escape_string($Phone)."' ";
$result1 = mysqli_query($cxn, $sql1);
$return_string .= 'here2';  

if ( 0 === $result1->num_rows ) {   
$return_string = 'No Match Found';
} else {
$return_string .= 'here3';
$return_string .= 'result.  '.$result1;
$result = 0;
$return_string .= '


Cust. Number
Last Name
First Name
'; 
$row1 = mysqli_fetch_row($result1); 
while($row1) {
$return_string .= '
'.htmlspecialchars($row1[0]).'
'.htmlspecialchars($row1[1]).'
'.htmlspecialchars($row1[2]).'
';
}
}
$return_string .= '';
break;
}

[END CODE]

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] VAR_DUMP INTO PHP VARIABLES

2014-06-18 Thread Karl DeSaulniers


Sent from losPhone

> On Jun 19, 2014, at 12:40 AM, Oriole Computing  
> wrote:
> 
> dear List,
> 
> we have the following var_dump output from a soap response
> 
> array(1) {
>  ["return"]=>
>  array(3) {
>["responseCode"]=>
>string(1) "3"
>["responseMessage"]=>
>string(39) "Duplicate RequestID, Transaction failed"
>["transactionID"]=>
>string(21) "104454061823201453721"
>  }
> }
> 
> 
> could you advise us how we can get responseCode, responseMessage and
> transactionID into individual php variables?
> 
> Warm Regards
> 
> 
> 
> *SUPPORT TEAMORIOLE COMPUTING*
> 
> *1938 B1 MUNGWI ROAD*
> 
> *LUSAKAZAMBIA*
> 
> *Skype:* oriolecomputing | *Url:* oriolecomputing.blogspot.com
> 

Don't know if this will answer but may put you on the right path. 

http://stackoverflow.com/questions/16697616/getting-value-from-soap-response-in-php

Best,
Karl
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Newbie Question $2

2014-06-18 Thread Karl DeSaulniers


Sent from losPhone

> On Jun 18, 2014, at 7:56 AM, Jim Giner  wrote:
> 
>> On 6/18/2014 12:31 AM, Ethan Rosenberg, PhD wrote:
>>> On 06/17/2014 12:02 PM, onatawah...@yahoo.ca wrote:
>>> Hi Ethan,
>>> 
>>> Here are some things to clean up your code:
>>> 
>>> Your line:
>>> 
>>> $phn = $_POST[phone];
>>> 
>>> should use quotations as follows:
>>> 
>>> $phn = $_POST['phone'];
>>> 
>>> Your line:
>>> 
>>> $sql1 ='select Lname, Fname from Customers where Phone = $Phn ';
>>> 
>>> Should use double quotes if you need the variable to be interpreted:
>>> 
>>> $sql1 ="select Lname, Fname from Customers where Phone = $Phn ";
>>> 
>>> Lastly, as people have mentioned PDO is probably the best way to go.
>>> Try connecting to your database with PDO. Look on Google for "PDO
>>> prepared statements" and use those instead of the mysql escape string
>>> method.
>>> 
>>> Hope this helps,
>>> 
>>> -Kevin
>>> 
>>> Sent from Yahoo Mail on Android
>> IT WORKS!!!
>> 
>> Here is the code -
>> 
>> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
>> http://www.w3.org/1999/xhtml";>
>> 
>> 
>> >   $bla = 1;
>> ?>
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> > error_reporting(-1);
>> require '/home/ethan/PHP/ethan.inc';
>> $db = "Store";
>> $cxn = mysqli_connect($host,$user,$password,$db);
>> 
>> $phn = $_POST[phone];
>> $phn = (string)$phn;
>> $dsh = '-';
>> $Phn =
>> $phn[0].$phn[1].$phn[2].$dsh.$phn[3].$phn[4].$phn[5].$dsh.$phn[6].$phn[7].$phn[8].$phn[9];
>> 
>> $sql1 ="select Lname, Fname from Customers where Phone =
>> '$Phn' ";
>> $result1 = mysqli_query($cxn, $sql1);
>> if(!$result)
>> {
>> ?>
>> 
>> 
>> No Match Found
>> 
>> 
>> > }
>> 
>> ?>
>> 
>> > rules="all" frame="box">
>> 
>> Last Name
>> First Name
>> > 
>> while($row1 = mysqli_fetch_row($result1))
>> {
>> 
>> $Lname = $row1[0];
>> $Fname = $row1[1];
>> 
>> 
>> 
>> ?>  
>>   
>>   
>> 
>> >   }
>> ?>
>>   
>> >
>> 
>> 
>> 
>> As you [those that replied] accurately noted, the problem was with the
>> quoting.
>> 
>> I appreciate all your comments, take them seriously and will use the
>> information contained in them for future programming.
>> 
>> No matter how much skill in programming I have, I will remain a NEWBIE;
>> ie, someone who wishes to grrow in knowledge and acknowledges that there
>> are many programmers much more skilled than I.
>> 
>> Thanks again.
>> 
>> Ethan
> happy to hear you got it working.  Sad to see that you didn't heed the tips 
> provided to you and alter your code, and that you still have errors in it.  
> oh, well
> 

Wow. Just wow. I though when I signed up on this list that if I did what Ethan 
did I would be shunned from the list. But I guess I was wrong. You can be an 
ask hole on here and people will still try and help. Kudos to the good souls 
who try. 

Karl
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Newbie Question $2

2014-06-16 Thread Karl DeSaulniers
On Jun 16, 2014, at 10:05 PM, Karl DeSaulniers  wrote:

> On Jun 16, 2014, at 9:58 PM, Ethan Rosenberg 
>  wrote:
> 
>> Dear List -
>> 
>> I have the following code:
>> 
>> The input from the form is a 10 digit string [1234567890] which is converted 
>> to phone number format [123-456-7890]
>> 
>> $phn = $_POST[phone];
>> $phn = (string)$phn;
>> $dsh = '-';
>> $Phn = 
>> $phn[0].$phn[1].$phn[2].$dsh.$phn[3].$phn[4].$phn[5].$dsh.$phn[6].$phn[7].$phn[8].$phn[9];
>>  
>>   echo $Phn; // this is folded by Thunderbird.  In the script, it is //all 
>> on one line
>> 
>>   mysql_real_escape_string($Phn);
>>   $sql1 ='select Lname, Fname from Customers where Phone = $Phn ';
>>   echo $sql1; //this always shows $phn as Phn and not as a numerical 
>> //string.
>>   $result1 = mysqli_query($cxn, $sql1);
>> 
>> TIA
>> 
>> Ethan
>> 
> 
> Well, from first glance you're combining mysql and mysqli. 
> Don't know if that is wise or permissible since I think mysql has been 
> depreciated. 
> Go with mysqli. Next you may want to try...
> 
> $sql1 = 'SELECT Lname, Fname FROM Customers WHERE Phone = '.$Phn;
> 
> Best,
> 
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
> 

Also, you may want to store the number in your database without the dash and 
just apply the dash when displaying the number in HTML.
Not that this is entirely necessary, more of a personal choice. 
If you have a large number of phone numbers stored lets say, 
numbers with no dash take up less space in the grand scheme of things I guess.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Newbie Question $2

2014-06-16 Thread Karl DeSaulniers
On Jun 16, 2014, at 9:58 PM, Ethan Rosenberg  
wrote:

> Dear List -
> 
> I have the following code:
> 
> The input from the form is a 10 digit string [1234567890] which is converted 
> to phone number format [123-456-7890]
> 
> $phn = $_POST[phone];
> $phn = (string)$phn;
> $dsh = '-';
> $Phn = 
> $phn[0].$phn[1].$phn[2].$dsh.$phn[3].$phn[4].$phn[5].$dsh.$phn[6].$phn[7].$phn[8].$phn[9];
>  
>echo $Phn; // this is folded by Thunderbird.  In the script, it is //all 
> on one line
> 
>mysql_real_escape_string($Phn);
>$sql1 ='select Lname, Fname from Customers where Phone = $Phn ';
>echo $sql1; //this always shows $phn as Phn and not as a numerical 
> //string.
>$result1 = mysqli_query($cxn, $sql1);
> 
> TIA
> 
> Ethan
> 

Well, from first glance you're combining mysql and mysqli. 
Don't know if that is wise or permissible since I think mysql has been 
depreciated. 
Go with mysqli. Next you may want to try...

$sql1 = 'SELECT Lname, Fname FROM Customers WHERE Phone = '.$Phn;

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com
> 


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] MS Access Connection with database password

2014-06-06 Thread Karl DeSaulniers
I think the code you translated might be for the .accdb file. In your 
translated code I noticed .mdb so per that page, this apples for .mdb

With database password (mdb file)
This is the connection string to use when you have an Access 97 - 2003 database 
protected with a password using the "Set Database Password" function in Access.
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccessFile.mdb;
Jet OLEDB:Database Password=MyDbPassword;
Some reports of problems with password longer than 14 characters. Also that 
some characters might cause trouble. If you are having problems, try change 
password to a short one with normal characters. 


Sent from losPhone

> On Jun 6, 2014, at 1:27 PM, "Kjell Hansen"  wrote:
> 
> Hi again,
> It's an Access 2000 database and I've changed the password to a single a, 
> still no show :(
> 
> The database is downloaded on a regular basis and I need to extract some data 
> from it, so I have no control over version or password.
> 
> Thanks a lot
> /Kjell
> 
> "Richard Quadling"  skrev i meddelandet 
> news:CAKUjMCWXJfFvC_0vKq7Y4_QX-4mLumE=TOU4_v+s=yjspzq...@mail.gmail.com...
> 
> Did you read the notes regarding password length, password content and
> Access version issues?
> 
> Do any of these apply to you?
> 
> I suspect one of them does.
> 
> 
>> On 4 June 2014 21:48, Kjell Hansen  wrote:
>> 
>> Hi,
>> I'm trying to connect to a MS Access database that has a database password
>> set.
>> According to http://www.connectionstrings.com/access/ you use the
>> folowing as a connection string in such cases:
>> Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccessFile.accdb;
>> Jet OLEDB:Database Password=MyDbPassword;
>> 
>> Which I translate into
>> $dbcon = new PDO( 'odbc:Driver={Microsoft Access Driver
>> (*.mdb)};DBQ=C:\\exampledb.mdb;Jet OLEDB:Database Password=MyDbPassword;'
>> );
>> But it doesn't work :(
>> When I have removed the password, there's no problem connecting but not
>> with password set.
>> 
>> I don't make the database, it's maintained elsewhere and I plan to
>> download it regularly and extract data from it so I need to connect to the
>> database with the password set.
>> 
>> Any help or hints are deeply appreciated!
>> /Kjell
>> 
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> -- 
> Richard Quadling
> Twitter : @RQuadling
> EE : http://e-e.com/M_248814.html
> Zend : http://bit.ly/9O8vFY 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


Re: [PHP-DB] Subject Matter

2013-08-26 Thread Karl DeSaulniers

On Aug 26, 2013, at 11:19 AM, Michael Stowe wrote:

> *"There are a lot of off topic emails sent. But there is far more whining
> and
> **complaining. Good grief!"
> 
> +1*
> 
> Let's remember that not everyone on the list is an expert programmer or
> someone with years of DBA experience.  The purpose of the list (IMHO) is to
> HELP others with their PHP/DB questions, or at least point them in the
> right direction so that they can continue to learn and grow.  This is one
> thing I have commended the PHP community for, their willingness to INCLUDE
> people and be patient with newbies.  Sure there are going to be off-topic
> conversations, questions that get proposed to the wrong list, etc - heck
> I'm guilty of it myself.
> 
> But quite frankly (haven't had my coffee, be warned), if you're going to
> complain that not every message on the list meets your specific standards,
> then you're in the wrong place.  Add some filters to your mailbox, or
> better yet, jump in and help out instead of complaining that "your needs"
> aren't being met.
> 
> Just my two cents...
> 
> - Mike
> 
> ps - if you look on php.net it clearly says this list is NOT moderated...


+1

...and to add to that, to request that a list that is set up to help people 
only send you messages "you" deem appropriate is... how do I say.. a little 
selfish.
Now, if you want to throw out the random rant about off topic conversations in 
hopes that it sinks into these newbies and that some day they too will trim the 
conversations down to the brass tax, then by all means vent away.. in 
retrospect, they need to hear this. Just don't go threatening to abandon the 
same thing you came to for help. JMO.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Bluefish for PHP

2013-08-23 Thread Karl DeSaulniers
Komodo is very nice.

Karl DeSaulniers
Design Drumm
http://designdrumm.com



On Aug 23, 2013, at 2:58 AM, Michael Oki wrote:

> Install Komodo IDE or Adobe Dreamweaver. They'll highlight errors and
> warnings.
> 
> 
> On 23 August 2013 08:20, Lester Caine  wrote:
> 
>> Ethan Rosenberg wrote:
>> 
>>> Dear List -
>>> 
>>> How do I configure Bluefish for PHP?  I am running version 2.2.4 of
>>> Bluefish.
>>> 
>> 
>> I'd forgotten about bluefish. You should not need to do anything. PHP
>> files are just processed as PHP? But it's more an HTML editor and geared to
>> producing and verifying HTML so not as good when editing code. My Eclipse
>> setup does a very similar job on the html/js and css so I've not used it in
>> many years. I don't think the colour selections were very good if memory
>> serves.
>> 
>> --
>> Lester Caine - G8HFL
>> -
>> Contact - 
>> http://lsces.co.uk/wiki/?page=**contact<http://lsces.co.uk/wiki/?page=contact>
>> L.S.Caine Electronic Services - http://lsces.co.uk
>> EnquirySolve - http://enquirysolve.com/
>> Model Engineers Digital Workshop - http://medw.co.uk
>> Rainbow Digital Media - 
>> http://rainbowdigitalmedia.co.**uk<http://rainbowdigitalmedia.co.uk>
>> 
>> 
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
>> 


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Re: mysql query

2013-08-23 Thread Karl DeSaulniers
If your on a PC I would just get Eclipse. But if you have netbeans, you can set 
the syntax highlighting for the different scripts you write in the preferences. 
PHP, java, javascript, etc...

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Re: One query, different tables?

2013-08-09 Thread Karl DeSaulniers
Probably with separate queries I would say. Query store 1, move to truck then 
query truck and move to store 2.

Best,
Karl

Sent from losPhone

On Aug 9, 2013, at 10:13 AM, Jim Giner  wrote:

> On 8/9/2013 10:56 AM, Karl-Arne Gjersøyen wrote:
>> Hello.
>> I am newbie in this and need som basic help.
>> 
>> I have a form witch checkbox'es with different serialnumbers.
>> The serialnumbers reflect different products and every product category
>> have their own tables.
>> 
>> I can transfer items from store to truck but can't transfer them back to
>> store.
>> I have 4 stores and like to transfer products between this.
>> 
>> I like to to it like this:
>> store_one -> truck_document -> store_two
>> 
>> But how can I transfer both Dynamite and Exan in one query to their
>> respective tables? (One table is named exan and the other dynamite.)
>> 
>> Thank you very much for your help.
>> 
>> I have been searching google but can't find anything about this question.
>> 
>> Karl
> This makes no sense.  How are we supposed to help you with just this to go on?
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with query

2013-06-25 Thread Karl DeSaulniers
Im going to play devils advocate here and say, why is it the one who's helping 
that needs to be polite and respectful? Isn't it also the newbies 
responsibility to respect and be polite to those taking time out of their day 
to help them and not be so stubborn as to not take the advice given which has 
been the example given here by Ethan? Ethan has been given great advice and 
should be taking that advice and looking things up and learning, not asking 
"Newbie confused, please explain?". It seems to me that the "Help" is being 
taken advantage of here and used as a crutch to get the work done that Ethan 
has taken upon himself even thought he knows he knows very little about 
programming in PHP. And that is PHP not PhD. But all that aside as you can see, 
the same people who Ethan has somewhat ignored their advice are still going 
against their better judgement to go out of their way to help.. again. Just how 
much help should be given before you realize the horse is just not drinking the 
water? I am all for Ethan getting help from the list and I don't want to 
chastise, but come on, someone with a PhD should know better and should know 
even better then most on how to listen and learn. Hence the PhD. You don't get 
one of those by doing what Ethan is doing. If he did that to his professors, he 
would have failed. Just saying.

Best,
Karl


On Jun 25, 2013, at 1: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". 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 "session"; //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 mision

Re: [PHP-DB] Placing a form on a page

2013-05-06 Thread Karl DeSaulniers
I would suggest googling your problem. In this case "centering an HTML form".

Hth,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com




On May 6, 2013, at 12:00 AM, Ethan Rosenberg, PhD wrote:

> 
> On 05/06/2013 12:48 AM, tamouse mailing lists wrote:
>> On Sun, May 5, 2013 at 11:22 PM, Ethan Rosenberg, PhD
>>   wrote:
>>> Dear List -
>>> I apologize if I offended some of you. I will see that it does not repeat.
>>> I am trying to center a form on the top of a page. Here is the form:
>> 
>> What you're asking about has nothing to do with PHP.
>> 
>> You want help with HTML and CSS, and front-end design.
>> 
>> 
> 
> 
> You are absolutely correct.  I meant to label the post as HTML - Placing a 
> form on a page.
> 
> My logic was that a PHP programmer will know HTML.
> 
> If you are aware of a HTML/CSS mailing list, kit would be appreciated.
> 
> If anyone on the list would be able to answer my question, it would also be 
> appreciated.
> 
> Ethan
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Saving Image in mySQL

2013-03-20 Thread Karl DeSaulniers

Ron,
If your hell bent on storing the image data. :P
I would say base64 the data and use a blob or text
then read it out using something like..

$image = '';
echo($image);

I would also say your individual image max size should be 50k or less.
If your storing product images for a catalog for instance, dont store  
image data, use the url instead.
If its ui images for a couple of web pages, then storing the image  
data wouldn't be a bad thing.

As long as the total size for all of your images is reasonable.
Your call.

Best,
Karl


On Mar 19, 2013, at 6:11 PM, Karl DeSaulniers wrote:


Hey Ron,
I don't know how others feel, but I say save yourself a headache and  
dont store the image data, just the url to the image on the server.


image_url – VARCHAR 100

Best,
Karl



On Mar 19, 2013, at 3:15 PM, Ron Piggott wrote:



Hi All
I don’t understand how to save an image to a mySQL table based on  
the following form. I am trying to do this using Prepared  
Statements.  All the fields except the image file itself save in  
the database.  Right now I have $file as the variable when binding  
the values.  What should it be?  Ron


===

Filename:



===

mySQL table structure:
===
reference – INT 10 auto_increment primary
caption – VARCHAR 250
image_type – VARCHAR 100
image_size – INT 10
image_name – VARCHAR 100
image – LONGBLOB
===

Prepared Statement:

===
# mySQL query

  $query = "INSERT INTO `my_images` ( `reference` , `caption` ,  
`image_type` , `image_size` , `image_name` , `image` ) VALUES  
( NULL 
 , :caption , :image_type , :image_size , :image_name , :image );";


# apply query to Prepared Statement

  if($stmt = $dbh->prepare( $query )) {

# bind variables

  $stmt->bindValue(':caption', 'Test Caption', PDO::PARAM_STR);
  $stmt->bindValue(':image_type', $_FILES["file"]["type"],  
PDO::PARAM_STR);
  $stmt->bindValue(':image_size', $_FILES["file"]["size"],  
PDO::PARAM_INT);
  $stmt->bindValue(':image_name', $_FILES["file"]["name"],  
PDO::PARAM_STR);

  $stmt->bindValue(':image', $file, PDO::PARAM_STR);

# execute query

  if ( $stmt->execute() or die(print_r($stmt->errorInfo(),  
true)) ) {


# retrieve auto_increment value

  $new_record_reference = $dbh->lastInsertId();

  }

  }
===


Ron Piggott



www.TheVerseOfTheDay.info


Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Saving Image in mySQL

2013-03-19 Thread Karl DeSaulniers

Hey Ron,
I don't know how others feel, but I say save yourself a headache and  
dont store the image data, just the url to the image on the server.


image_url – VARCHAR 100

Best,
Karl



On Mar 19, 2013, at 3:15 PM, Ron Piggott wrote:



Hi All
I don’t understand how to save an image to a mySQL table based on  
the following form. I am trying to do this using Prepared  
Statements.  All the fields except the image file itself save in the  
database.  Right now I have $file as the variable when binding the  
values.  What should it be?  Ron


===

Filename:



===

mySQL table structure:
===
reference – INT 10 auto_increment primary
caption – VARCHAR 250
image_type – VARCHAR 100
image_size – INT 10
image_name – VARCHAR 100
image – LONGBLOB
===

Prepared Statement:

===
# mySQL query

   $query = "INSERT INTO `my_images` ( `reference` , `caption` ,  
`image_type` , `image_size` , `image_name` , `image` ) VALUES  
( NULL 
 , :caption , :image_type , :image_size , :image_name , :image );";


# apply query to Prepared Statement

   if($stmt = $dbh->prepare( $query )) {

# bind variables

   $stmt->bindValue(':caption', 'Test Caption', PDO::PARAM_STR);
   $stmt->bindValue(':image_type', $_FILES["file"]["type"],  
PDO::PARAM_STR);
   $stmt->bindValue(':image_size', $_FILES["file"]["size"],  
PDO::PARAM_INT);
   $stmt->bindValue(':image_name', $_FILES["file"]["name"],  
PDO::PARAM_STR);

   $stmt->bindValue(':image', $file, PDO::PARAM_STR);

# execute query

   if ( $stmt->execute() or die(print_r($stmt->errorInfo(),  
true)) ) {


# retrieve auto_increment value

   $new_record_reference = $dbh->lastInsertId();

   }

   }
===


Ron Piggott



www.TheVerseOfTheDay.info


Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] My Comments

2013-02-21 Thread Karl DeSaulniers


On Feb 21, 2013, at 3:08 PM, Ethan Rosenberg, PhD wrote:


Dear List -

Correction

William N. Lipscomb, Jr.

Ethan


Dear List -

I feel, and correct me if I am wrong, that a list as this or  
similar, should be devoted to help and not sarcasm.  I try to be  
quiet and to not "toot my horn", but as events have progressed, I  
feel I must.


As you all know, I have a PhD. It is in Chemistry.  The thesis is a  
mathematical approximation to the solution of the "three body  
system", using the Helium atom as a model. The thesis is 300 pages:  
150 of Mathematics and 150 of FORTRAN.


Graduate students are known to ask stupid questions, and I had my  
share of them.


In the course of the research I needed help, both in quantum  
mechanics and mathematics. As I was close to Boston, MA, I sought  
out help from MIT and Harvard from:


Prof. William J Lipscomb, Nobel Prize in Chemistry, (1976)
http://en.wikipedia.org/wiki/William_Lipscomb
He placed his research group at my disposal..

and

Prof. Richard Courant, director of what is now the Courant Institute  
of Mathematical Sciences <http://en.wikipedia.org/wiki/Courant_Institute_of_Mathematical_Sciences 
> at New York University.

http://en.wikipedia.org/wiki/Richard_Courant
http://en.wikipedia.org/wiki/ 
Courant_Institute_of_Mathematical_Sciences
On a visit to MIT, he graciously gave me help with some mathematics  
I needed for my thesis.


Neither of them told me to read my books and stop bothering them  
with such trivia. They were helpful, gracious and gently pointed out  
my errors


My two cents.

Ethan


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Ethan,
A few suggestions to you at this point.
From your post, I myself can tell your HTML is wrong. Fix your html  
to show the correct way.
Then make sure your javascript and PHP are separated correctly  
according to language standards and how they are to be sectioned  
within the HTML.
Then try the previous suggested work arounds and if those don't work,  
then submit a shortened version of your post.
Once people see that your going to "go along to get along", they may  
be more app to help you with your issues.
No one really cares about what you know or what degree you have  
outside web development. Your here asking for help with things you  
obviously DO NOT have a degree in.
The people here really do want to help you, believe it or not. But  
they are not going to help tout your ego or continue to butt heads  
with a stubborn person.
They'll just let it alone and let you fend for yourself. Just a  
suggestion, all sarcasm aside.


Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] My Comments

2013-02-21 Thread Karl DeSaulniers

On Feb 21, 2013, at 3:08 PM, Ethan Rosenberg, PhD wrote:


Dear List -

Correction

William N. Lipscomb, Jr.

Ethan


Dear List -

I feel, and correct me if I am wrong, that a list as this or  
similar, should be devoted to help and not sarcasm.  I try to be  
quiet and to not "toot my horn", but as events have progressed, I  
feel I must.


As you all know, I have a PhD. It is in Chemistry.  The thesis is a  
mathematical approximation to the solution of the "three body  
system", using the Helium atom as a model. The thesis is 300 pages:  
150 of Mathematics and 150 of FORTRAN.


Graduate students are known to ask stupid questions, and I had my  
share of them.


In the course of the research I needed help, both in quantum  
mechanics and mathematics. As I was close to Boston, MA, I sought  
out help from MIT and Harvard from:


Prof. William J Lipscomb, Nobel Prize in Chemistry, (1976)
http://en.wikipedia.org/wiki/William_Lipscomb
He placed his research group at my disposal..

and

Prof. Richard Courant, director of what is now the Courant Institute  
of Mathematical Sciences <http://en.wikipedia.org/wiki/Courant_Institute_of_Mathematical_Sciences 
> at New York University.

http://en.wikipedia.org/wiki/Richard_Courant
http://en.wikipedia.org/wiki/ 
Courant_Institute_of_Mathematical_Sciences
On a visit to MIT, he graciously gave me help with some mathematics  
I needed for my thesis.


Neither of them told me to read my books and stop bothering them  
with such trivia. They were helpful, gracious and gently pointed out  
my errors


My two cents.

Ethan


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Ethan,
Yes but this is the websphere.
Things are done differently here in that respect.
We are not getting paid to listen to your problems.
It is out of respect for the open source community that we all do this.
That being said, there is an amount of etiquette you will have to  
learn on your own or by people not wanting to help you as a newbie  
poster here.


I know this because on my very first post I got practically yelled at.
It will get better with time if you learn how to listen and how to  
take the approach of not asking every time you have a problem,
but more so research the heck out of your problem first and do as much  
as you can on your own.


Ever heard of the teddy bear technique?

The other thing about building web pages is the fact that it is  
basically a language your learning.
So like me trying to ask directions in spanish, you may not get very  
far if you don't learn the basics of the languages people speak here  
IE: PHP, HTML, etc...


GL 2 U,

Best,

Karl DeSaulniers
Associates in Visual Communications (Graphic Design)
Self Taught HTML, CSS, Javascript, Ajax, JQuery, XML, PHP and MySQL   
toot toot!

Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Re: Processing Account Login

2013-02-07 Thread Karl DeSaulniers

Ron, got you covered.. ;)

This is a good script to start from. May be exactly what you need to  
build yours around.
Worked for me. You will have to study up on securing your info and  
make adjustments where needed.


https://github.com/ivannovak/jpmaster77-s-Login-System-

Best,
Karl


On Feb 7, 2013, at 10:14 AM, Jim Giner wrote:


On 2/6/2013 8:01 PM, Ron Piggott wrote:

Hi Everyone

When I login to PayPal a total of 3 web pages are used:

1 – A screen for the user to type in their user name & password
2 – A screen saying “ Logging in “*
3 – My Welcome / Personalized Account Summary Screen

* During the 2nd web page my PHP script is going to be accessing  
the mySQL database to check the login credentials.



- I would like to know how this is done
- I would like to know how to re-direct the user to a “incorrect  
password” screen if this is the case
- I would like to know how to re-direct to a “security question”  
screen as a secondary step for those users who want this additional  
security (such as what I am offered through my online banking sign  
in process)


I don’t know what an effective search query is on Google.  I don’t  
mind (nor will I take offense) on being directed to a tutorial.  I  
want to ensure what I am putting into production is high quality  
and not hap hazard.


Thank you for any help you are able to provide me with.


Ron Piggott


www.TheVerseOfTheDay.info

There are so many MANY ways of accomplishing this, it's hard to  
begin. Since you seem to be unaware of this whole process, I imagine  
the simple, most-straight forward way would be the best.


YOu can do this with one script - if you are not wanting to be too  
fancy.


Upon first call - you display the login page and wait for a submit  
button to call your script again.


Upon the second call you gather the inputs and validate them,  
returning error messages if they are not present or not in the  
proper formats.  If inputs are acceptable, per se, then you perform  
your db check and respond accordingly (failure message or success  
message with a different target in your  tag). The output from  
this second call can be the same as the first call's if there's an  
error, or completely different if success was achieved - just change  
what html you send to the client.


If you want to prompt them for a security question before checking  
the database, that is just as easy.  In the "second call" you send  
back a different set of html prompting the user for the answer to  
the question that you display.  Then you do the above paragraph as  
the "third" call.  Of course you need to store the inputs received  
somewhere - probably not in hidden field, but rather session vars.   
On the third call you collect the answer to the question, the  
session vars with the uid and pswd, and then do the db check.


As I said - you can do this with one script.  You simply have  
different chunks of html that your script outputs, depending upon  
the step you are in.  That 'step' is some indicator of your making  
that you hide in the html so that your script knows where it is in  
the conversation with the user.  You also have different chunks of  
php code to handle the different steps.


Piece of cake!

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Query will not work - SOLVED

2013-02-02 Thread Karl DeSaulniers
$sql13 = "UPDATE `Customers` SET `Lname` = 'Barnet',  `City` =  
'Lakewood',  `State` = 'NJ' WHERE `Cust_Num` = 1089";


$result13 = mysqli_query($cxn, $sql13);

if(mysqli_num_rows($result13)> 0)
{
  $row_cnt = mysqli_num_rows($result13);
  echo "row count result13 is $row_cnt";
}

else
{
echo "Ouch result13";
}

mysqli_free_result($result13);

$sql1 = "select * FROM `Customers` ORDER BY `Cust_Num`";

$result1 = mysqli_query($cxn, $sql1);

if(mysqli_num_rows($result1)> 0)
{
$row_cnt = mysqli_num_rows($result1);
echo "Row count result1 is $row_cnt";
}

else
{
echo "Ouch result1";
}

Try that..

Best,
Karl


On Feb 2, 2013, at 8:08 PM, Ethan Rosenberg, PhD wrote:


I  must be missing something fundamental!!

Here is a code snippet:

$sql13 = " UPDATE Customers SET Lname = 'Barnet',  City =  
'Lakewood',  State = 'NJ' WHERE Cust_Num = 1089";


$result13 = mysqli_query($cxn, "UPDATE Customers SET Lname =  
'Bleich',  City = 'Lakewood',  State = 'NJ' WHERE Cust_Num = 1089");


if($row_cnt = mysqli_num_rows($result13)!= 0)
{
  $row_cnt = mysqli_num_rows($result13);
  echo "row count result13 is $row_cnt";
}

else
{
echo "Ouch result13";
}

mysqli_free_result($result13);

$sql1 = "select Cust_Num, Fname, Lname, Street, City, State, Zip,  
Phone, Notes from Customers order by Cust_Num";


$result1 = mysqli_query($cxn, $sql1);

if($row_cnt = mysqli_num_rows($result1)!= 0)
{
$row_cnt = mysqli_num_rows($result1);
echo "Row count result1 is $row_cnt";
}

else
{
echo "Ouch result1";
}

Here are my results:


Ouch result13

Row count result1 is 45

What am I doing wrong??

Ethan
=


I was using the "worker@localhost", which did not have the Update  
privilege. Added the privilege that, and everything worked.


Sorry for bothering you with trivia.

Ethan



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] pdo ?

2013-01-24 Thread Karl DeSaulniers


On Jan 24, 2013, at 2:15 PM, Matt Pelmear wrote:


On 01/24/2013 12:00 PM, Jim Giner wrote:

On 1/24/2013 1:41 PM, Richard Quadling wrote:

On 24 January 2013 17:48, Matt Pelmear  wrote:

On 01/24/2013 09:23 AM, Jim Giner wrote:


On 1/24/2013 12:05 PM, Matt Pelmear wrote:



http://stackoverflow.com/questions/5801951/does-php-auto-escapes-quotes-in-string-which-is-passed-by-get-or-post


Every pro has this feature (magic_quotes_gpc) turned off. If you
understand SQL Injection vulnerabilities, and properly bind  
things into

your queries, I would recommend disabling it.

-Matt

On 01/24/2013 08:55 AM, Jim Giner wrote:


ok - new to using pdo functions, but I thought I had a handle  
on it.


I'm writing out to my page an input tag with the following  
value in it:


49'ers

I can confirm it by using my browser's "view source" to see  
that is

exactly how it exists in the page.

When I hit a submit button and my script retrieves the 'post'  
vars my
debugging steps are showing that the var $_POST['team']  
contains the
above value with a backslash (\) already inserted. This is  
causing me
a problem when I then try to use pdo->quote to safely encode  
it for

updating my sql database.

My question is - why does the POST var show the \ char before I
execute the 'quote' function?




You're right!  But I must not understand something.

My root folder has a php.ini file with the magic quotes set off.  
Doesn't

that carry on down to folders beneath it?



I would check phpinfo() to see if it is being overridden.

-Matt


Create an info.php file containing ...


Matt & Rich,

I have a small php.ini in my domain's  'php' folder as well as in  
my webroot folder. I was under the impression that the overrides  
would be applied to all folders below my webroot, but apparently it  
is not happening.


How do 'pros' replicate their .ini settings thru all of the  
application folder?  Not thru settings within the scripts I hope -  
I thought I read that the was not a very efficient way to do it and  
that a php.ini file was the best since it would be merged with the  
master one installed by my hoster.




Jim,

Personally I rarely have the need to override the php.ini settings  
for a particular host on a server. (Granted I never work in shared  
servers)
Assuming you are using Apache and the standard module configuration,  
you can use .htaccess files to override many settings from php.ini


Official reference pages:
http://php.net/manual/en/configuration.changes.php  (you might want  
to read through the comments here, too)

http://httpd.apache.org/docs/current/howto/htaccess.html

Example and some discussion here as well:
http://davidwalsh.name/php-values-htaccess

If you are using another web server or running PHP as FastCGI you  
may need to consider other options (changing the setting globally or  
doing a require_once() of your config changes?, or see the FastCGI  
example here: http://www.askapache.com/php/php-htaccess-tips-tricks.html)


-Matt

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




You could just check for it with php and add or strip accordingly.

adding slashes if magic_quotes is disabled:

if (!get_magic_quotes_gpc()) {
$var = addslashes($var);
}

stripping slashes if magic_quotes is enabled and your planning on  
sanitizing yourself.


if (get_magic_quotes_gpc()) {
$var = stripslashes($var);
//do your own sanitizing
}

I wouldn't suggest the last one if your not going to sanitize yourself  
as it will make you vulnerable.

But all-in-all very simple to implement.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Re: SQL syntax

2013-01-15 Thread Karl DeSaulniers
True, I guess it never hurts to try. Busy making orders and hadn't  
tested just yet.
I just wanted a professional opinion on if the syntax was common to  
use, mostly.
Didn't want to get a Jr PHP job and use it and have everyone looking  
at me sideways.. :P


Thanks all,

Best,
Karl

On Jan 15, 2013, at 6:47 AM, Bastien wrote:


Try It And See

Bastien Koert

On 2013-01-15, at 7:43 AM, Karl DeSaulniers   
wrote:




On Jan 15, 2013, at 5:31 AM, David Robley wrote:


Karl DeSaulniers wrote:


Hello Everyone,
Hope your 2013 is treating you well.
Quick question and apologies if it is a stupid question.
Is this a viable syntax?

$sql = "SELECT orderid
FROM ORDERS_TABLE
WHERE orderstatus = 'Cancelled' OR (orderstatus = ('New' OR
'Denied' OR 'Expired' OR 'Failed' OR 'Pending' OR 'Refunded' OR
'Reversed' OR 'Under Review' OR 'Voided') AND orderdate <
'".mysqli_real_escape_string($yesterday)."')";

Namely the orderstatus = (a whole bunch of options).
In my database `orderstatus` field is an enum() list btw.
Or is there a better way to check multiple options against an enum
inside your select statement?
Reason I am doing this is to avoid having to do...

$sql = "SELECT orderid
FROM ORDERS_TABLE
WHERE orderstatus = 'Cancelled' OR (orderstatus = 'New'  AND
orderdate < '".mysqli_real_escape_string($yesterday)."') OR
(orderstatus = 'Denied'  AND orderdate <
'".mysqli_real_escape_string($yesterday)."') OR (orderstatus =
'Expired'  AND orderdate <
'".mysqli_real_escape_string($yesterday)."') ... etc";

TIA,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


The best way to check if your SQL query is valid is to feed it to  
mysql
which will return an error if the syntax is incorrect :-) So TIAS!  
Although

it looks wrong to me.

But you might try the IN operator - something like

OR (orderstatus IN ('New', 'Denied', 'Expired', 'Failed', 'Pending',
'Refunded', 'Reversed', 'Under Review', 'Voided') AND orderdate <
'".mysqli_real_escape_string($yesterday)."')

Personally I would have used a lookup table for the order status.
--
Cheers
David Robley

A cynic smells flowers and looks for the casket.


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Thanks for the suggestion. Your the second to offer the IN as a  
solution.
I will try that out. I currently have enough tables and don't want  
to create a separate table for the status.

BTW what is TIAS... havent seen that one.. lol

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Re: SQL syntax

2013-01-15 Thread Karl DeSaulniers


On Jan 15, 2013, at 5:31 AM, David Robley wrote:


Karl DeSaulniers wrote:


Hello Everyone,
Hope your 2013 is treating you well.
Quick question and apologies if it is a stupid question.
Is this a viable syntax?

$sql = "SELECT orderid
FROM ORDERS_TABLE
WHERE orderstatus = 'Cancelled' OR (orderstatus = ('New' OR
'Denied' OR 'Expired' OR 'Failed' OR 'Pending' OR 'Refunded' OR
'Reversed' OR 'Under Review' OR 'Voided') AND orderdate <
'".mysqli_real_escape_string($yesterday)."')";

Namely the orderstatus = (a whole bunch of options).
In my database `orderstatus` field is an enum() list btw.
Or is there a better way to check multiple options against an enum
inside your select statement?
Reason I am doing this is to avoid having to do...

$sql = "SELECT orderid
FROM ORDERS_TABLE
WHERE orderstatus = 'Cancelled' OR (orderstatus = 'New'  AND
orderdate < '".mysqli_real_escape_string($yesterday)."') OR
(orderstatus = 'Denied'  AND orderdate <
'".mysqli_real_escape_string($yesterday)."') OR (orderstatus =
'Expired'  AND orderdate <
'".mysqli_real_escape_string($yesterday)."') ... etc";

TIA,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


The best way to check if your SQL query is valid is to feed it to  
mysql
which will return an error if the syntax is incorrect :-) So TIAS!  
Although

it looks wrong to me.

But you might try the IN operator - something like

OR (orderstatus IN ('New', 'Denied', 'Expired', 'Failed', 'Pending',
'Refunded', 'Reversed', 'Under Review', 'Voided') AND orderdate <
'".mysqli_real_escape_string($yesterday)."')

Personally I would have used a lookup table for the order status.
--
Cheers
David Robley

A cynic smells flowers and looks for the casket.


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Thanks for the suggestion. Your the second to offer the IN as a  
solution.
I will try that out. I currently have enough tables and don't want to  
create a separate table for the status.

BTW what is TIAS... havent seen that one.. lol

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] SQL syntax

2013-01-15 Thread Karl DeSaulniers


On Jan 15, 2013, at 5:25 AM, Amit Tandon wrote:


SELECT orderid
   FROM ORDERS_TABLE
   WHERE orderstatus IN ( 'Cancelled', 'New'", 'Denied',
'Expired' , 'Failed' , 'Pending' , 'Refunded' , 'Reversed' , 'Under  
Review'

, 'Voided') AND orderdate < '".mysqli_real_escape_string($
yesterday);

Another option would be to use either  of these functions

  - Find-in-set<http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_find-in-set 
>.

  This is useful if your data type is SET/ENUM type
  - Field<http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_field 
>



On Tue, Jan 15, 2013 at 2:59 PM, Karl DeSaulniers >wrote:



SELECT orderid
   FROM ORDERS_TABLE
   WHERE orderstatus = 'Cancelled' OR (orderstatus =  
('New'

OR 'Denied' OR 'Expired' OR 'Failed' OR 'Pending' OR 'Refunded' OR
'Reversed' OR 'Under Review' OR 'Voided') AND orderdate <
'".mysqli_real_escape_string($**yesterday)."')";






regds
amit

"The difference between fiction and reality? Fiction has to make  
sense."



I am wanting Cancelled to be without a date check, but thanks for the  
suggestion.

I will try the IN option.

Thank you.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] SQL syntax

2013-01-15 Thread Karl DeSaulniers

Hello Everyone,
Hope your 2013 is treating you well.
Quick question and apologies if it is a stupid question.
Is this a viable syntax?

$sql = "SELECT orderid
FROM ORDERS_TABLE
	WHERE orderstatus = 'Cancelled' OR (orderstatus = ('New' OR  
'Denied' OR 'Expired' OR 'Failed' OR 'Pending' OR 'Refunded' OR  
'Reversed' OR 'Under Review' OR 'Voided') AND orderdate <  
'".mysqli_real_escape_string($yesterday)."')";


Namely the orderstatus = (a whole bunch of options).
In my database `orderstatus` field is an enum() list btw.
Or is there a better way to check multiple options against an enum  
inside your select statement?

Reason I am doing this is to avoid having to do...

$sql = "SELECT orderid
FROM ORDERS_TABLE
	WHERE orderstatus = 'Cancelled' OR (orderstatus = 'New'  AND  
orderdate < '".mysqli_real_escape_string($yesterday)."') OR  
(orderstatus = 'Denied'  AND orderdate <  
'".mysqli_real_escape_string($yesterday)."') OR (orderstatus =  
'Expired'  AND orderdate <  
'".mysqli_real_escape_string($yesterday)."') ... etc";


TIA,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



Re: [PHP-DB] Preventing repetition of a Form

2013-01-07 Thread Karl DeSaulniers


On Jan 7, 2013, at 6:00 PM, Ethan Rosenberg, PhD wrote:


Dear list -

I have a program [*pseudo code*]:

  if(!isset($_REQUEST["welcome_already_seen"]))
  {
   initialize variables
  }

 $errors_array = array();
   if($_REQUEST["welcome_already_seen"]== "already_seen")
   {
   check_data();
  if(count($errors_array) != 0)
  {
   show_errors();
   show_welcome();
   }
   else
   {
   show_welcome();
   }
   }
   if(!isset($_REQUEST["welcome_already_seen"]))
 show_welcome();

   switch ( $_POST['next_step'] )
   {

   case "step5":
   {
   do something
   form
   next_step = step8;
  /form
   }

   case "step10":
   {
   do something
   form
   next_step = step5;
/form
  }

   etc...etc
   } //end switch

   function show_welcome()
   {
  do something
   form
   next_step = step10;
   /form
 }

The  show_welcome() persists in each step.

How do I make it go away after step10?

Thanks.

Ethan


--  
PHP Database Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php




I was going to try and help, but there is not enough info here to know  
what your doing to try and help.

To ambiguous for me.

My guess is because you have the function being called when  
welcome_already_seen isset() and if it is not and if there is an error  
and if not, regardless of what page is being displayed.
Put the function call only in the switch statement for each page you  
want it called and not for 10.


Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Programs not running

2013-01-07 Thread Karl DeSaulniers


On Jan 6, 2013, at 9:09 PM, tamouse mailing lists wrote:

On Sun, Jan 6, 2013 at 2:14 PM, Karl DeSaulniers  
 wrote:
Unfortunately, I am still working on an old G4 Powerbook trying to  
finish a

website of mine.
Adobe GoLive was the program I imprinted on and it stuck. Sadly it  
has gone

away now
and Dreamweaver is the replacement. I am not fond of DW but will no  
doubt

have to
adjust to get a job in the industry as it is the main stay these  
days for

HTML.
Sadly DW isn't any better (that I know of) when it comes to editing,
debugging  and creating
server-side tech. So this NetBeans thingamajig is a real pleaser  
for me...

:)


Actually, you might find netbeans just all that for writing the HTML,
CSS and JS stuff, too.

I used Dreamweaver when it first came out and compared to the other
sorts of things available at the time, it was pretty spiffy. But time
has marched on, and creating HTML isn't something I want a visual
editor for.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




I like fireworks for that. The export to CSS layout saves me loads of  
time
and separates things by layer instead of slices which Photoshop does  
not do (why I don't know).
I mostly use GoLive for the syntax highlighting and the site manager  
stuff and some built in javascript.
Because of using GoLive and no time to dive into DW I guess I just  
shied away.
But looks like NetBeans has a site manager built in, so this should  
prove interesting.
I have longed for some code completion features as well and NetBeans  
looks tasty.
I think it will help me in understanding PHP a little better as far as  
syntax that works.
I also work with Javascript and jQuery (LOVE! jQuery, had to learn  
quick as I was a Flash programer before. But I digress.. =)


I have to say though, signing up for this list has been one of my  
better decisions.

Thank you ALL for sharing your expertise. I find it invaluable!

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Programs not running

2013-01-06 Thread Karl DeSaulniers


On Jan 6, 2013, at 4:55 AM, tamouse mailing lists wrote:

On Sun, Jan 6, 2013 at 1:21 AM, Karl DeSaulniers  
 wrote:

I likey.. :)

Thanks!

Best,
Karl


On Jan 5, 2013, at 10:05 PM, Bastien wrote:

Get net beans. It's free and a great IDE with debuggers and other  
stuff


Bastien Koert


netbeans is pretty awesome; I haven't used it for PHP, though. the PHP
verison of Eclipse you can snag from Zend for free is okay, but creaky
slow on low-memory system. Sublime Text 2 is getting a lot of love
these days, although not a fully-fledged IDE, contains oodles of stuff
to help develop software.

I've never used GoLive, so really can't even compare.

Emacs is still my go-to editor, but that's mostly because it's the one
i imprinted on decades ago.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Unfortunately, I am still working on an old G4 Powerbook trying to  
finish a website of mine.
Adobe GoLive was the program I imprinted on and it stuck. Sadly it has  
gone away now
and Dreamweaver is the replacement. I am not fond of DW but will no  
doubt have to
adjust to get a job in the industry as it is the main stay these days  
for HTML.
Sadly DW isn't any better (that I know of) when it comes to editing,  
debugging  and creating
server-side tech. So this NetBeans thingamajig is a real pleaser for  
me... :)


Thanks BK!

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Programs not running

2013-01-05 Thread Karl DeSaulniers

I likey.. :)

Thanks!

Best,
Karl


On Jan 5, 2013, at 10:05 PM, Bastien wrote:

Get net beans. It's free and a great IDE with debuggers and other  
stuff


Bastien Koert

On 2013-01-05, at 7:14 PM, Karl DeSaulniers   
wrote:




On Jan 5, 2013, at 8:52 AM, tamouse mailing lists wrote:

On Sat, Jan 5, 2013 at 12:48 AM, Karl DeSaulniers > wrote:

On Jan 4, 2013, at 8:00 PM, tamouse mailing lists wrote:
On Fri, Jan 4, 2013 at 6:09 PM, Matt Pelmear  
 wrote:

On 01/04/2013 01:40 PM, tamouse mailing lists wrote:
One should be able to solve parsing problems without resorting  
to using

a
web server. Every time I save a php file, I have my editor set  
to run it
through php -l. Saves lots of angst when I get to the web  
testing stage.


This is a good idea in general. It's also a good trick to check  
for this
problem from the command line when suspecting a parse problem.  
Most IDEs
will make parse errors very obvious while you are editing the  
file, too.
Unfortunately not all members of any given development team can  
be relied

upon to test things in this way before committing ;)


Committing a syntax error which breaks integration is a HUGE  
HUGE NO
NO. Such a person would likely be cast from a dev team, or  
relegated

to some more benign task.


For those of us who have no idea of what you speak,
can you elaborate so as we don't make that mistake?
Or are you just talking about submitting a file to production  
without

testing it?


Not necessarily directly to production, but the beginning of the
stream that will take something from development, through testing,
staging, and finally into production. The initial point where you
merge things is generally shared by all developers on a project, and
to break it means you are breaking things for everyone on your team.

Note this applies to mulitperson projects; if you do this to  
yourself

on your solo project, not so much of a problem.

I personally have not used command line. It is new to me, but  
sounds

integral.
Where can one study its use?


You can start with:

http://php.net/manual/en/features.commandline.php

As for telling your editor to pass the file through php -l, that's
something that is extremely editor specific. I can tell how it's  
done

in Emacs, TextMate and Sublime Text 2, but naught else. Using a
full-fledged IDE such as Eclipse or PHPStorm will automatigically  
flag

syntax problems.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Oh, ok. Then I was not as lost on the subject as I thought.
Being a solo worker who is seeking a job with a team,
I thought I may be missing something and would not want
to be cut from the team for my lack of knowledge on the subject.

I personally do what you all have been saying in response to  
Ethan's posts.
If I hit a snag or have a problem and no error code, I go through  
and remove functions
until I come to the one that is causing the problem. This is a  
little lengthily of a process,

but has proven the best method for me an my lack of php experience.
Unfortunately, I do not know or have experience using any php  
editing IDEs, my code is written in Adobe GoLive... lol
Does have syntax coloring, but about as good as Text edit or note  
pad when it comes to debugging.

Basically the same as hand coding.. actually that's what it is.. :)

Thank you for your response and the link on command line. I will  
take a look.


Best,


Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Programs not running

2013-01-05 Thread Karl DeSaulniers


On Jan 5, 2013, at 8:52 AM, tamouse mailing lists wrote:

On Sat, Jan 5, 2013 at 12:48 AM, Karl DeSaulniers > wrote:

On Jan 4, 2013, at 8:00 PM, tamouse mailing lists wrote:
On Fri, Jan 4, 2013 at 6:09 PM, Matt Pelmear   
wrote:

On 01/04/2013 01:40 PM, tamouse mailing lists wrote:
One should be able to solve parsing problems without resorting  
to using

a
web server. Every time I save a php file, I have my editor set  
to run it
through php -l. Saves lots of angst when I get to the web  
testing stage.


This is a good idea in general. It's also a good trick to check  
for this
problem from the command line when suspecting a parse problem.  
Most IDEs
will make parse errors very obvious while you are editing the  
file, too.
Unfortunately not all members of any given development team can  
be relied

upon to test things in this way before committing ;)


Committing a syntax error which breaks integration is a HUGE HUGE NO
NO. Such a person would likely be cast from a dev team, or relegated
to some more benign task.


For those of us who have no idea of what you speak,
can you elaborate so as we don't make that mistake?
Or are you just talking about submitting a file to production without
testing it?


Not necessarily directly to production, but the beginning of the
stream that will take something from development, through testing,
staging, and finally into production. The initial point where you
merge things is generally shared by all developers on a project, and
to break it means you are breaking things for everyone on your team.

Note this applies to mulitperson projects; if you do this to yourself
on your solo project, not so much of a problem.


I personally have not used command line. It is new to me, but sounds
integral.
Where can one study its use?


You can start with:

http://php.net/manual/en/features.commandline.php

As for telling your editor to pass the file through php -l, that's
something that is extremely editor specific. I can tell how it's done
in Emacs, TextMate and Sublime Text 2, but naught else. Using a
full-fledged IDE such as Eclipse or PHPStorm will automatigically flag
syntax problems.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Oh, ok. Then I was not as lost on the subject as I thought.
Being a solo worker who is seeking a job with a team,
I thought I may be missing something and would not want
to be cut from the team for my lack of knowledge on the subject.

I personally do what you all have been saying in response to Ethan's  
posts.
If I hit a snag or have a problem and no error code, I go through and  
remove functions
until I come to the one that is causing the problem. This is a little  
lengthily of a process,

but has proven the best method for me an my lack of php experience.
Unfortunately, I do not know or have experience using any php editing  
IDEs, my code is written in Adobe GoLive... lol
Does have syntax coloring, but about as good as Text edit or note pad  
when it comes to debugging.

Basically the same as hand coding.. actually that's what it is.. :)

Thank you for your response and the link on command line. I will take  
a look.


Best,


Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Programs not running

2013-01-04 Thread Karl DeSaulniers


On Jan 4, 2013, at 8:00 PM, tamouse mailing lists wrote:

On Fri, Jan 4, 2013 at 6:09 PM, Matt Pelmear   
wrote:

On 01/04/2013 01:40 PM, tamouse mailing lists wrote:


One should be able to solve parsing problems without resorting to  
using a
web server. Every time I save a php file, I have my editor set to  
run it
through php -l. Saves lots of angst when I get to the web testing  
stage.



This is a good idea in general. It's also a good trick to check for  
this
problem from the command line when suspecting a parse problem. Most  
IDEs
will make parse errors very obvious while you are editing the file,  
too.
Unfortunately not all members of any given development team can be  
relied

upon to test things in this way before committing ;)


Committing a syntax error which breaks integration is a HUGE HUGE NO
NO. Such a person would likely be cast from a dev team, or relegated
to some more benign task.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




For those of us who have no idea of what you speak,
can you elaborate so as we don't make that mistake?
Or are you just talking about submitting a file to production without  
testing it?
I personally have not used command line. It is new to me, but sounds  
integral.

Where can one study its use?

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



  1   2   3   4   >