Re: [PHP-DB] MySQLi

2014-09-13 Thread Lester Caine
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
-
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

-- 
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 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 Matt Pelmear
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 <
> erosenb...@hygeiabiomedical.com> 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] Number of Lines in Table.

2014-09-02 Thread Matt Pelmear
See :
http://stackoverflow.com/questions/14682448/how-to-get-the-total-row-count-with-mysqli

Matt
On Sep 2, 2014 7:38 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)
>
>
>
>  SELECT SQL_CALC_FOUND_ROWS itm FROM Purchases LIMIT 500 OFFSET 0;
>
> +--+
> | itm  |
> +--+
> | BT-300. Host interface: USB  |
> | Oregano  |
> | Fancy Paprika|
> | Fancy Paprika|
> |
> 
>
>
> | Oregano  |
> | Oregano  |
> | Oregano  |
> | Oregano  |
> | Basil|
> +--+
> 453 rows in set (0.00 sec)
>
> mysql> SELECT FOUND_ROWS();
> +--+
> | FOUND_ROWS() |
> +--+
> |  453 |
> +--+
> 1 row in set (0.00 sec)
>
> >>>This does not:
>
> $sql26 = "SELECT SQL_CALC_FOUND_ROWS itm FROM Purchases LIMIT 50 OFFSET 0";
>
> if (!mysqli_query($cxn, $sql26))
> printf("Errormessage: %s\n", mysqli_error($cxn));
>
> $result26 = mysqli_query($cxn, $sql26);
> $sql27 = "SELECT FOUND_ROWS()";
> if (!mysqli_query($cxn, $sql27))
> printf("Errormessage: %s\n", mysqli_error($cxn));
>
> $result27 =  mysqli_query($cxn, $sql27);
>
> $row27 = mysqli_fetch_row($result27);
>
> print_r($row27);
> //output
> Array
> (
> [0] => 1
> )
>
> What is my error?
>
> TIA
>
> Ethan
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP-DB] Writing Problems

2014-08-27 Thread Matt Pelmear
/***/
$fp = fopen('filename.txt', 'a+');

// The correct thing to do is:
if (! $fp)
throw new Exception( 'Something went wrong opening the file' );

// Otherwise, you can also check with:
if (! is_resource($fp))
throw new Exception( 'Something went wrong opening the file' );

fprintf( $fp, "whatever" );
fclose($fp);
/***/

If that fails and you aren't seeing any errors, I would try this prior to
the fopen() call:
if (is_writeable('/full/path/to/filename.txt'))
echo "File is writeable." . PHP_EOL;

If is_writeable() returns false you need to look more closely at your
permissions.
If is_writeable() returns true and you still can't write to it, you would
then be in a very strange situation.


One other possible thing to try is to put the output of fprintf() into a
variable and echo that variable, just to make sure everything is working
fine there, but at a glance that all looks ok.

-Matt


On Tue, Aug 26, 2014 at 8:12 PM, Ethan Rosenberg <
erosenb...@hygeiabiomedical.com> wrote:

> On 08/26/2014 09:19 PM, Matt Pelmear wrote:
>
>> Do you check whether $fh2 is a resource after you fopen()?
>>
>> 
>>
>
>  Do you check whether $fh2 is a resource after you fopen()?
>  How?
>
>  TIA
>>
>> Ethan
>>
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>


Re: [PHP-DB] Writing Problems

2014-08-26 Thread Ethan Rosenberg

On 08/26/2014 09:19 PM, Matt Pelmear wrote:

Do you check whether $fh2 is a resource after you fopen()?




 Do you check whether $fh2 is a resource after you fopen()?
 How?

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] Writing Problems

2014-08-26 Thread Matt Pelmear
Do you check whether $fh2 is a resource after you fopen()?

btw, a better way than:
$ chown ethan:ethan filename.txt
Might be:
$ chown ethan:www-data filename.txt
$ chmod 664 filename.txt

This way you own the file, the server can write to it (assuming your server
has group www-data), and it is not world-writeable. (you almost never want
things to be world-writeable)

Matt
On Aug 26, 2014 5:45 PM, "Ethan Rosenberg" 
wrote:

> Dear List -
>
> I can't figure this one out.
>
> 1] Straighten out ownership
>
> ethan@meow:/var/www$ rm receipt.txt
> ethan@meow:/var/www$ touch receipt.txt
> ethan@meow:/var/www$ ls -l receipt.txt
> -rw-r--r-- 1 ethan ethan 0 Aug 26 19:31 receipt.txt
> ethan@meow:/var/www$ chmod 766 receipt.txt
> ethan@meow:/var/www$ ls -l receipt.txt
> -rwxrw-rw- 1 ethan ethan 0 Aug 26 19:31 receipt.txt
>
> This is what we want
>
> 2] Now program code 
>
> ini_set('display_startup_errors', 'on');
> error_reporting(E_ALL | E_NOTICE);
> ini_set('display_errors','1');
> error_reporting(1);
>
>
> $fh2 = fopen("/var/www/receipt.txt", "a+");
>
> want this file to be like a cash register receipt.  I can truncate this
> file for each execution of the program; ie, when all the purchases are
> finished.
>
> $sql3 = "select quant, orderpt,  ordrpt_flag, manuf, item, stock, price,
> tax_flag  from Inventory where UPC = $upc";
> $result3 = mysqli_query($cxn, $sql3);
> $row3 = mysqli_fetch_row($result3);
>
> print_r($row3 ); //gives correct results.
>
> $numbyt=fprintf($fh2, "%s %s %.2f %s\n",$row3[3] , $row3[4], $row3[6],
> $row3[7]);
>
> echo "numbyt fh2 $numbyt";  //result is 0
>
> No errors.
>
> What is wrong??
>
> TIA
>
> Ethan
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP-DB] Re: www-data file

2014-08-26 Thread Jim Giner

On 8/26/2014 11:26 AM, Matt Pelmear wrote:


fopen() can create files if they don't exist.

I should have read the manual b4 replying.  :(

--
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-26 Thread Jasper Kips
What are you trying to achieve? Or to put it more clearly, why do you need the 
filw owner to be ethan?

Jasper

Verstuurd vanaf mijn iPad

> Op 26 aug. 2014 om 06:20 heeft Ethan Rosenberg 
>  het volgende geschreven:
> 
> 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
> 
> 
> 
> -- 
> 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: www-data file

2014-08-26 Thread Matt Pelmear

On 08/26/2014 06:21 AM, Jim Giner wrote:

On 8/26/2014 12:20 AM, 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


Why should ownership be a concern when you are simply opening a file? 
AFAIK permissions are set at the time the file is placed there and 
will affect the access to them from then on.  If you are able to fopen 
the file, why do the permissions matter?  If you can't then you have 
an entirely different problem to discuss.




fopen() can create files if they don't exist.
So if you open a file for writing, it will by default receive the 
user/group of the web server. If you then need to access the file as 
some other user, you run into this situation.

(I assume this is what Ethan is referring to here.)

--
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 Matt Pelmear
Another, safer, thing to consider would be setting a sticky bit on whatever
directory the files will be in:
http://computernetworkingnotes.com/managing-file-system-security/sticky-bit.html

I've used sticky bits in a number of situations with multiple groups and
users co-habiting environments quite nicely in the past.

You'll find that simply chowning from inside php won't always work,
depending on how your groups are setup.

If it will be just one file (rather than an unlimited number of them
created by the server), simply chown it to "ethan" manually, once.

-matt
On Aug 25, 2014 9:43 PM, "Aziz Saleh"  wrote:

> On Tue, Aug 26, 2014 at 12:20 AM, Ethan Rosenberg <
> erosenb...@hygeiabiomedical.com> 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
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> Use chown/chgrp after the fact:
> http://php.net/manual/en/function.chown.php
> http://php.net/manual/en/function.chgrp.php
>
> If you want it to be ethan by default, something which I would never do or
> recommend to do for obvious security reasons you will need to modify your
> Apache environment variables (find where the configs are set by using grep,
> for example: grep www- /etc/apache2/apache2.conf).
>


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] www-data file

2014-08-25 Thread Aziz Saleh
On Tue, Aug 26, 2014 at 12:20 AM, Ethan Rosenberg <
erosenb...@hygeiabiomedical.com> 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
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Use chown/chgrp after the fact:
http://php.net/manual/en/function.chown.php
http://php.net/manual/en/function.chgrp.php

If you want it to be ethan by default, something which I would never do or
recommend to do for obvious security reasons you will need to modify your
Apache environment variables (find where the configs are set by using grep,
for example: grep www- /etc/apache2/apache2.conf).


Re: [PHP-DB] Query does not work

2014-07-02 Thread Jim Giner
Once again you have provided the group with RANDOM pieces of code, 
completely out of context since you have already shown me that your 
query and db connection are being used in a function, hence your loss of 
$cxn.


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



Re: [PHP-DB] Query does not work

2014-07-02 Thread Lester Caine
On 02/07/14 04:43, Ethan Rosenberg, PhD wrote:
> while ($row31 = mysqli_fetch_row($result31)) {
>   printf ("%s %s %s %s %s\n", $row31[0], $row31[1], $row31[2], $row31[3]);

Try
print_r( $row31 );

> } // no output
> 
> How can I loose a db connection in the middle of a program?
This is not showing that you have, only that you can't see the actual
data returned.

I prefer firebird to mysql, and the normal process is to use the
mysqli_fetch_assoc style working so that the keys of the array are the
returned field names in which case the print_r output gives more
information ...

-- 
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

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



Re: [PHP-DB] Query does not work

2014-07-01 Thread Ethan Rosenberg, PhD


Dear List -

I think I've lost the database connection.

I put in the following code:

$sql31=	"select Lname, Fname,  Phone, Cust_Num from Customers order by 
Lname";


echo $sql31; //echos correctly

$result31 = mysqli_query($cxn,$sql31);

var_dump($result31); // result null


while ($row31 = mysqli_fetch_row($result31)) {
  printf ("%s %s %s %s %s\n", $row31[0], $row31[1], $row31[2], $row31[3]);
} // no output

How can I loose a db connection in the middle of a program?





TIA

Ethan



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



Re: [PHP-DB] Re: Query does not work

2014-07-01 Thread Jim Giner

On 7/1/2014 10:26 AM, Aziz Saleh wrote:

On Tue, Jul 1, 2014 at 10:02 AM, Jim Giner 
wrote:


How about just showing us the section of code instead of disjoint pieces
that WE cannot be sure are applied correctly?


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



Also the DB structure would help, using sqlfiddle will make things a lot
easier as well for us (lazy me).

The structure is probably not the problem, since he is not getting 
anything from mysqli_error().


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



Re: [PHP-DB] Re: Query does not work

2014-07-01 Thread Aziz Saleh
On Tue, Jul 1, 2014 at 10:02 AM, Jim Giner 
wrote:

> How about just showing us the section of code instead of disjoint pieces
> that WE cannot be sure are applied correctly?
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Also the DB structure would help, using sqlfiddle will make things a lot
easier as well for us (lazy me).


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

2014-06-24 Thread Ethan Rosenberg, PhD

On 06/24/2014 08:12 PM, Ethan Rosenberg, PhD wrote:

On 06/24/2014 01:55 PM, Jim Giner wrote:

Looking at your code again, I think that your query failed and your lack
of error reporting isn't showing the error that occurred when  you tried
to access a property of the result which is not a resource but merely a
value of 'false'.

One should ALWAYS check the result of operations before assuming that
they succeeded and proceeding onwards in code.  Saves lots of lost time.



Jim -

Thanks.

Error checking as per your instructions.
No errors.

Attached are two files.  I tried to mimic the behavior of the program.
One file does the data input and the second processes it.

The display on the browser screen is

select Cust_Num, Lname, Fname from Customers where Phone =
'845-123-3298' here2here3
result.
Last Name First Name

When the above query is run from the command line -

mysql> select Cust_Num, Lname, Fname from Customers where Phone =
'845-123-3298';
+--++---+
| Cust_Num | Lname  | Fname |
+--++---+
|1 | Kitten | Gingy |
| 1153 | Puppy  | Woofy |
| 1154 | Puppy  | Woofy |
+--++---+

TIA

Ethan



Jim -

I think I know the problem.

These two lines of code were added -


$nmbr=mysqli_num_rows ( $result1 );
echo 'number of rows $nmbr';

The echo statement does not return a number.
Therefore ... bad connection. The script failed at the output stage 
because there were no results.


I'm again attaching the two files. They are somewhat modified.  The only 
thing in the first file is the form. The second file contains the 
calculations


TIA

Ethan



I have made the linnk $cxn a global variable in the in both scripts.
<>
<>
-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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

2014-06-24 Thread Ethan Rosenberg, PhD

On 06/24/2014 01:55 PM, Jim Giner wrote:

Looking at your code again, I think that your query failed and your lack
of error reporting isn't showing the error that occurred when  you tried
to access a property of the result which is not a resource but merely a
value of 'false'.

One should ALWAYS check the result of operations before assuming that
they succeeded and proceeding onwards in code.  Saves lots of lost time.



Jim -

Thanks.

Error checking as per your instructions.
No errors.

Attached are two files.  I tried to mimic the behavior of the program.
One file does the data input and the second processes it.

The display on the browser screen is

select Cust_Num, Lname, Fname from Customers where Phone = 
'845-123-3298' here2here3

result.
Last Name   First Name

When the above query is run from the command line -

mysql> select Cust_Num, Lname, Fname from Customers where Phone = 
'845-123-3298';

+--++---+
| Cust_Num | Lname  | Fname |
+--++---+
|1 | Kitten | Gingy |
| 1153 | Puppy  | Woofy |
| 1154 | Puppy  | Woofy |
+--++---+

TIA

Ethan

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

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

2014-06-24 Thread Jim Giner
Looking at your code again, I think that your query failed and your lack 
of error reporting isn't showing the error that occurred when  you tried 
to access a property of the result which is not a resource but merely a 
value of 'false'.


One should ALWAYS check the result of operations before assuming that 
they succeeded and proceeding onwards in code.  Saves lots of lost time.


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



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

2014-06-24 Thread Jim Giner

I don't recognize your error reporting configuration.  Try this instead:

error_reporting(E_ALL | E_NOTICE);
ini_set('display_errors','1');


As for php startup errors, if you are not running your own installation, 
you don't need that.


So - if 'here3' is never echoed, then your code does NOT stop there - it 
obviously stopped somewhere prior to that.  Add more debugging lines to 
isolate exactly how far it gets.


(I assume that all of your other echos did appear?)

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



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

2014-06-24 Thread Ethan Rosenberg, PhD

On 06/24/2014 09:39 AM, Jim Giner wrote:

Ethan -
You say your script stops here :  echo 'here3';  To be sure, you mean
that the script DOES echo out 'here3' or does NOT get there?  I'm going
to guess that it does get to that echo statement but the very next one
is going to kill you because you cannot echo out a resource.

ONCE AGAIN - do you have php error checking turned on as you've been
told many many times?


Jim -

Thanks.

ini_set('display_errors', 'on');
ini_set('display_startup_errors', 'on');
error_reporting(-2);

ini_set('error_reporting', 'E_ALL | E_STRICT');
ini_set('html_errors', 'On');
ini_set('log_errors', 'On');

from the program.

here3 is never echoed.

The same code in a free standing program [attached] works beautifully.

TIA

Ethan
<>
-- 
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-19 Thread Oriole Computing
Sorry team, i guess am in the wrong mailing list. The good news is that it
has now worked thanks to Toby's solution.. the error was my typing problem
...

Thanx Tobby!!!

Warm Regards



*SUPPORT TEAMORIOLE COMPUTING*

*1938 B1 MUNGWI ROAD*

*LUSAKAZAMBIA*

*Skype:* oriolecomputing | *Url:* oriolecomputing.blogspot.com



On Thu, Jun 19, 2014 at 4:15 PM, Oriole Computing  wrote:

> Now it says PHP Notice:  Undefined index: responsecode
>
> Warm Regards
>
>
>
> *SUPPORT TEAMORIOLE COMPUTING*
>
> *1938 B1 MUNGWI ROAD *
>
> *LUSAKAZAMBIA*
>
> *Skype:* oriolecomputing | *Url:* oriolecomputing.blogspot.com
> 
>
>
> On Thu, Jun 19, 2014 at 4:09 PM, Toby Hart Dyke  wrote:
>
>>
>>
>> My error! This:
>>
>>
>> $responseCode = $result[return]['responsecode'];
>>
>> should have been
>>
>>
>> $responseCode = $result['return']['responsecode'];
>>
>>
>> The other responses have been rather more elegant, though I think my
>> solution is a little more readable - i.e., I had to think about what was
>> happening for those ones!
>>
>>   Toby
>>
>>
>> On 6/19/2014 9:50 AM, Oriole Computing wrote:
>>
>>> Hi Toby,
>>>
>>> my response is in variable $result so i run the code as below
>>>
>>> $responseCode = $result[return]['responsecode'];
>>>
>>> but getting this error: PHP Parse error:  syntax error, unexpected
>>> T_RETURN, expecting ']
>>>
>>> Warm Regards
>>>
>>>
>>>
>>> *SUPPORT TEAMORIOLE COMPUTING*
>>>
>>> *1938 B1 MUNGWI ROAD*
>>>
>>> *LUSAKAZAMBIA*
>>>
>>> *Skype:* oriolecomputing | *Url:* oriolecomputing.blogspot.com
>>> 
>>>
>>>
>>> On Thu, Jun 19, 2014 at 12:23 PM, Pritoj Singh 
>>> wrote:
>>>
>>>  foreach($arr['return'] as $key=>$val){
 $$key=$val;
 }


 On Thu, Jun 19, 2014 at 3:48 PM, Toby Hart Dyke 
 wrote:

  If you have the response in a variable, $response:
>
> $responseCode = $response[return]['responsecode'];
> $responseMessage = $response[return]['responseMessage'];
> $transactionID = $response[return]['transactionID'];
>
>
>
>>
>> --
>> 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-19 Thread Oriole Computing
Now it says PHP Notice:  Undefined index: responsecode

Warm Regards



*SUPPORT TEAMORIOLE COMPUTING*

*1938 B1 MUNGWI ROAD*

*LUSAKAZAMBIA*

*Skype:* oriolecomputing | *Url:* oriolecomputing.blogspot.com



On Thu, Jun 19, 2014 at 4:09 PM, Toby Hart Dyke  wrote:

>
>
> My error! This:
>
>
> $responseCode = $result[return]['responsecode'];
>
> should have been
>
>
> $responseCode = $result['return']['responsecode'];
>
>
> The other responses have been rather more elegant, though I think my
> solution is a little more readable - i.e., I had to think about what was
> happening for those ones!
>
>   Toby
>
>
> On 6/19/2014 9:50 AM, Oriole Computing wrote:
>
>> Hi Toby,
>>
>> my response is in variable $result so i run the code as below
>>
>> $responseCode = $result[return]['responsecode'];
>>
>> but getting this error: PHP Parse error:  syntax error, unexpected
>> T_RETURN, expecting ']
>>
>> Warm Regards
>>
>>
>>
>> *SUPPORT TEAMORIOLE COMPUTING*
>>
>> *1938 B1 MUNGWI ROAD*
>>
>> *LUSAKAZAMBIA*
>>
>> *Skype:* oriolecomputing | *Url:* oriolecomputing.blogspot.com
>> 
>>
>>
>> On Thu, Jun 19, 2014 at 12:23 PM, Pritoj Singh  wrote:
>>
>>  foreach($arr['return'] as $key=>$val){
>>> $$key=$val;
>>> }
>>>
>>>
>>> On Thu, Jun 19, 2014 at 3:48 PM, Toby Hart Dyke 
>>> wrote:
>>>
>>>  If you have the response in a variable, $response:

 $responseCode = $response[return]['responsecode'];
 $responseMessage = $response[return]['responseMessage'];
 $transactionID = $response[return]['transactionID'];



>
> --
> 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-19 Thread Aziz Saleh
On Thu, Jun 19, 2014 at 10:09 AM, Toby Hart Dyke  wrote:

>
>
> My error! This:
>
>
> $responseCode = $result[return]['responsecode'];
>
> should have been
>
>
> $responseCode = $result['return']['responsecode'];
>
>
> The other responses have been rather more elegant, though I think my
> solution is a little more readable - i.e., I had to think about what was
> happening for those ones!
>
>   Toby
>
>
> On 6/19/2014 9:50 AM, Oriole Computing wrote:
>
>> Hi Toby,
>>
>> my response is in variable $result so i run the code as below
>>
>> $responseCode = $result[return]['responsecode'];
>>
>> but getting this error: PHP Parse error:  syntax error, unexpected
>> T_RETURN, expecting ']
>>
>> Warm Regards
>>
>>
>>
>> *SUPPORT TEAMORIOLE COMPUTING*
>>
>> *1938 B1 MUNGWI ROAD*
>>
>> *LUSAKAZAMBIA*
>>
>> *Skype:* oriolecomputing | *Url:* oriolecomputing.blogspot.com
>> 
>>
>>
>> On Thu, Jun 19, 2014 at 12:23 PM, Pritoj Singh  wrote:
>>
>>  foreach($arr['return'] as $key=>$val){
>>> $$key=$val;
>>> }
>>>
>>>
>>> On Thu, Jun 19, 2014 at 3:48 PM, Toby Hart Dyke 
>>> wrote:
>>>
>>>  If you have the response in a variable, $response:

 $responseCode = $response[return]['responsecode'];
 $responseMessage = $response[return]['responseMessage'];
 $transactionID = $response[return]['transactionID'];



>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Nothing to do with DB. Wrong mailing list: http://php.net/mailing-lists.php


Re: [PHP-DB] VAR_DUMP INTO PHP VARIABLES

2014-06-19 Thread Toby Hart Dyke



My error! This:

$responseCode = $result[return]['responsecode'];

should have been

$responseCode = $result['return']['responsecode'];


The other responses have been rather more elegant, though I think my 
solution is a little more readable - i.e., I had to think about what was 
happening for those ones!


  Toby

On 6/19/2014 9:50 AM, Oriole Computing wrote:

Hi Toby,

my response is in variable $result so i run the code as below

$responseCode = $result[return]['responsecode'];

but getting this error: PHP Parse error:  syntax error, unexpected
T_RETURN, expecting ']

Warm Regards



*SUPPORT TEAMORIOLE COMPUTING*

*1938 B1 MUNGWI ROAD*

*LUSAKAZAMBIA*

*Skype:* oriolecomputing | *Url:* oriolecomputing.blogspot.com



On Thu, Jun 19, 2014 at 12:23 PM, Pritoj Singh  wrote:


foreach($arr['return'] as $key=>$val){
$$key=$val;
}


On Thu, Jun 19, 2014 at 3:48 PM, Toby Hart Dyke  wrote:


If you have the response in a variable, $response:

$responseCode = $response[return]['responsecode'];
$responseMessage = $response[return]['responseMessage'];
$transactionID = $response[return]['transactionID'];





--
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-19 Thread Oriole Computing
Hi Toby,

my response is in variable $result so i run the code as below

$responseCode = $result[return]['responsecode'];

but getting this error: PHP Parse error:  syntax error, unexpected
T_RETURN, expecting ']

Warm Regards



*SUPPORT TEAMORIOLE COMPUTING*

*1938 B1 MUNGWI ROAD*

*LUSAKAZAMBIA*

*Skype:* oriolecomputing | *Url:* oriolecomputing.blogspot.com



On Thu, Jun 19, 2014 at 12:23 PM, Pritoj Singh  wrote:

> foreach($arr['return'] as $key=>$val){
> $$key=$val;
> }
>
>
> On Thu, Jun 19, 2014 at 3:48 PM, Toby Hart Dyke  wrote:
>
> >
> > If you have the response in a variable, $response:
> >
> > $responseCode = $response[return]['responsecode'];
> > $responseMessage = $response[return]['responseMessage'];
> > $transactionID = $response[return]['transactionID'];
> >
> > This isn't really the right list to ask this question - nothing to do
> with
> > databases!
> >
> >   Toby
> >
> >
> >
> > On 6/19/2014 1: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?
> >>
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> ___
> Pritoj Singh
> Ph +91-9876270817
> Skype : pritojsinghwork
>


Re: [PHP-DB] VAR_DUMP INTO PHP VARIABLES

2014-06-19 Thread Pritoj Singh
foreach($arr['return'] as $key=>$val){
$$key=$val;
}


On Thu, Jun 19, 2014 at 3:48 PM, Toby Hart Dyke  wrote:

>
> If you have the response in a variable, $response:
>
> $responseCode = $response[return]['responsecode'];
> $responseMessage = $response[return]['responseMessage'];
> $transactionID = $response[return]['transactionID'];
>
> This isn't really the right list to ask this question - nothing to do with
> databases!
>
>   Toby
>
>
>
> On 6/19/2014 1: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?
>>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
___
Pritoj Singh
Ph +91-9876270817
Skype : pritojsinghwork


Re: [PHP-DB] VAR_DUMP INTO PHP VARIABLES

2014-06-19 Thread Toby Hart Dyke


If you have the response in a variable, $response:

$responseCode = $response[return]['responsecode'];
$responseMessage = $response[return]['responseMessage'];
$transactionID = $response[return]['transactionID'];

This isn't really the right list to ask this question - nothing to do 
with databases!


  Toby


On 6/19/2014 1: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?


--
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 Michael Stowe
Can we kill this thread?  Or can you guys continue the conversation between
yourselves.  We now have 8 emails pertaining to the technical question, and
8 emails ranting about him asking it.

I understand that some people do not believe this is the appropriate forum
for that question - but personal attacks and rantings accomplish nothing
other than to provide bully tactics and express your outrage at "list
spamming" while spamming the list.

Thank you for your consideration.

- Mike


On Wed, Jun 18, 2014 at 11:49 AM, Jim Giner 
wrote:

> On 6/18/2014 2:16 PM, Aziz Saleh wrote:
>
>> On Wed, Jun 18, 2014 at 2:13 PM, Karl DeSaulniers 
>> wrote:
>>
>>
>>>
>>> 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
>>>
>>>
>>>  There are lots of people who have free time on their hands to teach the
>> basics, which I think is a good thing. Personally, if someone doesn't care
>> enough to read the manual or attempt to understand the basics, I wouldn't
>> spend too much time on their problems.
>>
>>  And despite Ethan's continual ignorance of the manual and the basic
> principles espoused by those taking

Re: [PHP-DB] Newbie Question $2

2014-06-18 Thread Jim Giner

On 6/18/2014 2:16 PM, Aziz Saleh wrote:

On Wed, Jun 18, 2014 at 2:13 PM, Karl DeSaulniers 
wrote:




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";>



 
 
 
 
 
 
 
 
 
 

$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
 
 

 
 
 
 Last Name
 First Name
  
   
   
 

   
 >
 


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



There are lots of people who have free time on their hands to teach the
basics, which I think is a good thing. Personally, if someone doesn't care
enough to read the manual or attempt to understand the basics, I wouldn't
spend too much time on their problems.

And despite Ethan's continual ignorance of the manual and the basic 
principles espoused by those taking the time to respond to him we still 
do it.  Aren't we all amazing?


--
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 Aziz Saleh
On Wed, Jun 18, 2014 at 2:13 PM, Karl DeSaulniers 
wrote:

>
>
> 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
>
>
There are lots of people who have free time on their hands to teach the
basics, which I think is a good thing. Personally, if someone doesn't care
enough to read the manual or attempt to understand the basics, I wouldn't
spend too much time on their problems.


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-18 Thread Jim Giner

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";>



 
 
 
 
 
 
 
 
 
 

 

 No Match Found
 
 

 
 
 
 Last Name
 First Name
  
   
   
 

   
 >
 


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


--
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-17 Thread Ethan Rosenberg, PhD

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";>













			$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




			frame="box">


Last Name
First Name
  
  
  


  
>



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


--
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-17 Thread onatawah...@yahoo.ca
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



Re: [PHP-DB] Re: Newbie Question $2

2014-06-17 Thread Aziz Saleh
IMO a newbie is someone who read the docs and understood them (at least in
theory) before they attempt to write code, which doesn't seem to be the
case.


On Tue, Jun 17, 2014 at 10:04 AM, Jim Giner 
wrote:

> We're all so eager to help out poor Ethan (who many of you know is NOT a
> newbie) but nowhere does Ethan say what difficulty he is having.
>
> The suggestions made so far are great but what are we solving?
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP-DB] Re: Newbie Question $2

2014-06-17 Thread Jim Giner

On 6/17/2014 10:51 AM, Lester Caine wrote:

On 17/06/14 15:04, Jim Giner wrote:

We're all so eager to help out poor Ethan (who many of you know is NOT a
newbie) but nowhere does Ethan say what difficulty he is having.

The suggestions made so far are great but what are we solving?

I see you have spotted the original question :)
The original post was fairly complete in what it was asking, and the
answers reasonably worded ...

Yeah - I just didn't take Ethan's comment as 'his question' since a) it 
didn't even have a ? mark on it and b) his spelling of his phn vars was 
crisscrossed re: the usage in the query statement.  I knew people were 
seeing something I wasn't - just didn't realize that the question itself 
was a puzzle of sorts.


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



Re: [PHP-DB] Re: Newbie Question $2

2014-06-17 Thread Lester Caine
On 17/06/14 15:04, Jim Giner wrote:
> We're all so eager to help out poor Ethan (who many of you know is NOT a
> newbie) but nowhere does Ethan say what difficulty he is having.
> 
> The suggestions made so far are great but what are we solving?
I see you have spotted the original question :)
The original post was fairly complete in what it was asking, and the
answers reasonably worded ...

-- 
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

-- 
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 Mike Stowe
Oh a few quick things. 

First, you can use substr to break up the phone instead of grabbing characters- 
might be a little easier to read long term. 

Secondly, mysql_real_escape_string will return the cleaned string, but doesn't 
change the original variable. So you'll need $phn = 
mysql_real_escape_string($phn);

Thirdly anytime you use a single quote the strong is interpreted literally. 
You'll want to switch out the single quotes with double quotes, and then wrap 
$phn in single quotes in order to not break your query. 

"Select ... Where phn = '$phn'"

I'd also really suggest looking at using PDO or even the mysqli extension tho 
instead of just plain mysql (believe this has been deprecated). 

Sorry for the quick reply, on mobile. But feel free to email me directly and 
I'll be happy to help out more. 

- Mike

Sent from my iPhone

> On Jun 16, 2014, at 7: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
> 
> -- 
> 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] 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 Aziz Saleh
On Mon, Jun 16, 2014 at 10:58 PM, Ethan Rosenberg <
erosenb...@hygeiabiomedical.com> 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
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
This page should help you:
http://www.php.net//manual/en/language.types.string.php understand the
difference between single and double quotes.


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] MS Access Connection with database password

2014-06-06 Thread Kjell Hansen

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] MS Access Connection with database password

2014-06-05 Thread Kjell Hansen
No, 
I haven't found them :( Please direct me...

Password lenght and content is not a problem (I guess!) since I tried changing 
it to a simple small "a" without any further success.

Thanks a bunch!
/Kjell

From: "Richard Quadling" 
Sent: Thu, 5.6.2014 10:06
To: "Kjell Hansen" 
Cc: php-db 
Subject: Re: [PHP-DB] MS Access Connection with database password

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



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

2014-06-05 Thread Richard Quadling
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


Re: [PHP-DB] Popular website search engines

2014-03-14 Thread Bastien Koert
wordpress has a built in search as well. It depends on what you what you
are wanting to do


On Thu, Mar 13, 2014 at 2:46 PM, Matt Pelmear  wrote:

> Besides the usual suspects that are 3rd party, a common solution I've seen
> is Solr/Lucene:
> https://lucene.apache.org/solr/
>
>
> -Matt
>
>
> On 03/13/2014 11:44 AM PT, Olivier Austina wrote:
>
>> Hi,
>> I am new to website search engine area.I would like to do a survey of
>> popular search engine used for a website. I found some search engine like
>> FreeFind.  I know also that Google is used as
>> search engine for some websites.
>> Any suggestion on how website search engine works for traditional,
>> e-commerce, forum, social media etc will be appreciate. Thank you.
>>
>> Regards
>> Olivier
>>
>>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 

Bastien

Cat, the other other white meat


Re: [PHP-DB] Popular website search engines

2014-03-13 Thread Matt Pelmear
Besides the usual suspects that are 3rd party, a common solution I've 
seen is Solr/Lucene:

https://lucene.apache.org/solr/


-Matt

On 03/13/2014 11:44 AM PT, Olivier Austina wrote:

Hi,
I am new to website search engine area.I would like to do a survey of
popular search engine used for a website. I found some search engine like
FreeFind.  I know also that Google is used as
search engine for some websites.
Any suggestion on how website search engine works for traditional,
e-commerce, forum, social media etc will be appreciate. Thank you.

Regards
Olivier




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



Re: [PHP-DB] Workout Schedule Calendar

2014-03-01 Thread Lester Caine

Vinay Kannan wrote:

I am getting stuck at the DB structuring part for this.
1) I can have all the different types of workouts entered into the DB with
the number of days / sessions thats included in a particular package.
2) and then when a member pays the fees eg: for 3 months (12 sessions) so
have 12 entries made into the DB and then map with the members attendance
and what he has done on that day.

But was wondering if this is an efficient way to do it, over a period of
time, there would be 1000s of members, who would be going to the gym for
decent period of time.
so eg: 1000 member attend the gym for 1 year (365), that makes the total
entries in the DB to be 1000s x 365 just for a year!


With a relational database anything is possible ( you don't say which one but 
that really only affects fine detail and bells and whistles ).


You are going to have a table with members, one record for each. These will have 
the basics like when their next payment is due, or how many sessions per week ...


I would also imagine a database of 'facilities' a bit like room booking so you 
don't perhaps have more members booked in than you can cope with? In the absence 
of that you would at least have list of available activities?


A client visit would then be a combination of pre-booked or 'open' activities. 
So a table with a list of date/time/member_id/activity.


History would be a matter of just how long you want to maintain the information. 
My own systems manage activities relating to callers visiting an office, and we 
maintain history back many years, but if a 'caller(member)' has not been 
attending in the previous 2 years then their history is deleted. Actually it 
will still be maintained in backup files, but that is not directly accessible. 
Legally, the 'Data protection Act' comes into play here in the UK, but we have 
sites with over a million visits recorded over the past approaching 20 years, 
and the system still works as fast as when it was first installed :)


( I use Firebird but any of the options will handle your level of activity )

--
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

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



Re: [PHP-DB] Transactions with PDO_INFORMIX

2014-01-15 Thread Rahul Priyadarshi2
If any query failed inside a transaction then PDO will not issue a 
rollback, It will left the decision on you that you want to ignore the 
failed query it or want a rollback.

You can find the examples of handing of query failure inside a transaction 
at http://www.php.net/manual/en/pdo.transactions.php

You can trust on  transaction handling built-in function of PDO, it is 
well implemented inside PDO_INFORMIX.
 
Thanks,
Rahul Priyadarshi



- Forwarded by Daniel Krook/White Plains/IBM on 01/14/2014 10:33 AM 
-

From:   Neomi TR 
To: php-db@lists.php.net
Date:   01/14/2014 10:30 AM
Subject:[PHP-DB] Transactions with PDO_INFORMIX
Sent by:Neomi TR 





Hi,

I use the PDO functions PDO::beginTransaction, PDO::commit and
PDO::rollBack to
begin, commit and rollback transactions.
I also check that we are in active or no active transaction with
'PDO::inTransaction'.

System info:
PHP 5.3.28
INFORMIX 11.70
PDO_INFORMIX-1.3.0

Lately we have encountered few failures when using transactions.
Queries have failed and there was no rollback, although the failed
queries were part of transaction.

Even after one of the queries has failed, there was no rollback although
it was declared, and part of the queries in the transaction were executed.

My question is - can I trust the build-in functions of the PDO?
Does this problem is known?

Thank you,
Neomi





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




Re: [PHP-DB] PDO Connection problem

2014-01-10 Thread Aziz Saleh
On Fri, Jan 10, 2014 at 10:13 AM, Jim Giner wrote:

> History:
> I'm trying to help a friend who is hosting his domain with the same
> company that I use.  I've been using this company for several years and
> have used a certain 'connection' script all the time.  Part of it looks
> like this:
>
> $host="mysql:host=mydomain.com;dbname=$sc_dbname;charset=utf8";
> $uid = "uid";
> $pswd = "pswd";
> Try
> {
> $mysql = new PDO($host,$uid,$pswd,$db_options);
> }
> .
>
> So - when I tried to provide this template to my friend (who is new to all
> of this) we went thru days of emails trying to make sure everything was
> setup correctly but could never get a connection using the above code.
>  Finally last night, after reviewing how my 'old' mysql interface
> connection worked, I experimented with the above changing my host= from my
> domain name to simply 'localhost'.  Voila - it worked for him.  It also
> worked for my site.
>
> Here's my question:  What would make by friend's account not work when
> referencing a true domain name in the host= attribute?  I'm assuming that
> our (shared) provider is setting up his many accounts & servers the same
> way, but I could be wrong.  And of course, I don't have a clue about what
> makes any of this work - I simply follow instructions/guidance I get from
> manuals and searches until I get things to work.  That's how I got his
> account to finally work, but I'd love to have an idea why it now does.
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
It could be that your MySQL configs -bind-address and skip-networking are
set, so it is not allowing for external connections. My guess (could be
wrong) that using yourdomain.com is the same as making an external call, as
opposed to using localhost (no DNS lookup).


Re: [PHP-DB] Billing Module in PHP

2014-01-09 Thread Lester Caine

Vinay Kannan wrote:

Currently the DB structure stores the following : 1) Customer details. 2)
Membership ID and the payment paid at the time of signing up (I am thinking
i might not need the signing up amount to be stored in the customer DB in
the first place, and have them seperate in a table called signinupfeespaid
or something like) 3) And maybe have another table called
'memberfeesintervals) which will have (membershipid,
paymentinterval,nextdueon) and then pick up the pending fees (Customer can
also issue part payments) from a pendingfees table

Any suggestion is welcome! Thank You in advance!


Personally I'd have a table for payments received since you will have many 
payments per MembershipId over time, but I'd probably keep the 'nextdue' and 
'period' fields as part of a single customer detail table. There should only be 
one answer for 'nextdue' based on the last payment which will show the period 
paid for, and even this is a little redundant since it is available from the 
last payment record, but I see no need for a third table? Just set the right 
'relations' between the master record and payment list?


--
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

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



Re: [PHP-DB] Calculating Past Dates In A Different Time Zone

2013-11-10 Thread Matt Pelmear

Typically, yes.

It is possible you don't have the time zone tables populated. 
"America/Bahia" works for me, so I suspect that is the case.
The relevant manual page to load this data (assuming your server is 
running in a unix environment) is here:

http://dev.mysql.com/doc/refman/5.0/en/mysql-tzinfo-to-sql.html

If it is running in a Windows environment:
http://dev.mysql.com/downloads/timezones.html


-Matt

On 11/10/2013 04:22 PM PT, Ron Piggott wrote:


A suggestion I was given is to use the mySQL "CONVERT_TZ" command with 
the PHP time zone names.  But when I do:


SELECT CONVERT_TZ( `journal_entry`.`occurance_date` , 'GMT', 
'America/Bahia' ) FROM `journal_entry`


I am receiving "NULL" as the resulting date.  Does mySQL accept PHP 
time zone names?


Ron





Re: [PHP-DB] Calculating Past Dates In A Different Time Zone

2013-11-10 Thread Ron Piggott


A suggestion I was given is to use the mySQL "CONVERT_TZ" command with the 
PHP time zone names.  But when I do:


SELECT CONVERT_TZ( `journal_entry`.`occurance_date` , 'GMT', 
'America/Bahia' ) FROM `journal_entry`


I am receiving "NULL" as the resulting date.  Does mySQL accept PHP time 
zone names?


Ron 



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



Re: [PHP-DB] Calculating Past Dates In A Different Time Zone

2013-11-10 Thread Tamara Temple

On Nov 10, 2013, at 10:26 AM, Ron Piggott  
wrote:

> I normally use the following code to convert between time zones.  But I don’t 
> know how to calculate what time it is in GMT time zone when it is midnight in 
> the users time zone X days ago, or midnight on November 1st 2013 in the users 
> time zone.

The time zone offset will always be the same, regardless of what day it is…

Let’s say the user is in US CST, the offset to GMT/UTC is always 6 hours. If 
the prior date lies within the local DST designation, you can still use that 
info, in which the offset will be 5 hours. The major glitch happens during the 
midnight before switching to/from DST, but that’s just a special case.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Calculating Past Dates In A Different Time Zone

2013-11-10 Thread Matt Pelmear

Ron,

You could use the same technique here if you want to do the work in PHP:

=== php code ===
assert( convertToGMT('2013-11-01 00:00:00') == '2013-11-01 04:00:00' ); 
// EST offset by four hours
assert( convertToGMT('2013-11-07 23:59:59') == '2013-11-08 04:59:59' ); 
// EDT offset by five hours

function convertToGMT( $local_date ) {
$date = new DateTime( $local_date, new 
DateTimeZone('America/New_York') );

$date->setTimezone( new DateTimeZone('GMT') );
$gmt_date = $date->format('Y-m-d H:i:s');
return $gmt_date;
}
=== php code ===

For date intervals:

=== php code ===
$date = new DateTime( '2013-11-01 00:00:00', new 
DateTimeZone('America/New_York') );

$date->add( new DateInterval('P7D') ); // 7 days
$date->setTimezone( new DateTimeZone('GMT') );
assert( $date->format('Y-m-d H:i:s') == '2013-11-08 05:00:00' );
=== php code ===

Just be careful with mutable vs. immutable DateTime objects ;)

I wouldn't mess with "23:59:59". Instead, use specific comparisons to 
make it work:
SELECT * FROM `journal_entry` WHERE `occurrence_date` >= "2013-01-01 
00:00:00" AND `occurrence_date` < "2013-11-08 00:00:00";
...if you're really that concerned about that one second. Alternatively 
you could use DateTime::sub() to subtract a single second and still use 
BETWEEN.
I would argue that one second doesn't matter for almost any application, 
but I obsess over such details myself, so I can't argue that point too 
strongly ;)



For reports on a given month or range of months, you can use different 
DateInterval values ("P1M", etc.), or get the number of days in any 
given month from PHP's date() command.


btw, if you were considering doing all of the work in SQL (MySQL), you 
could do:

=== sql query ===
SELECT * FROM `journal_entry` WHERE `occurrence_date` BETWEEN
CONVERT_TZ( DATE_SUB(:end_date_in_local_time, INTERVAL 7 DAY), 
:local_tz, "GMT" )

AND
CONVERT_TZ(:end_date_in_local_time, :local_tz, "GMT");
=== sql query ===


For the specific problems you called out:
1) Calculating what time it is in GMT when it is midnight in the user's 
time zone X days ago:
You just need to use DateTime::sub() to subtract X days 
(DateInterval('P'.$X_days.'D')) from midnight today (date('Y-m-d 
00:00:00')), then convert the result to GMT. Note that this is "midnight 
this morning" from PHP's perspective if you use date()... my example 
below takes into account the user's timezone.

2) Calculating midnight on November 1st 2013 in the user's time zone:
$date = new DateTime( '2013-11-01 00:00:00', new 
DateTimeZone($user_tz_str) );


I'll finish with one very specific example for one of the problems you 
mentioned.

3) Building a query for "the last 3 months".

=== php code ===
$user_tz_str = 'America/New_York';
$tz_user = new DateTimeZone($user_tz_str);
$tz_gmt = new DateTimezone('GMT'); // or UTC, or whatever...

// I wasn't sure which way you meant here, so I did a few.
// I think you'll be able to figure out what you want to do based on one 
of these or some variation on them.
$starting_point = 'this morning'; // 'this morning' or 'now' or 'ending 
before this month'


if( $starting_point == 'this morning' )
{
// do 3 months back from midnight this morning.
$day_date = new DateTime();
$day_date->setTimezone( $tz_user );
// $day_date->format('Y-m-d').'00:00:00' is midnight "this morning" 
from the perspective of the user's current time
$end_date = new DateTime( $day_date->format('Y-m-d').'00:00:00', 
$tz_user );

}
else if( $starting_point == 'ending before this month' )
{
// do three months prior to when this month started.
$day_date = new DateTime();
$day_date->setTimezone( $tz_user );
$end_date = new DateTime( $day_date->format('Y-m').'-01 00:00:00', 
$tz_user );

}
else
{
// use now. User timezone doesn't even matter.
$end_date = new DateTime();
}

$start_date = clone $end_date; // clone the object or you'll make a mess 
of things.
$start_date->sub( new DateInterval('P3M') ); // subtract 3 months. You 
could use whatever DateInterval you want here.


// make sure you do timezone conversion AFTER the DateInterval is 
subtracted, if you care about daylight savings time.

$start_date->setTimezone( $tz_gmt );
$end_date->setTimezone( $tz_gmt );

/*
 * At this point:
 * $start_dt->format('Y-m-d H:i:s') == the beginning of our interval in GMT
 * $end_dt->format('Y-m-d H:i:s') == the end of our interval in GMT
 */

// We'll use a PDO prepared statement as an example here. Assume $dbh 
comes from somewhere above...
$sth = $dbh->prepare( 'SELECT * FROM `journal_entry` WHERE 
`occurrence_date` BETWEEN :start_dt_gmt AND :end_dt_gmt' );
$sth->bindParam(':start_dt_gmt', $start_dt->format('Y-m-d H:i:s'), 
PDO::PARAM_STR);
$sth->bindParam(':end_dt_gmt', $end_dt->format('Y-m-d H:i:s'), 
PDO::PARAM_STR);

$sth->execute();
=== php code ===


Hope this helps,

-Matt


On 11/10/2013 08:26 AM PT, Ron Piggott wrote:

Hi Everyone

I need help knowing how to

Re: [PHP-DB] Subject Matter

2013-08-27 Thread Daniel Brown
On Tue, Aug 27, 2013 at 12:10 PM, Matijn Woudt  wrote:
>
> Uh, you're right. I meant moderator..

Yeah, as far as moderation, we only do in extreme circumstances.

-- 

Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP-DB] Subject Matter

2013-08-27 Thread Matijn Woudt
Op 27 aug. 2013 18:06 schreef "Daniel Brown"  het
volgende:
>
> On Fri, Aug 23, 2013 at 4:21 AM, Matijn Woudt  wrote:
> >
> > The problem is: there is no maintainer;)
>
> Sure there is.
>
> --
> 
> Network Infrastructure Manager
> http://www.php.net/

Uh, you're right. I meant moderator..


Re: [PHP-DB] Subject Matter

2013-08-27 Thread Daniel Brown
On Fri, Aug 23, 2013 at 4:21 AM, Matijn Woudt  wrote:
>
> The problem is: there is no maintainer;)

Sure there is.

-- 

Network Infrastructure Manager
http://www.php.net/

-- 
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] Subject Matter

2013-08-26 Thread Michael Stowe
*"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...


On Mon, Aug 26, 2013 at 9:32 AM, Thomas Rudy  wrote:

> There are a lot of off topic emails sent. But there is far more whining and
> complaining. Good grief!
>
>
> On Fri, Aug 23, 2013 at 2:40 PM, Tamara Temple  >wrote:
>
> >
> > On Aug 23, 2013, at 7:32 AM, Jim Giner 
> > wrote:
> >
> > > On 8/23/2013 4:52 AM, Matt Pelmear wrote:
> > >> On 08/23/2013 04:36 PM, Lester Caine wrote:
> > >>> Matt Pelmear wrote:
> >  I am not sure who runs the list, whether they care about off-topic
> >  posts,
> >  or whether anyone else cares about it.
> > >>>
> > >>> The php lists are only loosely moderated, but comments like yours
> > >>> usually bring things under control. I'd refer you to my recent post
> > >>> thought as to why the current threads are not that far off topic ;)
> > >>>
> > >>
> > >> Indeed, that thread is one that is on topic... but I think the
> > >> signal-to-noise ratio on this list is rather poor ;)
> > >> If I'm the only one bothered by it, it's no big deal for me to
> > >> unsubscribe... I just thought I'd check the general opinion first.
> > >> I don't run into these problems on the internals list... :-)
> > >>
> > >> -Matt
> > >>
> > > Funny - I never knew this list was handling  off-topic posts that
> > regularly.  I always thought this list was about using php to access
> > database info and the problems incurred, such as Ethan's recent post
> about
> > his bad query code.
> > >
> > > So - this is supposed to be about "database integration"?  I'll have to
> > reconsider my subscription choice as well, just as soon as I look up
> > whatever the heck that is.  :)
> >
> > This is the description on www.php.net/mailing-lists.php:
> >
> > "Databases and PHP
> > This list is for the discussion of PHP database topics"
> >
> > Nothing more specific than that. I, personally, don't know of any PHP
> > databases, so I'm going to assume it means the broader interpretation of
> > using PHP with databases.
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>



-- 
---

"My command is this: Love each other as I
have loved you." John 15:12

---


Re: [PHP-DB] Subject Matter

2013-08-26 Thread Thomas Rudy
There are a lot of off topic emails sent. But there is far more whining and
complaining. Good grief!


On Fri, Aug 23, 2013 at 2:40 PM, Tamara Temple wrote:

>
> On Aug 23, 2013, at 7:32 AM, Jim Giner 
> wrote:
>
> > On 8/23/2013 4:52 AM, Matt Pelmear wrote:
> >> On 08/23/2013 04:36 PM, Lester Caine wrote:
> >>> Matt Pelmear wrote:
>  I am not sure who runs the list, whether they care about off-topic
>  posts,
>  or whether anyone else cares about it.
> >>>
> >>> The php lists are only loosely moderated, but comments like yours
> >>> usually bring things under control. I'd refer you to my recent post
> >>> thought as to why the current threads are not that far off topic ;)
> >>>
> >>
> >> Indeed, that thread is one that is on topic... but I think the
> >> signal-to-noise ratio on this list is rather poor ;)
> >> If I'm the only one bothered by it, it's no big deal for me to
> >> unsubscribe... I just thought I'd check the general opinion first.
> >> I don't run into these problems on the internals list... :-)
> >>
> >> -Matt
> >>
> > Funny - I never knew this list was handling  off-topic posts that
> regularly.  I always thought this list was about using php to access
> database info and the problems incurred, such as Ethan's recent post about
> his bad query code.
> >
> > So - this is supposed to be about "database integration"?  I'll have to
> reconsider my subscription choice as well, just as soon as I look up
> whatever the heck that is.  :)
>
> This is the description on www.php.net/mailing-lists.php:
>
> "Databases and PHP
> This list is for the discussion of PHP database topics"
>
> Nothing more specific than that. I, personally, don't know of any PHP
> databases, so I'm going to assume it means the broader interpretation of
> using PHP with databases.
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP-DB] Subject Matter

2013-08-23 Thread Tamara Temple

On Aug 23, 2013, at 7:32 AM, Jim Giner  wrote:

> On 8/23/2013 4:52 AM, Matt Pelmear wrote:
>> On 08/23/2013 04:36 PM, Lester Caine wrote:
>>> Matt Pelmear wrote:
 I am not sure who runs the list, whether they care about off-topic
 posts,
 or whether anyone else cares about it.
>>> 
>>> The php lists are only loosely moderated, but comments like yours
>>> usually bring things under control. I'd refer you to my recent post
>>> thought as to why the current threads are not that far off topic ;)
>>> 
>> 
>> Indeed, that thread is one that is on topic... but I think the
>> signal-to-noise ratio on this list is rather poor ;)
>> If I'm the only one bothered by it, it's no big deal for me to
>> unsubscribe... I just thought I'd check the general opinion first.
>> I don't run into these problems on the internals list... :-)
>> 
>> -Matt
>> 
> Funny - I never knew this list was handling  off-topic posts that regularly.  
> I always thought this list was about using php to access database info and 
> the problems incurred, such as Ethan's recent post about his bad query code.
> 
> So - this is supposed to be about "database integration"?  I'll have to 
> reconsider my subscription choice as well, just as soon as I look up whatever 
> the heck that is.  :)

This is the description on www.php.net/mailing-lists.php:

"Databases and PHP
This list is for the discussion of PHP database topics"

Nothing more specific than that. I, personally, don't know of any PHP 
databases, so I'm going to assume it means the broader interpretation of using 
PHP with databases.


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



Re: [PHP-DB] Subject Matter

2013-08-23 Thread Jim Giner

On 8/23/2013 4:52 AM, Matt Pelmear wrote:

On 08/23/2013 04:36 PM, Lester Caine wrote:

Matt Pelmear wrote:

I am not sure who runs the list, whether they care about off-topic
posts,
or whether anyone else cares about it.


The php lists are only loosely moderated, but comments like yours
usually bring things under control. I'd refer you to my recent post
thought as to why the current threads are not that far off topic ;)



Indeed, that thread is one that is on topic... but I think the
signal-to-noise ratio on this list is rather poor ;)
If I'm the only one bothered by it, it's no big deal for me to
unsubscribe... I just thought I'd check the general opinion first.
I don't run into these problems on the internals list... :-)

-Matt

Funny - I never knew this list was handling  off-topic posts that 
regularly.  I always thought this list was about using php to access 
database info and the problems incurred, such as Ethan's recent post 
about his bad query code.


So - this is supposed to be about "database integration"?  I'll have to 
reconsider my subscription choice as well, just as soon as I look up 
whatever the heck that is.  :)



--
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 Jim Giner

On 8/23/2013 4:32 AM, Lester Caine wrote:

Karl DeSaulniers wrote:

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...


But the problem tha5 has been identified will never be flagged by simple
highlighting. Debugging complex SQL queries is possibly better done
outside of the PHP pages. Not sure exactly what SQL plug-in I've got
running on Eclipse at the moment, but as Ethan identified earlier, the
SQL script ran from the command line. It was passing the variables into
it which was wrong.

I'm with him on the statement that MySQL should have returned an error.
Certainly Firebird would have done and so identifying the problem might
have been easier.

I think the reason he didn't get the error was cause of his lack of a 
connection which never allowed it to run.


--
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 Jim Giner

On 8/22/2013 8:08 PM, Ethan Rosenberg wrote:


Ethan Rosenberg, PhD
/Pres/CEO/
*Hygeia Biomedical Research, Inc*
2 Cameo Ridge Road
Monsey, NY 10952
T: 845 352-3908
F: 845 352-7566
erosenb...@hygeiabiomedical.com
On 08/22/2013 06:56 PM, Jim Giner wrote:

On 8/22/2013 4:14 PM, Ethan Rosenberg wrote:

On 08/22/2013 11:54 AM, Jim Giner wrote:

On 8/22/2013 9:52 AM, Jim Giner wrote:

On 8/21/2013 7:48 PM, Ethan Rosenberg wrote:

Dear List -

I can't figure this out

mysql> describe Inventory;
+-+-+--+-+-+---+
| Field   | Type| Null | Key | Default | Extra |
+-+-+--+-+-+---+
| UPC | varchar(14) | YES  | | NULL |   |
| quant   | int(5)  | NO   | | NULL |   |
| manuf   | varchar(20) | YES  | | NULL |   |
| item| varchar(50) | YES  | | NULL |   |
| orderpt | tinyint(4)  | NO   | | NULL |   |
| ordrpt_flag | tinyint(3)  | YES  | | NULL |   |
| stock   | int(3)  | YES  | | NULL |   |
+-+-+--+-+-+---+

Here are code snippets -

   $upc   = $_SESSION['UPC'];
   $qnt   = $_POST['quant'];
   $mnf   = $_POST['manuf'];
   $itm   = $_POST['item'];
   $odrpt = $_POST['oderpt'];
   $opf   = $_POST['ordrpt_flag'];
   $stk= $_POST['stock'];

   $sql2 = "insert into Inventory (UPC,
quant,
manuf, item, orderpt, ordrpt_flag, stock)"
 ."values ('$upc',
$qnt,'$mnf','$itm',
odrpt, 0, $stk)";
   $result2 = mysqli_query(cxn, $sql2);
   echo '$sql2';
   print_r($sql2);
   echo "$upc $qnt $mnf $itm $odrpt
$opf
$stk";
   if (!$result2)
 die('Could not enter data: ' .
mysqli_error());

The mysql query fails.  I cannot figure out why.  It works from the
command line.

TIA

Ethan




Ethan - you are simply missing two dollar signs as pointed out. Once
you correct them, if there are any more errors you should then be
seeing
the message from mysqli_error.

And as for the advice to dump single quotes, I'd ignore it. The use of
double and single quotes is a very handy feature and makes for very
readable code.  Escaping double quotes is such a royal pia and
makes for
more trouble deciphering code later on.  The sample you provided
for us
is some of the best and most understandable code you've ever showed
us.


Also - Ethan - if you used an editor that was designed for php you
probably would have seen these missing $ signs since a good one would
highlight php syntax and the lack of the $ would have produced a
different color than you expected.


Jim -

I  used Netbeans.  All it said is "variable unused is scope", which is
a  error that I often find does not mean anything.  I am as pressurized
as you are.  Any suggestions as to an editor?

Ethan



Did you mean to say "unused IN scope"?  That would be telling you that
it is not yet defined and that could be a problem if you expect to be
already defined.

Several other posts here have listed their favorites.  Notepad ++
seems to be a favorite.  I use HTML-kit Tools as my developing
environment. Handles highlighting for php, html and js, as well as
project organization.  Also includes an ftp engine to allow me to
modify, upload and then go test my code very quickly. (I don't run php
or apache locally.)

Jim -

Thanks.

unused IN scope - correct.

There are lots of editors mentioned in this email trail.  I thank all
for the suggestions.

Netbeans, Aptana Studio, etc will all highlight code and show the errors
the code would generate in a browse. The problem here was two missing $
signs.

I'm probably wrong, but in some contexts; eg, sql query, $ signs are not
used.  I tried and added the incorrect $ sign, and Netbeans did not
complain.  If anyone knows of an editor that will able to spot this kind
of error, please inform the list.

Ethan

Wrong in one sense - all php vars must have a $ sign.  When building a 
query statemtent, if the editor doesn't tell you something (by not 
colorizing it) Sql is going to tell you when you attempt to run it. 
That's why one should ALWAYS include an error check after any operation.


BTW - this line
echo '$sql2';

isn't going to give you what you want.

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



Re: [PHP-DB] Subject Matter

2013-08-23 Thread Lester Caine

Matt Pelmear wrote:

On 08/23/2013 04:36 PM, Lester Caine wrote:

Matt Pelmear wrote:

I am not sure who runs the list, whether they care about off-topic posts,
or whether anyone else cares about it.


The php lists are only loosely moderated, but comments like yours usually
bring things under control. I'd refer you to my recent post thought as to why
the current threads are not that far off topic ;)



Indeed, that thread is one that is on topic... but I think the signal-to-noise
ratio on this list is rather poor ;)
If I'm the only one bothered by it, it's no big deal for me to unsubscribe... I
just thought I'd check the general opinion first.
I don't run into these problems on the internals list... :-)


In reality there are probably too many lists and none are policed particularly 
well. My email setup strips each to it's own folder so I can simply ignore 
things if I want, but occasionally something pops up which needs redirecting. We 
have a firebird php list which handles the firebird and interbase drivers so 
those sort of enquiries get redirected. But I must have a clean out some time. 
The first message on this list is 1999 ... and I have some older lists still 
archived :)


--
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

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



Re: [PHP-DB] Subject Matter

2013-08-23 Thread Matt Pelmear

On 08/23/2013 04:36 PM, Lester Caine wrote:

Matt Pelmear wrote:
I am not sure who runs the list, whether they care about off-topic 
posts,

or whether anyone else cares about it.


The php lists are only loosely moderated, but comments like yours 
usually bring things under control. I'd refer you to my recent post 
thought as to why the current threads are not that far off topic ;)




Indeed, that thread is one that is on topic... but I think the 
signal-to-noise ratio on this list is rather poor ;)
If I'm the only one bothered by it, it's no big deal for me to 
unsubscribe... I just thought I'd check the general opinion first.

I don't run into these problems on the internals list... :-)

-Matt


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



Re: [PHP-DB] Subject Matter

2013-08-23 Thread Lester Caine

Matt Pelmear wrote:

I am not sure who runs the list, whether they care about off-topic posts,
or whether anyone else cares about it.


The php lists are only loosely moderated, but comments like yours usually bring 
things under control. I'd refer you to my recent post thought as to why the 
current threads are not that far off topic ;)


--
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

--
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 Lester Caine

Karl DeSaulniers wrote:

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...


But the problem tha5 has been identified will never be flagged by simple 
highlighting. Debugging complex SQL queries is possibly better done outside of 
the PHP pages. Not sure exactly what SQL plug-in I've got running on Eclipse at 
the moment, but as Ethan identified earlier, the SQL script ran from the command 
line. It was passing the variables into it which was wrong.


I'm with him on the statement that MySQL should have returned an error. 
Certainly Firebird would have done and so identifying the problem might have 
been easier.


--
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

--
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 Lester Caine

Michael Oki wrote:

Install Komodo IDE or Adobe Dreamweaver. They'll highlight errors and warnings.

Last time I looked neither were free?

Eclipse has served me well for many years and while it has it's problems often 
someone comes up with a new plugin to sort it. My problem is dealing with the 
errors and warnings in the third party libraries - it flags them as well :)


--
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

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



Re: [PHP-DB] Subject Matter

2013-08-23 Thread Matijn Woudt
On Fri, Aug 23, 2013 at 10:15 AM, Matt Pelmear  wrote:

> Hello all,
>
> I am subscribed to this list because of my interest in PHP's database
> integration. At this point only a small percentage of the messages are
> related to that.
>
> I am not sure who runs the list, whether they care about off-topic posts,
> or whether anyone else cares about it.
>
> I, however, do.
>
> Therefore, I would like to ask the group whether anyone else cares about
> this, or whether I should simply unsubscribe to reduce clutter in my inbox.
> One way or the other I would like to receive only messages of interest to
> me (i.e., those pertaining to the subject matter of the list I subscribed
> to).
>
> Thoughts appreciated.
>
> -Matt
>

The problem is: there is no maintainer;)


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
>> 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
>> 
>> 
>> --
>> 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] Bluefish for PHP

2013-08-23 Thread Michael Oki
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
> 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
>
>
> --
> 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 Lester Caine

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
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

--
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 Michael Oki
Simply install wamp server and save yourself from separate installation of
MySQL,PHP,Apache server,phpMyAdmin and sqlite.
Check the link below.

 http://wampserver.com


On 23 August 2013 01:29, Ethan Rosenberg wrote:

> Dear List -
>
> How do I configure Bluefish for PHP?  I am running version 2.2.4 of
> Bluefish.
>
> TIA
>
> Ethan
>
> --
> 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 Lester Caine

Ethan Rosenberg wrote:

I'm probably wrong, but in some contexts; eg, sql query, $ signs are not used.
I tried and added the incorrect $ sign, and Netbeans did not complain.  If
anyone knows of an editor that will able to spot this kind of error, please
inform the list.


You do need to take a little more care when using variables IN strings and watch 
that they are highlighted. As you say, the parsing is not actually wrong as it 
is valid 'text' and adding SQL parsers for every database is not really 
practical and probably would not fix the problem anyway? Personally I use 
Firebird, and have always built the SQL using parameters, so that the SQL is 
pure text, and values are passed in an array. This is something MySQL was a lot 
later in catching onto, but many of the simple security problems are totally 
eliminated using that approach.


--
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

--
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-22 Thread Ethan Rosenberg


Ethan Rosenberg, PhD
/Pres/CEO/
*Hygeia Biomedical Research, Inc*
2 Cameo Ridge Road
Monsey, NY 10952
T: 845 352-3908
F: 845 352-7566
erosenb...@hygeiabiomedical.com
On 08/22/2013 06:56 PM, Jim Giner wrote:

On 8/22/2013 4:14 PM, Ethan Rosenberg wrote:

On 08/22/2013 11:54 AM, Jim Giner wrote:

On 8/22/2013 9:52 AM, Jim Giner wrote:

On 8/21/2013 7:48 PM, Ethan Rosenberg wrote:

Dear List -

I can't figure this out

mysql> describe Inventory;
+-+-+--+-+-+---+
| Field   | Type| Null | Key | Default | Extra |
+-+-+--+-+-+---+
| UPC | varchar(14) | YES  | | NULL |   |
| quant   | int(5)  | NO   | | NULL |   |
| manuf   | varchar(20) | YES  | | NULL |   |
| item| varchar(50) | YES  | | NULL |   |
| orderpt | tinyint(4)  | NO   | | NULL |   |
| ordrpt_flag | tinyint(3)  | YES  | | NULL |   |
| stock   | int(3)  | YES  | | NULL |   |
+-+-+--+-+-+---+

Here are code snippets -

   $upc   = $_SESSION['UPC'];
   $qnt   = $_POST['quant'];
   $mnf   = $_POST['manuf'];
   $itm   = $_POST['item'];
   $odrpt = $_POST['oderpt'];
   $opf   = $_POST['ordrpt_flag'];
   $stk= $_POST['stock'];

   $sql2 = "insert into Inventory (UPC, 
quant,

manuf, item, orderpt, ordrpt_flag, stock)"
 ."values ('$upc', 
$qnt,'$mnf','$itm',

odrpt, 0, $stk)";
   $result2 = mysqli_query(cxn, $sql2);
   echo '$sql2';
   print_r($sql2);
   echo "$upc $qnt $mnf $itm $odrpt 
$opf

$stk";
   if (!$result2)
 die('Could not enter data: ' .
mysqli_error());

The mysql query fails.  I cannot figure out why.  It works from the
command line.

TIA

Ethan




Ethan - you are simply missing two dollar signs as pointed out. Once
you correct them, if there are any more errors you should then be 
seeing

the message from mysqli_error.

And as for the advice to dump single quotes, I'd ignore it. The use of
double and single quotes is a very handy feature and makes for very
readable code.  Escaping double quotes is such a royal pia and 
makes for
more trouble deciphering code later on.  The sample you provided 
for us
is some of the best and most understandable code you've ever showed 
us.



Also - Ethan - if you used an editor that was designed for php you
probably would have seen these missing $ signs since a good one would
highlight php syntax and the lack of the $ would have produced a
different color than you expected.


Jim -

I  used Netbeans.  All it said is "variable unused is scope", which is
a  error that I often find does not mean anything.  I am as pressurized
as you are.  Any suggestions as to an editor?

Ethan


Did you mean to say "unused IN scope"?  That would be telling you that 
it is not yet defined and that could be a problem if you expect to be 
already defined.


Several other posts here have listed their favorites.  Notepad ++ 
seems to be a favorite.  I use HTML-kit Tools as my developing 
environment. Handles highlighting for php, html and js, as well as 
project organization.  Also includes an ftp engine to allow me to 
modify, upload and then go test my code very quickly. (I don't run php 
or apache locally.)

Jim -

Thanks.

unused IN scope - correct.

There are lots of editors mentioned in this email trail.  I thank all 
for the suggestions.


Netbeans, Aptana Studio, etc will all highlight code and show the errors 
the code would generate in a browse. The problem here was two missing $ 
signs.


I'm probably wrong, but in some contexts; eg, sql query, $ signs are not 
used.  I tried and added the incorrect $ sign, and Netbeans did not 
complain.  If anyone knows of an editor that will able to spot this kind 
of error, please inform the list.


Ethan


--
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-22 Thread Jim Giner

On 8/22/2013 4:14 PM, Ethan Rosenberg wrote:

On 08/22/2013 11:54 AM, Jim Giner wrote:

On 8/22/2013 9:52 AM, Jim Giner wrote:

On 8/21/2013 7:48 PM, Ethan Rosenberg wrote:

Dear List -

I can't figure this out

mysql> describe Inventory;
+-+-+--+-+-+---+
| Field   | Type| Null | Key | Default | Extra |
+-+-+--+-+-+---+
| UPC | varchar(14) | YES  | | NULL |   |
| quant   | int(5)  | NO   | | NULL |   |
| manuf   | varchar(20) | YES  | | NULL |   |
| item| varchar(50) | YES  | | NULL |   |
| orderpt | tinyint(4)  | NO   | | NULL |   |
| ordrpt_flag | tinyint(3)  | YES  | | NULL |   |
| stock   | int(3)  | YES  | | NULL |   |
+-+-+--+-+-+---+

Here are code snippets -

   $upc   = $_SESSION['UPC'];
   $qnt   = $_POST['quant'];
   $mnf   = $_POST['manuf'];
   $itm   = $_POST['item'];
   $odrpt = $_POST['oderpt'];
   $opf   = $_POST['ordrpt_flag'];
   $stk= $_POST['stock'];

   $sql2 = "insert into Inventory (UPC, quant,
manuf, item, orderpt, ordrpt_flag, stock)"
 ."values ('$upc', $qnt,'$mnf','$itm',
odrpt, 0, $stk)";
   $result2 = mysqli_query(cxn, $sql2);
   echo '$sql2';
   print_r($sql2);
   echo "$upc $qnt $mnf $itm $odrpt $opf
$stk";
   if (!$result2)
 die('Could not enter data: ' .
mysqli_error());

The mysql query fails.  I cannot figure out why.  It works from the
command line.

TIA

Ethan




Ethan - you are simply missing two dollar signs as pointed out. Once
you correct them, if there are any more errors you should then be seeing
the message from mysqli_error.

And as for the advice to dump single quotes, I'd ignore it.  The use of
double and single quotes is a very handy feature and makes for very
readable code.  Escaping double quotes is such a royal pia and makes for
more trouble deciphering code later on.  The sample you provided for us
is some of the best and most understandable code you've ever showed us.


Also - Ethan - if you used an editor that was designed for php you
probably would have seen these missing $ signs since a good one would
highlight php syntax and the lack of the $ would have produced a
different color than you expected.


Jim -

I  used Netbeans.  All it said is "variable unused is scope", which is
a  error that I often find does not mean anything.  I am as pressurized
as you are.  Any suggestions as to an editor?

Ethan


Did you mean to say "unused IN scope"?  That would be telling you that 
it is not yet defined and that could be a problem if you expect to be 
already defined.


Several other posts here have listed their favorites.  Notepad ++ seems 
to be a favorite.  I use HTML-kit Tools as my developing environment. 
Handles highlighting for php, html and js, as well as project 
organization.  Also includes an ftp engine to allow me to modify, upload 
and then go test my code very quickly. (I don't run php or apache locally.)


--
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-22 Thread Ethan Rosenberg

On 08/22/2013 11:54 AM, Jim Giner wrote:

On 8/22/2013 9:52 AM, Jim Giner wrote:

On 8/21/2013 7:48 PM, Ethan Rosenberg wrote:

Dear List -

I can't figure this out

mysql> describe Inventory;
+-+-+--+-+-+---+
| Field   | Type| Null | Key | Default | Extra |
+-+-+--+-+-+---+
| UPC | varchar(14) | YES  | | NULL |   |
| quant   | int(5)  | NO   | | NULL |   |
| manuf   | varchar(20) | YES  | | NULL |   |
| item| varchar(50) | YES  | | NULL |   |
| orderpt | tinyint(4)  | NO   | | NULL |   |
| ordrpt_flag | tinyint(3)  | YES  | | NULL |   |
| stock   | int(3)  | YES  | | NULL |   |
+-+-+--+-+-+---+

Here are code snippets -

   $upc   = $_SESSION['UPC'];
   $qnt   = $_POST['quant'];
   $mnf   = $_POST['manuf'];
   $itm   = $_POST['item'];
   $odrpt = $_POST['oderpt'];
   $opf   = $_POST['ordrpt_flag'];
   $stk= $_POST['stock'];

   $sql2 = "insert into Inventory (UPC, quant,
manuf, item, orderpt, ordrpt_flag, stock)"
 ."values ('$upc', $qnt,'$mnf','$itm',
odrpt, 0, $stk)";
   $result2 = mysqli_query(cxn, $sql2);
   echo '$sql2';
   print_r($sql2);
   echo "$upc $qnt $mnf $itm $odrpt $opf
$stk";
   if (!$result2)
 die('Could not enter data: ' .
mysqli_error());

The mysql query fails.  I cannot figure out why.  It works from the
command line.

TIA

Ethan




Ethan - you are simply missing two dollar signs as pointed out. Once
you correct them, if there are any more errors you should then be seeing
the message from mysqli_error.

And as for the advice to dump single quotes, I'd ignore it.  The use of
double and single quotes is a very handy feature and makes for very
readable code.  Escaping double quotes is such a royal pia and makes for
more trouble deciphering code later on.  The sample you provided for us
is some of the best and most understandable code you've ever showed us.

Also - Ethan - if you used an editor that was designed for php you 
probably would have seen these missing $ signs since a good one would 
highlight php syntax and the lack of the $ would have produced a 
different color than you expected.



Jim -

I  used Netbeans.  All it said is "variable unused is scope", which is 
a  error that I often find does not mean anything.  I am as pressurized 
as you are.  Any suggestions as to an editor?


Ethan



--
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-22 Thread Ethan Rosenberg, PhD

On 08/22/2013 09:51 AM, Jim Giner wrote:

On 8/21/2013 7:48 PM, Ethan Rosenberg wrote:

Dear List -

I can't figure this out

mysql> describe Inventory;
+-+-+--+-+-+---+
| Field   | Type| Null | Key | Default | Extra |
+-+-+--+-+-+---+
| UPC | varchar(14) | YES  | | NULL |   |
| quant   | int(5)  | NO   | | NULL |   |
| manuf   | varchar(20) | YES  | | NULL |   |
| item| varchar(50) | YES  | | NULL |   |
| orderpt | tinyint(4)  | NO   | | NULL |   |
| ordrpt_flag | tinyint(3)  | YES  | | NULL |   |
| stock   | int(3)  | YES  | | NULL |   |
+-+-+--+-+-+---+

Here are code snippets -

   $upc   = $_SESSION['UPC'];
   $qnt   = $_POST['quant'];
   $mnf   = $_POST['manuf'];
   $itm   = $_POST['item'];
   $odrpt = $_POST['oderpt'];
   $opf   = $_POST['ordrpt_flag'];
   $stk= $_POST['stock'];

   $sql2 = "insert into Inventory (UPC, quant,
manuf, item, orderpt, ordrpt_flag, stock)"
 ."values ('$upc', $qnt,'$mnf','$itm',
odrpt, 0, $stk)";
   $result2 = mysqli_query(cxn, $sql2);
   echo '$sql2';
   print_r($sql2);
   echo "$upc $qnt $mnf $itm $odrpt $opf
$stk";
   if (!$result2)
 die('Could not enter data: ' .
mysqli_error());

The mysql query fails.  I cannot figure out why.  It works from the
command line.

TIA

Ethan



Ethan - you are simply missing two dollar signs as pointed out. Once 
you correct them, if there are any more errors you should then be 
seeing the message from mysqli_error.


And as for the advice to dump single quotes, I'd ignore it.  The use 
of double and single quotes is a very handy feature and makes for very 
readable code.  Escaping double quotes is such a royal pia and makes 
for more trouble deciphering code later on.  The sample you provided 
for us is some of the best and most understandable code you've ever 
showed us.

Jim -

Thanks for the complement.

Ethan


--
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-22 Thread Lester Caine

Vinay Kannan wrote:

Jim, I know this is a stupid question to be asking this far into PHP
Development, maybe was a bit lazy, or just got too used to Notepad++, which
editor for PHP are you using? The feature which you mentioned for a good
php editor, sounds exciting, offcourse i would be looking only at the free
ones


There are a number of options for highlighting and error checking just about 
every language. Running Linux most of them are free ;)
gedit and kwrite highlight automatically and help identify problems. In the past 
I've been running on both linux and windows so something cross platform was 
essential, and it's still nice when I do have to worry about windows sites. 
Eclipse provides that base, and while PDT is the official plugin for PHP, I'm 
back on the older PHPEclipse as it fits much better with the way I work. With 
properly commented libraries it provides pop-up crib sheets onthe parameters for 
a selected function, and of cause the auto complete can be configured to match 
your preferred way of working ... I'm still on tabs for indenting


--
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

--
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-22 Thread Vinay Kannan
Thanks Toby, Using Notepad ++ with the language selected to PHP, the syntax
coloring is on


On Thu, Aug 22, 2013 at 11:00 PM, Toby Hart Dyke  wrote:

>
> Notepad++ will do syntax highlighting. Go to Language > P > PHP with a PHP
> file open, and see the colours change! It should be automatic - are you
> using something other than 'php' as a file extension?
>
>   Toby
>
>
> On 8/22/2013 5:27 PM, Vinay Kannan wrote:
>
>> Jim, I know this is a stupid question to be asking this far into PHP
>> Development, maybe was a bit lazy, or just got too used to Notepad++,
>> which
>> editor for PHP are you using? The feature which you mentioned for a good
>> php editor, sounds exciting, offcourse i would be looking only at the free
>> ones :D
>>
>>
>> On Thu, Aug 22, 2013 at 9:24 PM, Jim Giner 
>> **wrote:
>>
>>
>
>>>   Also - Ethan - if you used an editor that was designed for php you
>>> probably would have seen these missing $ signs since a good one would
>>> highlight php syntax and the lack of the $ would have produced a
>>> different
>>> color than you expected.
>>>
>>>
>>>
>
> --
> 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-22 Thread Toby Hart Dyke


Notepad++ will do syntax highlighting. Go to Language > P > PHP with a 
PHP file open, and see the colours change! It should be automatic - are 
you using something other than 'php' as a file extension?


  Toby

On 8/22/2013 5:27 PM, Vinay Kannan wrote:

Jim, I know this is a stupid question to be asking this far into PHP
Development, maybe was a bit lazy, or just got too used to Notepad++, which
editor for PHP are you using? The feature which you mentioned for a good
php editor, sounds exciting, offcourse i would be looking only at the free
ones :D


On Thu, Aug 22, 2013 at 9:24 PM, Jim Giner wrote:





  Also - Ethan - if you used an editor that was designed for php you
probably would have seen these missing $ signs since a good one would
highlight php syntax and the lack of the $ would have produced a different
color than you expected.





--
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-22 Thread Vinay Kannan
Jim, I know this is a stupid question to be asking this far into PHP
Development, maybe was a bit lazy, or just got too used to Notepad++, which
editor for PHP are you using? The feature which you mentioned for a good
php editor, sounds exciting, offcourse i would be looking only at the free
ones :D


On Thu, Aug 22, 2013 at 9:24 PM, Jim Giner wrote:

> On 8/22/2013 9:52 AM, Jim Giner wrote:
>
>> On 8/21/2013 7:48 PM, Ethan Rosenberg wrote:
>>
>>> Dear List -
>>>
>>> I can't figure this out
>>>
>>> mysql> describe Inventory;
>>> +-+-+-**-+-+-+---+
>>> | Field   | Type| Null | Key | Default | Extra |
>>> +-+-+-**-+-+-+---+
>>> | UPC | varchar(14) | YES  | | NULL |   |
>>> | quant   | int(5)  | NO   | | NULL |   |
>>> | manuf   | varchar(20) | YES  | | NULL |   |
>>> | item| varchar(50) | YES  | | NULL |   |
>>> | orderpt | tinyint(4)  | NO   | | NULL |   |
>>> | ordrpt_flag | tinyint(3)  | YES  | | NULL |   |
>>> | stock   | int(3)  | YES  | | NULL |   |
>>> +-+-+-**-+-+-+---+
>>>
>>> Here are code snippets -
>>>
>>>$upc   = $_SESSION['UPC'];
>>>$qnt   = $_POST['quant'];
>>>$mnf   = $_POST['manuf'];
>>>$itm   = $_POST['item'];
>>>$odrpt = $_POST['oderpt'];
>>>$opf   = $_POST['ordrpt_flag'];
>>>$stk= $_POST['stock'];
>>>
>>>$sql2 = "insert into Inventory (UPC, quant,
>>> manuf, item, orderpt, ordrpt_flag, stock)"
>>>  ."values ('$upc', $qnt,'$mnf','$itm',
>>> odrpt, 0, $stk)";
>>>$result2 = mysqli_query(cxn, $sql2);
>>>echo '$sql2';
>>>print_r($sql2);
>>>echo "$upc $qnt $mnf $itm $odrpt $opf
>>> $stk";
>>>if (!$result2)
>>>  die('Could not enter data: ' .
>>> mysqli_error());
>>>
>>> The mysql query fails.  I cannot figure out why.  It works from the
>>> command line.
>>>
>>> TIA
>>>
>>> Ethan
>>>
>>>
>>>
>>>  Ethan - you are simply missing two dollar signs as pointed out.  Once
>> you correct them, if there are any more errors you should then be seeing
>> the message from mysqli_error.
>>
>> And as for the advice to dump single quotes, I'd ignore it.  The use of
>> double and single quotes is a very handy feature and makes for very
>> readable code.  Escaping double quotes is such a royal pia and makes for
>> more trouble deciphering code later on.  The sample you provided for us
>> is some of the best and most understandable code you've ever showed us.
>>
>>  Also - Ethan - if you used an editor that was designed for php you
> probably would have seen these missing $ signs since a good one would
> highlight php syntax and the lack of the $ would have produced a different
> color than you expected.
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP-DB] mysql query

2013-08-22 Thread Vinay Kannan
 $sql2 = "insert into Inventory (UPC, quant, manuf, item, orderpt,
ordrpt_flag, stock)  values ('$upc', '$qnt','$mnf','$itm', '$odrpt', 0,
$stk)";

Looks like, you have the ' ' missing for $qnt and odrpt had the $ and the
'' missing.
The above query should work, I haven't tested it though.
Also for no error, have you turned off the PHP error reporting?

It probably is working on the command line, since you posted actual values
there and in the PHP code, you are using the variables which I think were
not wrapped in the query correctly?


On Thu, Aug 22, 2013 at 12:51 PM, Michael Oki  wrote:

> Try the insertion like this:
> $sql2 = mysql_query("insert into Inventory (`UPC`
> , `quant`, `manuf`, `item`, `orderpt`, `ordrpt_flag`, `stock`)"
> ."values ('$upc', $qnt,'$mnf','$itm',
> '$odrpt', '0', '$stk') " ) or die(mysql_error());
>
> On 22 August 2013 05:10, Daniel Krook  wrote:
>
> > Ethan,
> >
> > What about:
> >
> > $result2 = mysqli_query(cxn, $sql2);
> >
> > Doesn't look like you're sending it a connection link as a variable
> ($cxn)
> > and that's passed through as a literal?
> >
> >
> >
> >
> > Thanks,
> >
> >
> > Daniel Krook
> > Software Engineer, Advanced Cloud Solutions, GTS
> >
> > IBM Senior Certified IT Specialist - L3 Thought Leader
> > The Open Group Certified IT Specialist - L3 Distinguished
> > Cloud, Java, PHP, BlackBerry, DB2 & Solaris Certified
> >
> >
> >
> >
> >
> >
> > Ethan Rosenberg  wrote on 08/21/2013
> > 11:59:19 PM:
> >
> > > From: Ethan Rosenberg 
> > > To: Daniel Krook/White Plains/IBM@IBMUS
> > > Cc: PHP Database List 
> > > Date: 08/21/2013 11:59 PM
> > > Subject: Re: [PHP-DB] mysql query
> > >
> > > On 08/21/2013 11:30 PM, Daniel Krook wrote:
> > > Ethan,
> > >
> > > It's hard to tell from the code formatting in your email what the
> > > exact problem might be, but a few reasons that this might fail in
> > > PHP rather than when sent to MySQL with hardcoded values:
> > >
> > > 1.  var_dump/print_r $_POST to see what you're getting as input is
> > > what you expect (and sanitize!).
> > >
> > > 2.  Check that the SQL statement concatenation in PHP is building
> > > the string you're expecting. It looks like you're joining 2 strings
> > > when defining $sql2 that doesn't leave a space between the close
> > > parentheses and "values." Compare this against what you're sending
> > > "on the command line."
> > >
> > > 3.  Get rid of all single quotes... escape your double quotes where
> > > needed. This will avoid any variable-in-string interpolation errors
> > > and may help you find the issue with input data. Same with your echo
> > > $sql2 statement... that's not going to give you the same thing as
> > > the print_r below it.
> > >
> > >
> > >
> > > Thanks,
> > >
> > >
> > > Daniel Krook
> > > Software Engineer, Advanced Cloud Solutions, GTS
> > >
> > > IBM Senior Certified IT Specialist - L3 Thought Leader
> > > The Open Group Certified IT Specialist - L3 Distinguished
> > > Cloud, Java, PHP, BlackBerry, DB2 & Solaris Certified
> > >
> > >
> > >
> > >
> > > Ethan Rosenberg  wrote on 08/21/
> > > 2013 07:48:12 PM:
> > >
> > > > From: Ethan Rosenberg 
> > > > To: PHP Database List 
> > > > Date: 08/21/2013 07:48 PM
> > > > Subject: [PHP-DB] mysql query
> > > >
> > > > Dear List -
> > > >
> > > > I can't figure this out
> > > >
> > > > mysql> describe Inventory;
> > > > +-+-+--+-+-+---+
> > > > | Field   | Type| Null | Key | Default | Extra |
> > > > +-+-+--+-+-+---+
> > > > | UPC | varchar(14) | YES  | | NULL |   |
> > > > | quant   | int(5)  | NO   | | NULL |   |
> > > > | manuf   | varchar(20) | YES  | | NULL |   |
> > > > | item| varchar(50) | YES  | | NULL |   |
> > > > | orderpt | tinyint(4)  

Re: [PHP-DB] mysql query

2013-08-22 Thread Michael Oki
Try the insertion like this:
$sql2 = mysql_query("insert into Inventory (`UPC`
, `quant`, `manuf`, `item`, `orderpt`, `ordrpt_flag`, `stock`)"
."values ('$upc', $qnt,'$mnf','$itm',
'$odrpt', '0', '$stk') " ) or die(mysql_error());

On 22 August 2013 05:10, Daniel Krook  wrote:

> Ethan,
>
> What about:
>
> $result2 = mysqli_query(cxn, $sql2);
>
> Doesn't look like you're sending it a connection link as a variable ($cxn)
> and that's passed through as a literal?
>
>
>
>
> Thanks,
>
>
> Daniel Krook
> Software Engineer, Advanced Cloud Solutions, GTS
>
> IBM Senior Certified IT Specialist - L3 Thought Leader
> The Open Group Certified IT Specialist - L3 Distinguished
> Cloud, Java, PHP, BlackBerry, DB2 & Solaris Certified
>
>
>
>
>
>
> Ethan Rosenberg  wrote on 08/21/2013
> 11:59:19 PM:
>
> > From: Ethan Rosenberg 
> > To: Daniel Krook/White Plains/IBM@IBMUS
> > Cc: PHP Database List 
> > Date: 08/21/2013 11:59 PM
> > Subject: Re: [PHP-DB] mysql query
> >
> > On 08/21/2013 11:30 PM, Daniel Krook wrote:
> > Ethan,
> >
> > It's hard to tell from the code formatting in your email what the
> > exact problem might be, but a few reasons that this might fail in
> > PHP rather than when sent to MySQL with hardcoded values:
> >
> > 1.  var_dump/print_r $_POST to see what you're getting as input is
> > what you expect (and sanitize!).
> >
> > 2.  Check that the SQL statement concatenation in PHP is building
> > the string you're expecting. It looks like you're joining 2 strings
> > when defining $sql2 that doesn't leave a space between the close
> > parentheses and "values." Compare this against what you're sending
> > "on the command line."
> >
> > 3.  Get rid of all single quotes... escape your double quotes where
> > needed. This will avoid any variable-in-string interpolation errors
> > and may help you find the issue with input data. Same with your echo
> > $sql2 statement... that's not going to give you the same thing as
> > the print_r below it.
> >
> >
> >
> > Thanks,
> >
> >
> > Daniel Krook
> > Software Engineer, Advanced Cloud Solutions, GTS
> >
> > IBM Senior Certified IT Specialist - L3 Thought Leader
> > The Open Group Certified IT Specialist - L3 Distinguished
> > Cloud, Java, PHP, BlackBerry, DB2 & Solaris Certified
> >
> >
> >
> >
> > Ethan Rosenberg  wrote on 08/21/
> > 2013 07:48:12 PM:
> >
> > > From: Ethan Rosenberg 
> > > To: PHP Database List 
> > > Date: 08/21/2013 07:48 PM
> > > Subject: [PHP-DB] mysql query
> > >
> > > Dear List -
> > >
> > > I can't figure this out
> > >
> > > mysql> describe Inventory;
> > > +-+-+--+-+-+---+
> > > | Field   | Type| Null | Key | Default | Extra |
> > > +-+-+--+-+-+---+
> > > | UPC | varchar(14) | YES  | | NULL |   |
> > > | quant   | int(5)  | NO   | | NULL |   |
> > > | manuf   | varchar(20) | YES  | | NULL |   |
> > > | item| varchar(50) | YES  | | NULL |   |
> > > | orderpt | tinyint(4)  | NO   | | NULL |   |
> > > | ordrpt_flag | tinyint(3)  | YES  | | NULL |   |
> > > | stock   | int(3)  | YES  | | NULL |   |
> > > +-+-+--+-+-+---+
> > >
> > > Here are code snippets -
> > >
> > >$upc   = $_SESSION['UPC'];
> > >$qnt   = $_POST['quant'];
> > >$mnf   = $_POST['manuf'];
> > >$itm   = $_POST['item'];
> > >$odrpt = $_POST['oderpt'];
> > >$opf   = $_POST['ordrpt_flag'];
> > >$stk= $_POST['stock'];
> > >
> > >$sql2 = "insert into Inventory (UPC, quant,
>
> > > manuf, item, orderpt, ordrpt_flag, stock)"
> > >  ."values ('$upc', $qnt,'$mnf','$itm',
>
> > > odrpt, 0, $stk)";
> > >$result2 = mysqli_query(cxn, $sql2);
> > >echo '$sql2';
> > >print_r($sql2);
> > >echo "$upc $qnt $mnf $itm $odrpt $opf
>
> > > $stk";
> > >if (!$result2)
> > >  die('Could not enter data: ' .
> > > mysqli_error());
> > >
> > > The mysql query fails.  I cannot figure out why.  It works from the
> > > command line.
> > >
> > > TIA
> > >
> > > Ethan
> > >
> > Daniel -
> >
> > Thanks.
> >
> > Tried all  your suggestions.
> >
> > Sorry, no luck.
> >
> > Ethan


Re: [PHP-DB] mysql query

2013-08-21 Thread Daniel Krook
Ethan,

What about:

$result2 = mysqli_query(cxn, $sql2);

Doesn't look like you're sending it a connection link as a variable ($cxn) 
and that's passed through as a literal?




Thanks,


Daniel Krook
Software Engineer, Advanced Cloud Solutions, GTS

IBM Senior Certified IT Specialist - L3 Thought Leader
The Open Group Certified IT Specialist - L3 Distinguished
Cloud, Java, PHP, BlackBerry, DB2 & Solaris Certified






Ethan Rosenberg  wrote on 08/21/2013 
11:59:19 PM:

> From: Ethan Rosenberg 
> To: Daniel Krook/White Plains/IBM@IBMUS
> Cc: PHP Database List 
> Date: 08/21/2013 11:59 PM
> Subject: Re: [PHP-DB] mysql query
> 
> On 08/21/2013 11:30 PM, Daniel Krook wrote:
> Ethan, 
> 
> It's hard to tell from the code formatting in your email what the 
> exact problem might be, but a few reasons that this might fail in 
> PHP rather than when sent to MySQL with hardcoded values: 
> 
> 1.  var_dump/print_r $_POST to see what you're getting as input is 
> what you expect (and sanitize!).
> 
> 2.  Check that the SQL statement concatenation in PHP is building 
> the string you're expecting. It looks like you're joining 2 strings 
> when defining $sql2 that doesn't leave a space between the close 
> parentheses and "values." Compare this against what you're sending 
> "on the command line."
> 
> 3.  Get rid of all single quotes... escape your double quotes where 
> needed. This will avoid any variable-in-string interpolation errors 
> and may help you find the issue with input data. Same with your echo
> $sql2 statement... that's not going to give you the same thing as 
> the print_r below it.
> 
> 
> 
> Thanks, 
> 
> 
> Daniel Krook
> Software Engineer, Advanced Cloud Solutions, GTS
> 
> IBM Senior Certified IT Specialist - L3 Thought Leader
> The Open Group Certified IT Specialist - L3 Distinguished
> Cloud, Java, PHP, BlackBerry, DB2 & Solaris Certified 
> 
> 
> 
> 
> Ethan Rosenberg  wrote on 08/21/
> 2013 07:48:12 PM:
> 
> > From: Ethan Rosenberg  
> > To: PHP Database List  
> > Date: 08/21/2013 07:48 PM 
> > Subject: [PHP-DB] mysql query 
> > 
> > Dear List -
> > 
> > I can't figure this out
> > 
> > mysql> describe Inventory;
> > +-+-+--+-+-+---+
> > | Field   | Type| Null | Key | Default | Extra |
> > +-+-+--+-+-+---+
> > | UPC | varchar(14) | YES  | | NULL |   |
> > | quant   | int(5)  | NO   | | NULL |   |
> > | manuf   | varchar(20) | YES  | | NULL |   |
> > | item| varchar(50) | YES  | | NULL |   |
> > | orderpt | tinyint(4)  | NO   | | NULL |   |
> > | ordrpt_flag | tinyint(3)  | YES  | | NULL |   |
> > | stock   | int(3)  | YES  | | NULL |   |
> > +-+-+--+-+-+---+
> > 
> > Here are code snippets -
> > 
> >$upc   = $_SESSION['UPC'];
> >$qnt   = $_POST['quant'];
> >$mnf   = $_POST['manuf'];
> >$itm   = $_POST['item'];
> >$odrpt = $_POST['oderpt'];
> >$opf   = $_POST['ordrpt_flag'];
> >$stk= $_POST['stock'];
> > 
> >$sql2 = "insert into Inventory (UPC, quant, 

> > manuf, item, orderpt, ordrpt_flag, stock)"
> >  ."values ('$upc', $qnt,'$mnf','$itm', 

> > odrpt, 0, $stk)";
> >$result2 = mysqli_query(cxn, $sql2);
> >echo '$sql2';
> >print_r($sql2);
> >echo "$upc $qnt $mnf $itm $odrpt $opf 

> > $stk";
> >if (!$result2)
> >  die('Could not enter data: ' . 
> > mysqli_error());
> > 
> > The mysql query fails.  I cannot figure out why.  It works from the 
> > command line.
> > 
> > TIA
> > 
> > Ethan
> > 
> Daniel -
> 
> Thanks.
> 
> Tried all  your suggestions.
> 
> Sorry, no luck.
> 
> Ethan

Re: [PHP-DB] mysql query

2013-08-21 Thread Daniel Krook
Ethan,

It's hard to tell from the code formatting in your email what the exact 
problem might be, but a few reasons that this might fail in PHP rather 
than when sent to MySQL with hardcoded values:

1.  var_dump/print_r $_POST to see what you're getting as input is what 
you expect (and sanitize!).

2.  Check that the SQL statement concatenation in PHP is building the 
string you're expecting. It looks like you're joining 2 strings when 
defining $sql2 that doesn't leave a space between the close parentheses 
and "values." Compare this against what you're sending "on the command 
line."

3.  Get rid of all single quotes... escape your double quotes where 
needed. This will avoid any variable-in-string interpolation errors and 
may help you find the issue with input data. Same with your echo $sql2 
statement... that's not going to give you the same thing as the print_r 
below it.



Thanks,


Daniel Krook
Software Engineer, Advanced Cloud Solutions, GTS

IBM Senior Certified IT Specialist - L3 Thought Leader
The Open Group Certified IT Specialist - L3 Distinguished
Cloud, Java, PHP, BlackBerry, DB2 & Solaris Certified





Ethan Rosenberg  wrote on 08/21/2013 
07:48:12 PM:

> From: Ethan Rosenberg 
> To: PHP Database List 
> Date: 08/21/2013 07:48 PM
> Subject: [PHP-DB] mysql query
> 
> Dear List -
> 
> I can't figure this out
> 
> mysql> describe Inventory;
> +-+-+--+-+-+---+
> | Field   | Type| Null | Key | Default | Extra |
> +-+-+--+-+-+---+
> | UPC | varchar(14) | YES  | | NULL |   |
> | quant   | int(5)  | NO   | | NULL |   |
> | manuf   | varchar(20) | YES  | | NULL |   |
> | item| varchar(50) | YES  | | NULL |   |
> | orderpt | tinyint(4)  | NO   | | NULL |   |
> | ordrpt_flag | tinyint(3)  | YES  | | NULL |   |
> | stock   | int(3)  | YES  | | NULL |   |
> +-+-+--+-+-+---+
> 
> Here are code snippets -
> 
>$upc   = $_SESSION['UPC'];
>$qnt   = $_POST['quant'];
>$mnf   = $_POST['manuf'];
>$itm   = $_POST['item'];
>$odrpt = $_POST['oderpt'];
>$opf   = $_POST['ordrpt_flag'];
>$stk= $_POST['stock'];
> 
>$sql2 = "insert into Inventory (UPC, quant, 
> manuf, item, orderpt, ordrpt_flag, stock)"
>  ."values ('$upc', $qnt,'$mnf','$itm', 
> odrpt, 0, $stk)";
>$result2 = mysqli_query(cxn, $sql2);
>echo '$sql2';
>print_r($sql2);
>echo "$upc $qnt $mnf $itm $odrpt $opf 
> $stk";
>if (!$result2)
>  die('Could not enter data: ' . 
> mysqli_error());
> 
> The mysql query fails.  I cannot figure out why.  It works from the 
> command line.
> 
> TIA
> 
> Ethan
> 
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


Re: [PHP-DB] mysql query

2013-08-21 Thread Ethan Rosenberg

On 08/21/2013 07:52 PM, Toby Hart Dyke wrote:


1) What is the error message?

2) This has an error:

>values ('$upc', $qnt,'$mnf','$itm', odrpt, 0, $stk)

Missing '$' in front of 'odrpt'.

  Toby


On 8/22/2013 12:48 AM, Ethan Rosenberg wrote:

Dear List -

I can't figure this out

mysql> describe Inventory;
+-+-+--+-+-+---+
| Field   | Type| Null | Key | Default | Extra |
+-+-+--+-+-+---+
| UPC | varchar(14) | YES  | | NULL |   |
| quant   | int(5)  | NO   | | NULL |   |
| manuf   | varchar(20) | YES  | | NULL |   |
| item| varchar(50) | YES  | | NULL |   |
| orderpt | tinyint(4)  | NO   | | NULL |   |
| ordrpt_flag | tinyint(3)  | YES  | | NULL |   |
| stock   | int(3)  | YES  | | NULL |   |
+-+-+--+-+-+---+

Here are code snippets -

  $upc   = $_SESSION['UPC'];
  $qnt   = $_POST['quant'];
  $mnf   = $_POST['manuf'];
  $itm   = $_POST['item'];
  $odrpt = $_POST['oderpt'];
  $opf   = $_POST['ordrpt_flag'];
  $stk= $_POST['stock'];

  $sql2 = "insert into Inventory (UPC, quant, 
manuf, item, orderpt, ordrpt_flag, stock)"
."values ('$upc', $qnt,'$mnf','$itm', 
odrpt, 0, $stk)";

  $result2 = mysqli_query(cxn, $sql2);
  echo '$sql2';
  print_r($sql2);
  echo "$upc $qnt $mnf $itm $odrpt $opf 
$stk";

  if (!$result2)
die('Could not enter data: ' . 
mysqli_error());


The mysql query fails.  I cannot figure out why.  It works from the 
command line.


TIA

Ethan


Toby -

The problem is that I do not get any error messages.

From this

  if (!$result2)
die('Could not enter data: ' . mysqli_error());

I only get the 'Could not enter data: and no error message.

Ethan


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



<    1   2   3   4   5   6   7   8   9   10   >