Re: [PHP-DB] mysql query

2013-08-21 Thread Toby Hart Dyke


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







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



Re: [PHP-DB] chmod

2013-08-19 Thread Matt Pelmear

Emiliano,

This question is totally out of scope for this mailing list. It has 
nothing to do with databases at all.


Also, you should _almost never_ use 0777 for permissions.
You probably want 0644. (Owner can read/write, all others can read.)

Regarding your question in general, it sounds like you are running this 
on a Windows environment. I can't personally speak to whether chmod() 
works well in that environment or not (I would never run a windows 
server or dev environment for that matter), but I suspect it may not be 
working as expected based on what you are describing, especially if you 
are using an older version of PHP.


I would be willing to further help you diagnose the problem (others may 
be as well), but I really think this does not belong on this mailing 
list and, as such, those discussions should be held off-list.


FYI, I think the appropriate forum for this question would be either the 
"General user list" or, if you are indeed using Windows, the "Windows 
PHP users list":

http://php.net/mailing-lists.php



-Matt

On 08/20/2013 08:39 AM, Emiliano Boragina wrote:

Hello everyone,
I try to use chmod 0777, but the JPG file in my localhost I cant view.
I must enter in the windows properties of the JPG file, add the user with
full permission, and them i can view it.
I use this:
move_uploaded_file($file_tmp,"$desired_dir/".$file_name);
chmod("$desired_dir/".$file_name,0777);
What's wrong?
Thanks. Emiliano






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

2013-08-10 Thread Jorge
As someone else say, is problem of DB design, probably you can do all the
necessary queries in only one transaction.

Un saludo,
Jorge.


2013/8/9 Karl DeSaulniers 

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


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

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

Best,
Karl

Sent from losPhone

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

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

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



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

2013-08-09 Thread Bastien Koert
Why do you have to tables with products? Couldn't you have a type or
category column and then have to only query one table?

Bastien


On Fri, Aug 9, 2013 at 11:52 AM, Niel Archer  wrote:

> > Hello.
> > I am newbie in this and need som basic help.
> >
> > I have a form witch checkbox'es with different serialnumbers.
> > The serialnumbers reflect different products and every product category
> > have their own tables.
>
> This sounds like a database design question more than a PHP one.
>
> >
> > I can transfer items from store to truck but can't transfer them back to
> > store.
> > I have 4 stores and like to transfer products between this.
> >
> > I like to to it like this:
> > store_one -> truck_document -> store_two
> >
> > But how can I transfer both Dynamite and Exan in one query to their
> > respective tables? (One table is named exan and the other dynamite.)
> >
> > Thank you very much for your help.
> >
> > I have been searching google but can't find anything about this question.
> >
> > Karl
>
> --
> Niel Archer
> niel.archer (at) blueyonder.co.uk
>
>
> --
> 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] One query, different tables?

2013-08-09 Thread Niel Archer
> Hello.
> I am newbie in this and need som basic help.
> 
> I have a form witch checkbox'es with different serialnumbers.
> The serialnumbers reflect different products and every product category
> have their own tables.

This sounds like a database design question more than a PHP one.

> 
> I can transfer items from store to truck but can't transfer them back to
> store.
> I have 4 stores and like to transfer products between this.
> 
> I like to to it like this:
> store_one -> truck_document -> store_two
> 
> But how can I transfer both Dynamite and Exan in one query to their
> respective tables? (One table is named exan and the other dynamite.)
> 
> Thank you very much for your help.
> 
> I have been searching google but can't find anything about this question.
> 
> Karl

--
Niel Archer
niel.archer (at) blueyonder.co.uk


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



Re: [PHP-DB] I'm So Confused . . .

2013-07-09 Thread Kris
Hi, Andrew!  

On Mon, 8 Jul 2013 11:17:14 -0400, andrew.jar...@gmail.com (Andrew
Jarcho) wrote:

>1) You're not stupid

Let's hope.  :-D  

>2) You're not too old to accomplish what you want to accomplish.
>A couple of good books (preferably fairly short ones) by people who
>know what they're talking about *and* know how to write should
>help a great deal.''

That's what I'm hoping.  :-)  

>Like you, I cut my programming teeth in BASIC stored on cassette
>tape. My php skills are out of date, (probably of the same vintage
>as yours), or I'd be able to recommend specific titles. I'm sure the
>good people here can help you out with that.

The most memorable part of that was -- first, I thought once it ran
the way I wanted, it was *really* neet!  Secondly -- I didn't realize
it *had* to be stored on cassette tape -- and I thought how lame is
THAT?!  LOL!  --  so I lost the first go-round.  Was much easier the
second time.  :-D

>I began studying programming seriously an about age 45. I'm 60
>now and always learning new things. OOP is not rocket science
>(until you begin programming rockets); and I've had enough
>exposure to mysqli and PDO and all the rest of the stuff you
>mentioned to know they're learnable too.

I'm thinking my rocket programming days are probably going to have to
wait for my next life.  :-D  At this point, I'll just be happy when my
converted queries are no longer a barf-fest for the poor server.  :-D

>Learning new and challenging stuff *should* make your head hurt,
>sometimes. (Not your eyes bleed, though; you might want to
>check that out :-) ). IMO, it's worth the temporary suffering for
>the joy it brings when it all starts to make sense.

Well, it does keep one from being able to read the error messages
clearly.  :-D  

There is a certain sense of satisfaction when it *does* work -- okay,
a lot of "I'm the Queen of the WORLD!" happy dancing when it does work
LOL!  I'm just not used to feeling this . . . stupid.  :-D  Having
gone from "read it, do it, move on" to "read it, do it, read it, read
it, do it, read it again, read something else . . ."  Well, you know.
:-D

>So, to make a long story a headache (as my father used to say),
>being past 50 does change the *way* you learn. But it doesn't
>rob you of the *ability* to learn. Get a couple of good books.
>Give yourself a break. Take a day off now and then. And keep
>in mind the fable of the old bull and the young bull.

I like your Dad's saying -- tired of using "to make a long story
long."  I think I'll steal that.  :-D  And the old bull definitely had
a bead on things!  

>Enjoy!

Thanks for the feedback, Andrew.  Very much appreciated -- and the
giggles were handy, too.  :-)

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



Re: [PHP-DB] I'm So Confused . . .

2013-07-08 Thread Andrew Jarcho
1) You're not stupid
2) You're not too old to accomplish what you want to accomplish.
A couple of good books (preferably fairly short ones) by people who
know what they're talking about *and* know how to write should
help a great deal.

Like you, I cut my programming teeth in BASIC stored on cassette
tape. My php skills are out of date, (probably of the same vintage
as yours), or I'd be able to recommend specific titles. I'm sure the
good people here can help you out with that.

I began studying programming seriously an about age 45. I'm 60
now and always learning new things. OOP is not rocket science
(until you begin programming rockets); and I've had enough
exposure to mysqli and PDO and all the rest of the stuff you
mentioned to know they're learnable too.

Learning new and challenging stuff *should* make your head hurt,
sometimes. (Not your eyes bleed, though; you might want to
check that out :-) ). IMO, it's worth the temporary suffering for
the joy it brings when it all starts to make sense.

So, to make a long story a headache (as my father used to say),
being past 50 does change the *way* you learn. But it doesn't
rob you of the *ability* to learn. Get a couple of good books.
Give yourself a break. Take a day off now and then. And keep
in mind the fable of the old bull and the young bull.

Enjoy!



On Mon, Jul 8, 2013 at 5:02 AM, Kris  wrote:
> All of my PHP/MySQL stuff was done years ago, and I used "good
> practices" at the time.  Things have changed, and it's past time to
> get up to speed on mysqli, PDO, sessions, etc.  All my projects to
> date have been private, hobby things that "outsiders" didn't have
> access to.  That's about to change -- well, if I can ever get this
> stuff figured out.
>
> I've been digging around on the web for several weeks now, and I don't
> feel like I've made much in the way of progress as regards prepared
> statements and mysqli and SQL injection and PDO and XSS attacks and
> OOP -- did manage to get a handle on full-text search, sessions, and
> sanitizing and validating user input, though.  ;-)
>
> But mostly I feel like I'm just going around in circles.  Every time I
> think, "Okay, I'm going to do it THIS way!" I run into a problem,
> Google for the solution, and find lots of different solutions, or
> problems, relating to things that I thought I had already resolved.
>
> Lots of RTFM hours invested, but still unsure about where to go from
> here.
>
> I've tried to figure out OOP a few times in the past, and it just
> makes my eyes bleed and my brain hurt.  I can't seem to grasp it at
> all.  I'm pretty sure I'm not stupid -- maybe it's because I stored my
> first BASIC program on a cassette tape?
>
> But . . . PDO is OOP?  And mysqli is OOP or procedural -- but PDO is
> the better solution?  Either way, I just can't figure out how to
> convert some of my mysql queries to either one.
>
> I found, of course, oodles of info on the web.  I check dates to make
> sure it's current, but they're sneaky -- one tutorial I found from
> 2012 seemed pretty good until the author  recommended using
> mysql_real_escape_string, and even *I* knew that wasn't right --
> getting rid of that usage is one of the reasons I started digging
> around in the first place.  Reading down through the comments, I found
> it was a re-post of a 2006 article, but, interestingly enough, while
> they discussed several other recommendations, not a single commenter
> mentioned the mysql_real_escape_string issue.
>
> I know how to Google -- but I can't always tell if what I'm finding is
> really "it" or just another load of . . . misinformation.  Who are the
> REAL authorities on this stuff?  I like books, too, since I don't want
> to spend all my time in front of a screen -- but the expense would
> require limiting them to just one or two -- I want to get the "right"
> ones.
>
> --
> 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] oncurrence problem with PEAR:MDB2 + msqli driver in forked CLI environment

2013-07-04 Thread Matijn Woudt
On Thu, Jul 4, 2013 at 6:09 PM, Toni Moreno  wrote:

> Hi.
>
> I have a found a very strange and big "concurrence" problem after develop a
> CLI tool which  parallelizes  data processing  by using "pcntrl_fork", ( If
> we run the same executions sequentially the result is correct)
>
> The trouble appears when some of the child processes die while trying to
> access to DB , after child dies, parent process always get status  code of
> 1 or 255..
>
> We can reproduce problem but error messages are not the same always ( I
> attach 3 error log examples)
>
> It seems like a previously stablished connection exists to the bd before
> forking and child processes are working all over it.
>
> Anybody can say me  how can I force child processes to make their own new
> connections  to de BBDD ?
>
>
> Lots of Thanks!!
>
>
First of all, PHP is probably not the right language to do data processing,
but that's up to you.
Second, pcntl_fork is pretty experimental stuff, it's not very stable.

Now to answer your question, it's hard to say without seeing the code, but
I would suspect you only create the database connection once, and use it
from all forks.
The correct way is to create 1 connection per thread, so the threads will
not interfere with each other.

Hope this helps, if not, please show us a small example that demonstrates
the problem.

Regards,

Matijn


Re: [PHP-DB] Mysql PDO statement with params in HAVING problem

2013-06-28 Thread Tamara Temple
Alexander Pletnev  wrote:
> Hi everyone, im new here, so please correct me if i created or formated
> topic incorrectly.
> 
> I found a problem. I have a simple query for my needs:
> 
> $stmt = $dbh->prepare("SELECT concat(first_name,' ',last_name) as
> full_name,t.* FROM `specialists` `t` HAVING full_name like '%john%'");
> $stmt->execute();
> while($row = $stmt->fetch())
> {
>echo ''; var_dump($row); echo '';
> }
> 
> It works fine, until i add a param to my query:
> 
> $stmt = $dbh->prepare("SELECT concat(first_name,' ',last_name) as
> full_name,t.* FROM `specialists` `t` HAVING full_name like '%:query%'");
> $stmt->execute();
> $query = 'londo';
> $stmt->bindParam(':query',$query);
> while($row = $stmt->fetch())
> {
>echo ''; var_dump($row); echo '';
> }
> 
> Now there is nothing in fetch(). Is it a bug ?

Yes. You put the execute before you bound the
parameters. prepare->bind->execute.

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



Re: [PHP-DB] Mysql PDO statement with params in HAVING problem

2013-06-27 Thread Vinay Kannan
$stmt = $dbh->prepare("SELECT concat(first_name,' ',last_name) as
full_name,t.* FROM `specialists` `t` HAVING full_name like '%:query%'");

How about '%:$query%' instead of '%:query%' ? Does that solve the problem?

Thanks,



On Thu, Jun 27, 2013 at 5:21 PM, Alexander Pletnev <
pletnev.rusa...@gmail.com> wrote:

> Hi everyone, im new here, so please correct me if i created or formated
> topic incorrectly.
>
> I found a problem. I have a simple query for my needs:
>
> $stmt = $dbh->prepare("SELECT concat(first_name,' ',last_name) as
> full_name,t.* FROM `specialists` `t` HAVING full_name like '%john%'");
> $stmt->execute();
> while($row = $stmt->fetch())
> {
>echo ''; var_dump($row); echo '';
> }
>
> It works fine, until i add a param to my query:
>
> $stmt = $dbh->prepare("SELECT concat(first_name,' ',last_name) as
> full_name,t.* FROM `specialists` `t` HAVING full_name like
> '%:query%'");
> $stmt->execute();
> $query = 'londo';
> $stmt->bindParam(':query',$query);
> while($row = $stmt->fetch())
> {
>echo ''; var_dump($row); echo '';
> }
>
> Now there is nothing in fetch(). Is it a bug ?
>
> Thanks.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP-DB] Problem with query

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

Best,
Karl


On Jun 25, 2013, at 1:32 AM, OJFR wrote:

> Yeah, Jim, please explain what u mean by "Per the manual, associative arrays
> using string indices should always use ' ' around them.  They work (as
> mentioned in the manual) but are wrong". As long as I remember  I could use
> associative arrays in that way (ex. $_SESSION['Cust_Num']). There's another
> way to do that using string indices? Why do you say it's wrong? It's
> obsolete?
> 
> I would like to make a call to all the members of this mailing list:
> knowledge is a wonderful gift so, why we don't share it politely and
> efficiency. Jim, I will take you as an example. You start saying " Against
> my better judgement, here I go again". If it's against your better judgment
> please don't go anywhere, your conscience is a good adviser. After that you
> talked a little about standards and some manual. If you are not happy to
> help people who make some mistakes regarding to programming standards, you
> should inform them where they can find the glorious manual and what is the
> correct syntax to do what people need to do. This is a better way to show to
> others what you know in a humble way but I suppose that wasn't what you were
> trying to do. I consider this list is to HELP others and share what we know.
> "Never break the silence if it's not to make it better".
> 
> Ethan, I will check your problem and I'll write you back as soon as I can
> 'cause right now I don't have anything installed in my computer. I'll try to
> do it tomorrow, ok? Be nice and stay well!!!
> 
> Osain.
> 
> -Mensaje original-
> De: Ethan Rosenberg, PhD [mailto:erosenb...@hygeiabiomedical.com] 
> Enviado el: domingo, junio 23, 2013 4:38 PM
> Para: php-db@lists.php.net; Jim Giner
> Asunto: [PHP-DB] Re: Problem with query
> 
> On 6/23/2013 2:31 PM, Ethan Rosenberg, PhD wrote:
>> Dear List -
>> 
>> There is an error in my query, and I cannot find it.
>> 
>> This fails:
>> 
>> $_SESSION['Cust_Num'] = $_REQUEST['cnum']; $_SESSION['CustNum'] = 
>> $_REQUEST['cnum'];
>> 
>> echo "session"; //this has the proper values print_r($_SESSION);
>> 
>> $sql10 = "select Balance, Payments, Charges, Date from Charges where 
>> Cust_Num = $_SESSION[Cust_Num] order by Date"; echo $sql10; //echos 
>> the correct query
>> $result10 = mysqli_query($cxn, $sql10); var_dump($result1); // this 
>> returns NULL
> 
> Against my better judgement, here I go again.
> 
> Is this the "actual" code you executed, or is it once again a typeover?
> 
> Your 1st error is in these two lines:
>> $result10 = mysqli_query($cxn, $sql10); var_dump($result1); // this 
>> returns NULL
> 
> Yes your dump returns null.  And always will.
> 
> 
> Any further errors might be related to your non-standard syntax for the
> session variable.  Per the manual, associative arrays using string indices
> should always use ' ' around them.  They work (as mentioned in the manual)
> but are wrong.
> ===
> Jim -
> 
> 
> Is this the "actual" code you executed, or is it once again a typeover?
> 
>   The actual code
> 
> Any further errors might be related to your non-standard syntax for the
> session variable.  Per the manual, associative arrays using string indices
> should always use ' ' around them.  They work (as mentioned in the manual)
> but are wrong.
> 
>   Newbie is confused.
> 
>   Please explain.
> 
> TIA
> 
> Ethan
> 
> --
> PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php
> 
> 
> --
> 
> Este mensaje le ha llegado mediante el servicio de correo electronico que 
> ofrece Infomed para respaldar el cumplimiento de las mision

Re: [PHP-DB] Re: Problem with query

2013-06-25 Thread Jim Giner

On 6/25/2013 2:32 AM, OJFR wrote:

Yeah, Jim, please explain what u mean by "Per the manual, associative arrays
using string indices should always use ' ' around them.  They work (as
mentioned in the manual) but are wrong". As long as I remember  I could use
associative arrays in that way (ex. $_SESSION['Cust_Num']). There's another
way to do that using string indices? Why do you say it's wrong? It's
obsolete?

If YOU had taken the time to check the manual as I DID, you would not 
have blown your top at me.  When I said 'per the manual', I meant it. It 
was not something I made up to taunt Ethan with - it was from the place 
all of us here quote on a regular basis.


Apology accepted.

And if you were a regular participant in this helpful forum, you would 
know of my attitude when dealing with Mr. Rosenberg, PhD.


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



Re: [PHP-DB] Re: Problem with query

2013-06-25 Thread Toby Hart Dyke


The original post is here:

http://news.php.net/php.db/48751

On 6/25/2013 1:02 PM, Michael Oki wrote:

I'm sorry I've not been following the last three responses. In a nutshell,
what "EXACTLY" does the poster of this issue want?


On 25 June 2013 11:06, Toby Hart Dyke  wrote:


What Jim means is here in the manual:

http://www.php.net/manual/en/**language.types.array.php#**
language.types.array.donts

In a nutshell:

Always use quotes around a string literal array index. For example,
/$foo['bar']/ is correct, while /$foo[bar]/ is not.

The reason is that without the quotes, you are generating an undefined
constant (bar) rather than using a string index ('bar'). It works, but
could have side effects in the future, so it's bad form to do it.

As for general politeness, you seem to be unaware of recent history in
this (an associated) groups. The OP has often committed the ultimate sine.
Not posting slightly wild code (we've all been/are there!) He doesn't seem
to listen or learn too well. Many posters (including Jim) have offered a
lot of of extremely good (and detailed) advice which seems to be rarely
taken...

   Toby



On 6/25/2013 7:32 AM, OJFR wrote:


Yeah, Jim, please explain what u mean by "Per the manual, associative
arrays
using string indices should always use ' ' around them.  They work (as
mentioned in the manual) but are wrong". As long as I remember  I could
use
associative arrays in that way (ex. $_SESSION['Cust_Num']). There's
another
way to do that using string indices? Why do you say it's wrong? It's
obsolete?

I would like to make a call to all the members of this mailing list:
knowledge is a wonderful gift so, why we don't share it politely and
efficiency. Jim, I will take you as an example. You start saying " Against
my better judgement, here I go again".






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



Re: [PHP-DB] Re: Problem with query

2013-06-25 Thread Jim Giner

On 6/25/2013 6:06 AM, Toby Hart Dyke wrote:


What Jim means is here in the manual:

http://www.php.net/manual/en/language.types.array.php#language.types.array.donts


In a nutshell:

Always use quotes around a string literal array index. For example,
/$foo['bar']/ is correct, while /$foo[bar]/ is not.

The reason is that without the quotes, you are generating an undefined
constant (bar) rather than using a string index ('bar'). It works, but
could have side effects in the future, so it's bad form to do it.

As for general politeness, you seem to be unaware of recent history in
this (an associated) groups. The OP has often committed the ultimate
sine. Not posting slightly wild code (we've all been/are there!) He
doesn't seem to listen or learn too well. Many posters (including Jim)
have offered a lot of of extremely good (and detailed) advice which
seems to be rarely taken...

   Toby


On 6/25/2013 7:32 AM, OJFR wrote:

Yeah, Jim, please explain what u mean by "Per the manual, associative
arrays
using string indices should always use ' ' around them.  They work (as
mentioned in the manual) but are wrong". As long as I remember  I
could use
associative arrays in that way (ex. $_SESSION['Cust_Num']). There's
another
way to do that using string indices? Why do you say it's wrong? It's
obsolete?

I would like to make a call to all the members of this mailing list:
knowledge is a wonderful gift so, why we don't share it politely and
efficiency. Jim, I will take you as an example. You start saying "
Against
my better judgement, here I go again".




My humble thanks for your timely support.  :)

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



Re: [PHP-DB] Re: Problem with query

2013-06-25 Thread Michael Oki
I'm sorry I've not been following the last three responses. In a nutshell,
what "EXACTLY" does the poster of this issue want?


On 25 June 2013 11:06, Toby Hart Dyke  wrote:

>
> What Jim means is here in the manual:
>
> http://www.php.net/manual/en/**language.types.array.php#**
> language.types.array.donts
>
> In a nutshell:
>
> Always use quotes around a string literal array index. For example,
> /$foo['bar']/ is correct, while /$foo[bar]/ is not.
>
> The reason is that without the quotes, you are generating an undefined
> constant (bar) rather than using a string index ('bar'). It works, but
> could have side effects in the future, so it's bad form to do it.
>
> As for general politeness, you seem to be unaware of recent history in
> this (an associated) groups. The OP has often committed the ultimate sine.
> Not posting slightly wild code (we've all been/are there!) He doesn't seem
> to listen or learn too well. Many posters (including Jim) have offered a
> lot of of extremely good (and detailed) advice which seems to be rarely
> taken...
>
>   Toby
>
>
>
> On 6/25/2013 7:32 AM, OJFR wrote:
>
>> Yeah, Jim, please explain what u mean by "Per the manual, associative
>> arrays
>> using string indices should always use ' ' around them.  They work (as
>> mentioned in the manual) but are wrong". As long as I remember  I could
>> use
>> associative arrays in that way (ex. $_SESSION['Cust_Num']). There's
>> another
>> way to do that using string indices? Why do you say it's wrong? It's
>> obsolete?
>>
>> I would like to make a call to all the members of this mailing list:
>> knowledge is a wonderful gift so, why we don't share it politely and
>> efficiency. Jim, I will take you as an example. You start saying " Against
>> my better judgement, here I go again".
>>
>
>


Re: [PHP-DB] Re: Problem with query

2013-06-25 Thread Toby Hart Dyke


What Jim means is here in the manual:

http://www.php.net/manual/en/language.types.array.php#language.types.array.donts

In a nutshell:

Always use quotes around a string literal array index. For example, 
/$foo['bar']/ is correct, while /$foo[bar]/ is not.


The reason is that without the quotes, you are generating an undefined 
constant (bar) rather than using a string index ('bar'). It works, but 
could have side effects in the future, so it's bad form to do it.


As for general politeness, you seem to be unaware of recent history in 
this (an associated) groups. The OP has often committed the ultimate 
sine. Not posting slightly wild code (we've all been/are there!) He 
doesn't seem to listen or learn too well. Many posters (including Jim) 
have offered a lot of of extremely good (and detailed) advice which 
seems to be rarely taken...


  Toby


On 6/25/2013 7:32 AM, OJFR wrote:

Yeah, Jim, please explain what u mean by "Per the manual, associative arrays
using string indices should always use ' ' around them.  They work (as
mentioned in the manual) but are wrong". As long as I remember  I could use
associative arrays in that way (ex. $_SESSION['Cust_Num']). There's another
way to do that using string indices? Why do you say it's wrong? It's
obsolete?

I would like to make a call to all the members of this mailing list:
knowledge is a wonderful gift so, why we don't share it politely and
efficiency. Jim, I will take you as an example. You start saying " Against
my better judgement, here I go again".




RE: [PHP-DB] Re: Problem with query

2013-06-24 Thread OJFR
Yeah, Jim, please explain what u mean by "Per the manual, associative arrays
using string indices should always use ' ' around them.  They work (as
mentioned in the manual) but are wrong". As long as I remember  I could use
associative arrays in that way (ex. $_SESSION['Cust_Num']). There's another
way to do that using string indices? Why do you say it's wrong? It's
obsolete?

I would like to make a call to all the members of this mailing list:
knowledge is a wonderful gift so, why we don't share it politely and
efficiency. Jim, I will take you as an example. You start saying " Against
my better judgement, here I go again". If it's against your better judgment
please don't go anywhere, your conscience is a good adviser. After that you
talked a little about standards and some manual. If you are not happy to
help people who make some mistakes regarding to programming standards, you
should inform them where they can find the glorious manual and what is the
correct syntax to do what people need to do. This is a better way to show to
others what you know in a humble way but I suppose that wasn't what you were
trying to do. I consider this list is to HELP others and share what we know.
"Never break the silence if it's not to make it better".

Ethan, I will check your problem and I'll write you back as soon as I can
'cause right now I don't have anything installed in my computer. I'll try to
do it tomorrow, ok? Be nice and stay well!!!

Osain.

-Mensaje original-
De: Ethan Rosenberg, PhD [mailto:erosenb...@hygeiabiomedical.com] 
Enviado el: domingo, junio 23, 2013 4:38 PM
Para: php-db@lists.php.net; Jim Giner
Asunto: [PHP-DB] Re: Problem with query

On 6/23/2013 2:31 PM, Ethan Rosenberg, PhD wrote:
> Dear List -
>
> There is an error in my query, and I cannot find it.
>
> This fails:
>
> $_SESSION['Cust_Num'] = $_REQUEST['cnum']; $_SESSION['CustNum'] = 
> $_REQUEST['cnum'];
>
> echo "session"; //this has the proper values print_r($_SESSION);
>
> $sql10 = "select Balance, Payments, Charges, Date from Charges where 
> Cust_Num = $_SESSION[Cust_Num] order by Date"; echo $sql10; //echos 
> the correct query
> $result10 = mysqli_query($cxn, $sql10); var_dump($result1); // this 
> returns NULL

Against my better judgement, here I go again.

Is this the "actual" code you executed, or is it once again a typeover?

Your 1st error is in these two lines:
> $result10 = mysqli_query($cxn, $sql10); var_dump($result1); // this 
> returns NULL

Yes your dump returns null.  And always will.


Any further errors might be related to your non-standard syntax for the
session variable.  Per the manual, associative arrays using string indices
should always use ' ' around them.  They work (as mentioned in the manual)
but are wrong.
===
Jim -


Is this the "actual" code you executed, or is it once again a typeover?

The actual code

Any further errors might be related to your non-standard syntax for the
session variable.  Per the manual, associative arrays using string indices
should always use ' ' around them.  They work (as mentioned in the manual)
but are wrong.

Newbie is confused.

Please explain.

TIA

Ethan

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


--

Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/


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



Re: [PHP-DB] Problem wkith Query

2013-06-23 Thread Richard Quadling
Turn on error reporting/logging/displaying and what errors are you getting?

And as you said ...

$result10 = mysqli_query($cxn, $sql10);
var_dump($result1); // this returns NULL

is your actual code, maybe ...



gives you a better clue?


On 23 June 2013 23:06, Ethan Rosenberg, PhD  wrote:

>
>
>
>
> On 23 June 2013 21:37, Ethan Rosenberg, PhD  *com > wrote:
>
> On 6/23/2013 2:31 PM, Ethan Rosenberg, PhD wrote:
>
> Dear List -
>
> There is an error in my query, and I cannot find it.
>
> This fails:
>
> $_SESSION['Cust_Num'] = $_REQUEST['cnum'];
> $_SESSION['CustNum'] = $_REQUEST['cnum'];
>
> echo "session"; //this has the proper values
> print_r($_SESSION);
>
> $sql10 = "select Balance, Payments, Charges, Date from Charges
> where
> Cust_Num = $_SESSION[Cust_Num] order by Date";
> echo $sql10; //echos the correct query
> $result10 = mysqli_query($cxn, $sql10);
> var_dump($result1); // this returns NULL
>
>
> Against my better judgement, here I go again.
>
> Is this the "actual" code you executed, or is it once again a typeover?
>
> Your 1st error is in these two lines:
>
> $result10 = mysqli_query($cxn, $sql10);
>
> var_dump($result1); // this returns NULL
>
>
> Yes your dump returns null.  And always will.
>
>
> Any further errors might be related to your non-standard syntax for
> the session variable.  Per the manual, associative arrays using string
> indices should always use ' ' around them.  They work (as mentioned in the
> manual) but are wrong.
> ===
> Jim -
>
>
>
> Is this the "actual" code you executed, or is it once again a typeover?
>
> The actual code
>
>
> Any further errors might be related to your non-standard syntax for
> the session variable.  Per the manual, associative arrays using string
> indices should always use ' ' around them.  They work (as mentioned in the
> manual) but are wrong.
>
> Newbie is confused.
>
> Please explain.
>
>
> Try ...
>
>  $sql10 = "select Balance, Payments, Charges, Date from Charges where
> Cust_Num = {$_SESSION['Cust_Num']} order by Date";
>
>
> --
> Richard Quadling
> Twitter : @RQuadling
> EE : http://e-e.com/M_248814.html
> Zend : http://bit.ly/9O8vFY
> =
> Tried it. No luck
>
> Ethan
>



-- 
Richard Quadling
Twitter : @RQuadling
EE : http://e-e.com/M_248814.html
Zend : http://bit.ly/9O8vFY


Re: [PHP-DB] Problem wkith Query

2013-06-23 Thread Ethan Rosenberg, PhD





On 23 June 2013 21:37, Ethan Rosenberg, PhD 
 wrote:


On 6/23/2013 2:31 PM, Ethan Rosenberg, PhD wrote:

Dear List -

There is an error in my query, and I cannot find it.

This fails:

$_SESSION['Cust_Num'] = $_REQUEST['cnum'];
$_SESSION['CustNum'] = $_REQUEST['cnum'];

echo "session"; //this has the proper values
print_r($_SESSION);

$sql10 = "select Balance, Payments, Charges, Date from Charges 
where

Cust_Num = $_SESSION[Cust_Num] order by Date";
echo $sql10; //echos the correct query
$result10 = mysqli_query($cxn, $sql10);
var_dump($result1); // this returns NULL


Against my better judgement, here I go again.

Is this the "actual" code you executed, or is it once again a typeover?

Your 1st error is in these two lines:

$result10 = mysqli_query($cxn, $sql10);

var_dump($result1); // this returns NULL


Yes your dump returns null.  And always will.


Any further errors might be related to your non-standard syntax for 
the session variable.  Per the manual, associative arrays using string 
indices should always use ' ' around them.  They work (as mentioned in 
the manual) but are wrong.

===
Jim -



Is this the "actual" code you executed, or is it once again a typeover?

The actual code


Any further errors might be related to your non-standard syntax for 
the session variable.  Per the manual, associative arrays using string 
indices should always use ' ' around them.  They work (as mentioned in 
the manual) but are wrong.


Newbie is confused.

Please explain.


Try ...

 $sql10 = "select Balance, Payments, Charges, Date from Charges where 
Cust_Num = {$_SESSION['Cust_Num']} order by Date";



--
Richard Quadling
Twitter : @RQuadling
EE : http://e-e.com/M_248814.html
Zend : http://bit.ly/9O8vFY
=
Tried it. No luck

Ethan

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



Re: [PHP-DB] Re: Problem with query

2013-06-23 Thread Richard Quadling
On 23 June 2013 21:37, Ethan Rosenberg, PhD  wrote:

> On 6/23/2013 2:31 PM, Ethan Rosenberg, PhD wrote:
>
>> Dear List -
>>
>> There is an error in my query, and I cannot find it.
>>
>> This fails:
>>
>> $_SESSION['Cust_Num'] = $_REQUEST['cnum'];
>> $_SESSION['CustNum'] = $_REQUEST['cnum'];
>>
>> echo "session"; //this has the proper values
>> print_r($_SESSION);
>>
>> $sql10 = "select Balance, Payments, Charges, Date from Charges where
>> Cust_Num = $_SESSION[Cust_Num] order by Date";
>> echo $sql10; //echos the correct query
>> $result10 = mysqli_query($cxn, $sql10);
>> var_dump($result1); // this returns NULL
>>
>
> Against my better judgement, here I go again.
>
> Is this the "actual" code you executed, or is it once again a typeover?
>
> Your 1st error is in these two lines:
>
>> $result10 = mysqli_query($cxn, $sql10);
>>
>> var_dump($result1); // this returns NULL
>>
>
> Yes your dump returns null.  And always will.
>
>
> Any further errors might be related to your non-standard syntax for the
> session variable.  Per the manual, associative arrays using string indices
> should always use ' ' around them.  They work (as mentioned in the manual)
> but are wrong.
>  ===
> Jim -
>
>
>
> Is this the "actual" code you executed, or is it once again a typeover?
>
> The actual code
>
>
> Any further errors might be related to your non-standard syntax for the
> session variable.  Per the manual, associative arrays using string indices
> should always use ' ' around them.  They work (as mentioned in the manual)
> but are wrong.
>
> Newbie is confused.
>
> Please explain.


Try ...

 $sql10 = "select Balance, Payments, Charges, Date from Charges where Cust_Num
= {$_SESSION['Cust_Num']} order by Date";


-- 
Richard Quadling
Twitter : @RQuadling
EE : http://e-e.com/M_248814.html
Zend : http://bit.ly/9O8vFY


Re: [PHP-DB] Problem with query

2013-06-23 Thread Matijn Woudt
On Sun, Jun 23, 2013 at 8:31 PM, Ethan Rosenberg, PhD <
erosenb...@hygeiabiomedical.com> wrote:

> Dear List -
>
> There is an error in my query, and I cannot find it.
>
> This fails:
>
> $_SESSION['Cust_Num'] = $_REQUEST['cnum'];
> $_SESSION['CustNum'] = $_REQUEST['cnum'];
>
> echo "session"; //this has the proper values
> print_r($_SESSION);
>
> $sql10 = "select Balance, Payments, Charges, Date from Charges where
> Cust_Num = $_SESSION[Cust_Num] order by Date";
> echo $sql10; //echos the correct query
> $result10 = mysqli_query($cxn, $sql10);
> var_dump($result1); // this returns NULL
> echo "Current Results";
> echo "";
> echo " frame='box'>";
> echo "";
> echo "Balance";
> echo "Payments";
> echo "Charges";
> echo "Date";
> echo "";
> echo "row1";
>

$row10 is undefined here, so:
$row10 = mysqli_fetch_row($result10); ?

I would suggest using
while (($row1 = mysqli_fetch_row($result1))!= 0 ) { ... }

instead of
do { ... } while (($row1 = mysqli_fetch_row($result1))!= 0 );

This avoids the need of the extra mysqli_fetch_row before the do-while loop.

- Matijn


Re: [PHP-DB] excec / query on Sqlite3

2013-05-20 Thread Matijn Woudt
On Mon, May 20, 2013 at 2:35 PM, Gilles  wrote:

> Hello,
>
> I'm not sure if it's a bug :
>
> $o_sqlite3=new SQLite3('test.sqlite');
>
> $r=$o_sqlite3->exec('');
> echo'';var_dump($r);echo'**'; // bool(true)
>
> $r=$o_sqlite3->query('');
> echo'';var_dump($r);echo'**';  // bool(false)
>
> $r=$o_sqlite3->exec(false);
> echo'';var_dump($r);echo'**';  // bool(true)
>
> $r=$o_sqlite3->query(false);
> echo'';var_dump($r);echo'**';  // bool(false)
>


It makes sense in some way, query fails because the query didn't return any
result, exec succeeds because it does not require a result. The query
itself is valid.

- Matijn


Re: [PHP-DB] Sorting a PHP array

2013-05-18 Thread Richard Quadling
I have an inline result set sorting function (array_multisort_by_columns()
sort of thing) as array_multisort wants the data in columns for sorting.

I can supply it if anyone wants it.


On 16 May 2013 12:57, Jim Giner  wrote:

> On 5/15/2013 1:38 PM, Bastien wrote:
>
>>
>>
>> Bastien Koert
>>
>> On 2013-05-15, at 12:32 PM, "Charlie Lewis" 
>> wrote:
>>
>>  I have a bookseller database list read into a PHP array with dimensions
>>> [row][field]. There are 32 fields in each record/row and up to 500
>>> records.
>>>
>>>
>>>
>>> What is the neatest way to sort the array by any of the fields, such as
>>> author or title?
>>>
>>>
>>>
>>> I know I should just search for a manual on this, but could anybody give
>>> me
>>> a quick start?
>>>
>>>
>>>
>>> Thanks,
>>>
>>>
>>>
>>> Charlie
>>>
>>>
>> Mildly annoyed by your laziness so ima gonna point you to the manual
>>
>> http://ca1.php.net/manual/en/**function.array-multisort.php
>>
>> Bastien
>>
>>>
>>>
>>  I learned something.  Never read up on this function.  Could be useful
> someday
>
>
> --
> 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] Sorting a PHP array

2013-05-16 Thread Jim Giner

On 5/15/2013 1:38 PM, Bastien wrote:



Bastien Koert

On 2013-05-15, at 12:32 PM, "Charlie Lewis"  wrote:


I have a bookseller database list read into a PHP array with dimensions
[row][field]. There are 32 fields in each record/row and up to 500 records.



What is the neatest way to sort the array by any of the fields, such as
author or title?



I know I should just search for a manual on this, but could anybody give me
a quick start?



Thanks,



Charlie



Mildly annoyed by your laziness so ima gonna point you to the manual

http://ca1.php.net/manual/en/function.array-multisort.php

Bastien




I learned something.  Never read up on this function.  Could be useful 
someday


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



Re: [PHP-DB] Sorting a PHP array

2013-05-15 Thread Bastien


Bastien Koert

On 2013-05-15, at 12:32 PM, "Charlie Lewis"  wrote:

> I have a bookseller database list read into a PHP array with dimensions
> [row][field]. There are 32 fields in each record/row and up to 500 records.
> 
> 
> 
> What is the neatest way to sort the array by any of the fields, such as
> author or title?
> 
> 
> 
> I know I should just search for a manual on this, but could anybody give me
> a quick start?
> 
> 
> 
> Thanks,
> 
> 
> 
> Charlie
> 

Mildly annoyed by your laziness so ima gonna point you to the manual

http://ca1.php.net/manual/en/function.array-multisort.php

Bastien
> 


Re: [PHP-DB] Sorting a PHP array

2013-05-15 Thread Matt Pelmear
I would use ORDER BY in your query and let the database do the work, 
assuming you're using a standard relational database (like MySQL or 
Postgresql).


Otherwise, if you MUST do it in PHP, you could look at   usort(), or 
uasort()  using your own custom sorting function. I would, however, 
strongly recommend keeping the work in the database. (If you're using a 
bleeding-edge version of PHP (I think this is in the 5.5 release 
candidates), you could also use array_column() along with usort() or 
uasort() to make your life easier.)



-Matt

On 05/15/2013 09:32 AM, Charlie Lewis wrote:

I have a bookseller database list read into a PHP array with dimensions
[row][field]. There are 32 fields in each record/row and up to 500 records.

  


What is the neatest way to sort the array by any of the fields, such as
author or title?

  


I know I should just search for a manual on this, but could anybody give me
a quick start?

  


Thanks,

  


Charlie

  

  

  






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



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

2013-05-06 Thread Matt Pelmear

On 05/05/2013 10:00 PM, Ethan Rosenberg, PhD wrote:


On 05/06/2013 12:48 AM, tamouse mailing lists wrote:


What you're asking about has nothing to do with PHP.

You want help with HTML and CSS, and front-end design.



You are absolutely correct.  I meant to label the post as HTML - 
Placing a form on a page.


My logic was that a PHP programmer will know HTML.



Lest we forget, the name of the list is "php-db", meaning it should be 
about database related topics in the php language.
I don't know whose job it is to manage things like that (because the 
list seems to generally accept questions of any type), but it would be 
great if we tried to stay on-topic.
I actually subscribed initially because I had some very specific 
questions about PDO and mysql's interaction. It seems I should probably 
unsubscribe since there are rarely topics of any interest to me, but I 
keep hoping things will turn around...


-Matt


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



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

2013-05-06 Thread Ethan Rosenberg, PhD


On 05/06/2013 02:03 AM, David Robley wrote:

"Ethan Rosenberg, PhD" wrote:



On 05/06/2013 12:48 AM, tamouse mailing lists wrote:

On Sun, May 5, 2013 at 11:22 PM, Ethan Rosenberg, PhD
   wrote:

Dear List -
I apologize if I offended some of you. I will see that it does not
repeat. I am trying to center a form on the top of a page. Here is the
form:


What you're asking about has nothing to do with PHP.

You want help with HTML and CSS, and front-end design.





You are absolutely correct.  I meant to label the post as HTML - Placing
a form on a page.

My logic was that a PHP programmer will know HTML.

If you are aware of a HTML/CSS mailing list, kit would be appreciated.

If anyone on the list would be able to answer my question, it would also
be appreciated.

Ethan


http://www.css-discuss.org/

And why are you giving an element fixed positioning and
expecting it to align with floating elements?

==
David -

 http://www.css-discuss.org/

Thanks.

 And why are you giving an element fixed positioning and

expecting it to align with floating elements?


I wanted the "Validate" at a fixed position on the page.  That's the 
only thing that worked for this newbie.


Also, the page will scroll past it and it will not get in the way of the 
data. [which can be long].


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] Placing a form on a page

2013-05-06 Thread Ethan Rosenberg, PhD

On 05/06/2013 04:26 AM, Karl DeSaulniers wrote:

I would suggest googling your problem. In this case "centering an HTML form".

Hth,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com




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



On 05/06/2013 12:48 AM, tamouse mailing lists wrote:

On Sun, May 5, 2013 at 11:22 PM, Ethan Rosenberg, PhD
   wrote:

Dear List -
I apologize if I offended some of you. I will see that it does not repeat.
I am trying to center a form on the top of a page. Here is the form:


What you're asking about has nothing to do with PHP.

You want help with HTML and CSS, and front-end design.





You are absolutely correct.  I meant to label the post as HTML - Placing a form 
on a page.

My logic was that a PHP programmer will know HTML.

If you are aware of a HTML/CSS mailing list, kit would be appreciated.

If anyone on the list would be able to answer my question, it would also be 
appreciated.

Ethan

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





Karl -

> I would suggest googling your problem. In this case "centering an 
HTML form"


Tried it.  No luck.  Probably used the incorrect search term.

Ethan

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



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

2013-05-06 Thread Ethan Rosenberg, PhD


On 05/06/2013 02:03 AM, David Robley wrote:

"Ethan Rosenberg, PhD" wrote:



On 05/06/2013 12:48 AM, tamouse mailing lists wrote:

On Sun, May 5, 2013 at 11:22 PM, Ethan Rosenberg, PhD
   wrote:

Dear List -
I apologize if I offended some of you. I will see that it does not
repeat. I am trying to center a form on the top of a page. Here is the
form:


What you're asking about has nothing to do with PHP.

You want help with HTML and CSS, and front-end design.





You are absolutely correct.  I meant to label the post as HTML - Placing
a form on a page.

My logic was that a PHP programmer will know HTML.

If you are aware of a HTML/CSS mailing list, kit would be appreciated.

If anyone on the list would be able to answer my question, it would also
be appreciated.

Ethan


http://www.css-discuss.org/

And why are you giving an element fixed positioning and
expecting it to align with floating elements?

==
David -

 http://www.css-discuss.org/

Thanks.

 And why are you giving an element fixed positioning and
> expecting it to align with floating elements?

I wanted the "Validate" at a fixed position on the page.  That's the 
only thing that worked for this newbie.


Also, the page will scroll past it and it will not get in the way of the 
data. [which can be long].


Ethan

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



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

2013-05-06 Thread Ethan Rosenberg, PhD

On 05/06/2013 09:35 AM, OJFR wrote:

Ethan, to center your form you just need to chance a little bit its
structure as follows:







"; echo"
"; ?>




And go to your CSS file and add this lines:

.to_center  {
width: auto;
}

That will solve your problem because when you have a fixed div between two
columns with an auto width declared, those two columns take the exact width
to fill completely the width of their container (adding also the fixed width
of the div of your form). If you have any trouble understanding this just
ask 'cause English is not my first language, so I'll try to explain myself
better. I also recommend that if you are having problems with CSS and HTML
structure, you should consider to use Twitter Bootstrap. Google it and I
guess it will be pretty useful for you in the future.

Greetings,

Osain.

-Mensaje original-
De: Ethan Rosenberg, PhD [mailto:erosenb...@hygeiabiomedical.com]
Enviado el: lunes, 06 de mayo de 2013 12:23 AM
Para: PHP Database List
Asunto: [?? Probable Spam] [PHP-DB] Placing a form on a page

Dear List -
I apologize if I offended some of you. I will see that it does not repeat.
I am trying to center a form on the top of a page. Here is the form:



"; echo
""; ?>  


It is aligned on the p;age with the following css - #frm{
position: fixed;
top: 5%;
left:42%;
}

It aligns perfectly with this form

function show_welcome()
{
$custnum = isset($_REQUEST["Cust_Num"]) ? $_REQUEST["Cust_Num"] : "";
$first_name = isset($_REQUEST["Fname"])  ? $_REQUEST["Fname"] : "";
$last_name  = isset($_REQUEST["Lname"])  ? $_REQUEST["Lname"] : "";
$street = isset($_REQUEST["Street"]) ? $_REQUEST["Street"] : "";
$city   = isset($_REQUEST['City']) ?   $_REQUEST['City'] : "";
$state   = isset($_REQUEST['State']) ?   $_REQUEST['State'] : "";
$zip   = isset($_REQUEST['Zip']) ?   $_REQUEST['Zip'] : "";
$phone  = isset($_REQUEST["Phone"])  ? $_REQUEST["Phone"] : "";
$date   = isset($_REQUEST['Date']) ?   $_REQUEST['Date'] : "";
$notes   = isset($_REQUEST['Notes']) ?   $_REQUEST['Notes'] : "";
$p1  = isset($_REQUEST['PH1']) ?   $_REQUEST['PH1'] : "";
$p2  = isset($_REQUEST['PH2']) ?   $_REQUEST['PH2'] : "";
$p3  = isset($_REQUEST['PH3']) ?   $_REQUEST['PH3'] : "";


echo "";
echo "";
echo "";
echo "Customer Number:  "; echo"
First Name:  ";
echo "Last Name:  "; echo "Street:
";
echo "City:";
echo "State:   "; echo "Zip
Code:  "; echo
""; echo""; echo"  "; echo"
Phone:  ()"; echo""; echo""; echo"Date:"; echo ""; //
echo ""; echo ""; echo ""; echo "   ";
echo "";
echo ""; echo"
"; // goto step2; ?>  


With this it is offset to the right.
echo "Do you wish to enter a Payment?";
echo ""; echo"Name:
$_SESSION[Lname] echo $_SESSION[Fname]"; echo
""; echo
"";
echo ""; echo
""; echo"Do you wish to enter a
Charge?"; echo""; echo
"Name: $_SESSION[Lname],
$_SESSION[Fname]";
echo "";
echo "";
echo ""; echo
""; echo"Name: $_SESSION[Lname],
$_SESSION[Fname]";
echo "Are you Finished for Now?"; echo
""; // echo
""; echo
""; I know that I am doing something wrong, but cannot figure out
what it is.


Ethan


PS I know that the formatting of the above is an absolute disaster.
Icedove defaults to 80 columns, and pure test does not allow me to change
font size.  If you could show me how, it would be appreciated.

Thanks

--


===

Thanks -

Works beautifully!!

Ethan

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



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

2013-05-06 Thread Gu®u
Hi,
Check if you have created a class in which you have already mentioned the
font size. If that so look it and change it inside the class. Also, check
if you have created or mentioned the font size in CSS. I hope this will
help you.


On Mon, May 6, 2013 at 6:30 PM, Jim Giner wrote:

> Centering a form is a simple process - as you stated about your first
> example form.  So - obviously the problem is in all that other crap you
> presented to us, expecting us to do your debugging.  I still don't know
> what you want to do - perhaps you could have given us a para on what it is
> wrong.  Are you trying to center multiple forms, or just align multiple
> forms in some fashion?
>
> Once again - learn some new stuff and develop code that is easier to read
> and perhaps you'll find more of your own errors.  IE - read about
> "heredocs".  (That IS php!)
>
> (You might also want to read about security and protecting yourself from
> malicious input values.)
>
> Hope I didn't offend you again, but this post was just more of the same
> old "Ethan Phd" stuff.
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
*Best,
*
*Gu®u
CEO & Founder at,
www.myshopads.com
*


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

2013-05-06 Thread Jim Giner
Centering a form is a simple process - as you stated about your first 
example form.  So - obviously the problem is in all that other crap you 
presented to us, expecting us to do your debugging.  I still don't know 
what you want to do - perhaps you could have given us a para on what it 
is wrong.  Are you trying to center multiple forms, or just align 
multiple forms in some fashion?


Once again - learn some new stuff and develop code that is easier to 
read and perhaps you'll find more of your own errors.  IE - read about 
"heredocs".  (That IS php!)


(You might also want to read about security and protecting yourself from 
malicious input values.)


Hope I didn't offend you again, but this post was just more of the same 
old "Ethan Phd" stuff.


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



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

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

Hth,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com




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

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


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



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

2013-05-05 Thread David Robley
"Ethan Rosenberg, PhD" wrote:

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

http://www.css-discuss.org/

And why are you giving an element fixed positioning and 
expecting it to align with floating elements?
-- 
Cheers
David Robley

Freedom is just chaos with better lighting.

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



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

2013-05-05 Thread Ethan Rosenberg, PhD


On 05/06/2013 12:48 AM, tamouse mailing lists wrote:

On Sun, May 5, 2013 at 11:22 PM, Ethan Rosenberg, PhD
  wrote:

Dear List -
I apologize if I offended some of you. I will see that it does not repeat.
I am trying to center a form on the top of a page. Here is the form:


What you're asking about has nothing to do with PHP.

You want help with HTML and CSS, and front-end design.





You are absolutely correct.  I meant to label the post as HTML - Placing 
a form on a page.


My logic was that a PHP programmer will know HTML.

If you are aware of a HTML/CSS mailing list, kit would be appreciated.

If anyone on the list would be able to answer my question, it would also 
be appreciated.


Ethan

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



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

2013-05-05 Thread tamouse mailing lists
On Sun, May 5, 2013 at 11:22 PM, Ethan Rosenberg, PhD
 wrote:
> Dear List -
> I apologize if I offended some of you. I will see that it does not repeat.
> I am trying to center a form on the top of a page. Here is the form:

What you're asking about has nothing to do with PHP.

You want help with HTML and CSS, and front-end design.


>
> 
> 
> 
> 
>  echo "";
> echo "";
> ?>
> 
>
>
> It is aligned on the p;age with the following css -
> #frm{
> position: fixed;
> top: 5%;
> left:42%;
> }
>
> It aligns perfectly with this form
>
> function show_welcome()
> {
> $custnum = isset($_REQUEST["Cust_Num"]) ? $_REQUEST["Cust_Num"] : "";
> $first_name = isset($_REQUEST["Fname"])  ? $_REQUEST["Fname"] : "";
> $last_name  = isset($_REQUEST["Lname"])  ? $_REQUEST["Lname"] : "";
> $street = isset($_REQUEST["Street"]) ? $_REQUEST["Street"] : "";
> $city   = isset($_REQUEST['City']) ?   $_REQUEST['City'] : "";
> $state   = isset($_REQUEST['State']) ?   $_REQUEST['State'] : "";
> $zip   = isset($_REQUEST['Zip']) ?   $_REQUEST['Zip'] : "";
> $phone  = isset($_REQUEST["Phone"])  ? $_REQUEST["Phone"] : "";
> $date   = isset($_REQUEST['Date']) ?   $_REQUEST['Date'] : "";
> $notes   = isset($_REQUEST['Notes']) ?   $_REQUEST['Notes'] : "";
> $p1  = isset($_REQUEST['PH1']) ?   $_REQUEST['PH1'] : "";
> $p2  = isset($_REQUEST['PH2']) ?   $_REQUEST['PH2'] : "";
> $p3  = isset($_REQUEST['PH3']) ?   $_REQUEST['PH3'] : "";
>
>
> echo "";
> echo "";
> echo "";
> echo " Customer Number:  value='$custnum' />";
> echo " First Name:  value='$first_name' />";
> echo " Last Name:  value='$last_name' />";
> echo " Street:  value='$street' />";
> echo " City:  value='$city' />";
> echo " State:  name= 'state' value='NY' /> ";
> echo " Zip Code:  name= 'Zip' value='10952' />";
> echo "";
> echo "";
> echo " ";
> echo " Phone: ( name='PH1' value='$p1'>)";
> echo " '$p2'>";
> echo " '$p3'>";
> echo "Date: name='Date' value='$date' >";
> echo " ";
> // echo "";
> echo " ";
> echo " ";
> echo "    ";
> echo "  value='already_seen'>";
> echo " ";
> echo " ";
> // goto step2;
> ?>
> 
>
>
> With this it is offset to the right.
> echo "Do you wish to enter a Payment?";
> echo "";
> echo "Name: $_SESSION[Lname] echo $_SESSION[Fname]
> ";
> echo "";
> echo " value='already_seen'>";
> echo "";
> echo "";
> echo "Do you wish to enter a Charge?";
> echo "";
> echo "Name: $_SESSION[Lname],
> $_SESSION[Fname]";
> echo " onclick='ClearScren' >";
> echo " value='already_seen'>";
> echo "";
> echo "";
> echo "Name: $_SESSION[Lname],
> $_SESSION[Fname]";
> echo "Are you Finished for Now?";
> echo "";
> // echo "";
> echo "";
> I know that I am doing something wrong, but cannot figure out what it is.
>
>
> Ethan
>
>
> PS I know that the formatting of the above is an absolute disaster. Icedove
> defaults to 80 columns, and pure test does not allow me to change font size.
> If you could show me how, it would be appreciated.
>
> Thanks
>
> --
> 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] PDO Exceptions

2013-04-25 Thread Jim Giner

On 4/25/2013 6:49 AM, Niel Archer wrote:

Greetings,

I am new to this list. I have a question about which functions need to be 
included in a try block.

Of "new PDO", "prepare", "bindParam", "execute", "fetch", and "query", it seems 
that bindParam is the only one that throws an exception. So is this the only that needs to be put into a try block?

Thanks,

-KJW
Proverbs 3:5-6


Are you aware that there is a setting to control whether PDO objects throw
exceptions, warnings, or nothing? By default it does nothing except set
the error code and message.

See http://uk3.php.net/manual/en/pdo.error-handling.php

--
Niel Archer
niel.archer (at) blueyonder.co.uk


And I learn something new today too!

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



Re: [PHP-DB] PDO Exceptions

2013-04-25 Thread Niel Archer
> Greetings,
> 
> I am new to this list. I have a question about which functions need to be 
> included in a try block. 
> 
> Of "new PDO", "prepare", "bindParam", "execute", "fetch", and "query", it 
> seems that bindParam is the only one that throws an exception. So is this the 
> only that needs to be put into a try block?
> 
> Thanks,
> 
> -KJW
> Proverbs 3:5-6

Are you aware that there is a setting to control whether PDO objects throw
exceptions, warnings, or nothing? By default it does nothing except set
the error code and message.

See http://uk3.php.net/manual/en/pdo.error-handling.php

--
Niel Archer
niel.archer (at) blueyonder.co.uk


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



Re: [PHP-DB] Re: PDO Exceptions

2013-04-24 Thread Jim Giner

On 4/24/2013 10:04 AM, Lars Nielsen wrote:

On 4/24/2013 9:43 AM, Lars Nielsen wrote:

On 4/22/2013 11:55 AM, Onatawahtaw wrote:

Greetings,

I am new to this list. I have a question about which functions need to
be included in a try block.

Of "new PDO", "prepare", "bindParam", "execute", "fetch", and "query",
it seems that bindParam is the only one that throws an exception. So
is
this the only that needs to be put into a try block?

Thanks,

-KJW
Proverbs 3:5-6


Since nobody else has offered anything, I'll give you my impression of
how a try handles things.

If the statement(s) within the try block fail in any way (such as
simply
returning a 'false' value), the try block's catch will be executed.  So
while the items you specified do not "throw an exception", I believe
the
try will still handle a failure of those functions.

Of course, if I'm wrong, I'm positive we'll start seeing responses to
your question.  :)

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



Hi Jim,

I agree that failures would normally be catched as an exception. But how
do/can you determine if "false" is a failure?

/Lars


It's not a question of Me determining that.  If the original function
returned "false" then the try should catch it and in your 'catch' block
you can display a message and show the php error.  In the case where you
expect a 'false' return, then just reverse your try condition, and
display the appropriate message (without a php error messsage).  Or even
simpler, just use an If statement.

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



If the functions inside your try block doesnt throw anything, then your
code will not enter the catchblock. It does not depend on what your
function return, but what they throw.
/Lars


If that is true then  I learned something today.  :)

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



Re: [PHP-DB] Re: PDO Exceptions

2013-04-24 Thread Lars Nielsen
> On 4/24/2013 9:43 AM, Lars Nielsen wrote:
>>> On 4/22/2013 11:55 AM, Onatawahtaw wrote:
 Greetings,

 I am new to this list. I have a question about which functions need to
 be included in a try block.

 Of "new PDO", "prepare", "bindParam", "execute", "fetch", and "query",
 it seems that bindParam is the only one that throws an exception. So
 is
 this the only that needs to be put into a try block?

 Thanks,

 -KJW
 Proverbs 3:5-6

>>> Since nobody else has offered anything, I'll give you my impression of
>>> how a try handles things.
>>>
>>> If the statement(s) within the try block fail in any way (such as
>>> simply
>>> returning a 'false' value), the try block's catch will be executed.  So
>>> while the items you specified do not "throw an exception", I believe
>>> the
>>> try will still handle a failure of those functions.
>>>
>>> Of course, if I'm wrong, I'm positive we'll start seeing responses to
>>> your question.  :)
>>>
>>> --
>>> PHP Database Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>> Hi Jim,
>>
>> I agree that failures would normally be catched as an exception. But how
>> do/can you determine if "false" is a failure?
>>
>> /Lars
>>
> It's not a question of Me determining that.  If the original function
> returned "false" then the try should catch it and in your 'catch' block
> you can display a message and show the php error.  In the case where you
> expect a 'false' return, then just reverse your try condition, and
> display the appropriate message (without a php error messsage).  Or even
> simpler, just use an If statement.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
If the functions inside your try block doesnt throw anything, then your
code will not enter the catchblock. It does not depend on what your
function return, but what they throw.
/Lars


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



Re: [PHP-DB] Re: PDO Exceptions

2013-04-24 Thread Jim Giner

On 4/24/2013 9:43 AM, Lars Nielsen wrote:

On 4/22/2013 11:55 AM, Onatawahtaw wrote:

Greetings,

I am new to this list. I have a question about which functions need to
be included in a try block.

Of "new PDO", "prepare", "bindParam", "execute", "fetch", and "query",
it seems that bindParam is the only one that throws an exception. So is
this the only that needs to be put into a try block?

Thanks,

-KJW
Proverbs 3:5-6


Since nobody else has offered anything, I'll give you my impression of
how a try handles things.

If the statement(s) within the try block fail in any way (such as simply
returning a 'false' value), the try block's catch will be executed.  So
while the items you specified do not "throw an exception", I believe the
try will still handle a failure of those functions.

Of course, if I'm wrong, I'm positive we'll start seeing responses to
your question.  :)

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



Hi Jim,

I agree that failures would normally be catched as an exception. But how
do/can you determine if "false" is a failure?

/Lars

It's not a question of Me determining that.  If the original function 
returned "false" then the try should catch it and in your 'catch' block 
you can display a message and show the php error.  In the case where you 
expect a 'false' return, then just reverse your try condition, and 
display the appropriate message (without a php error messsage).  Or even 
simpler, just use an If statement.


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



Re: [PHP-DB] Re: PDO Exceptions

2013-04-24 Thread Lars Nielsen
> On 4/22/2013 11:55 AM, Onatawahtaw wrote:
>> Greetings,
>>
>> I am new to this list. I have a question about which functions need to
>> be included in a try block.
>>
>> Of "new PDO", "prepare", "bindParam", "execute", "fetch", and "query",
>> it seems that bindParam is the only one that throws an exception. So is
>> this the only that needs to be put into a try block?
>>
>> Thanks,
>>
>> -KJW
>> Proverbs 3:5-6
>>
> Since nobody else has offered anything, I'll give you my impression of
> how a try handles things.
>
> If the statement(s) within the try block fail in any way (such as simply
> returning a 'false' value), the try block's catch will be executed.  So
> while the items you specified do not "throw an exception", I believe the
> try will still handle a failure of those functions.
>
> Of course, if I'm wrong, I'm positive we'll start seeing responses to
> your question.  :)
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Hi Jim,

I agree that failures would normally be catched as an exception. But how
do/can you determine if "false" is a failure?

/Lars


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



Re: [PHP-DB] Probleme upper accents

2013-04-05 Thread Christopher Jones



On 4/5/13 7:23 AM, Matijn Woudt wrote:

On Fri, Apr 5, 2013 at 3:19 PM, Toby Hart Dyke  wrote:



It looks similar to this bug: 
http://bugs.php.net/bug.php?**id=54379- 
possibly fixed in a later version? Your PHP is pretty elderly.

   Toby




I would suggest to upgrade the full system.
LC_* shows the OS is using ISO-8859-1, which is extremely outdated.  It
should use UTF-8 of course, or at least the ISO-8859-15.
The database uses ISO-8859-15, and then you output it to the browser
(without converting it I assume), and you tell the browser it is UTF-8 data?

About your problem, it seems Toby is right about the bug report. It seems
it has not been fixed yet, there is a patch but devs didn't find I good
enough it. You might want to look at the options to use an ISO-8859-15
connection instead of UTF-8 while the bug has not been fixed.

- Matijn



A PHP upgrade will fix various things in PDO and a few things in PDO_OCI.
I don't know if your current issue is one of them.

OCI8 is the preferred driver for Oracle DB access.  It is maintained and
has performance features that PDO_OCI doesn't have: connection pooling,
statement caching etc.

The bigger issue is there aren't any PDO_OCI developers.  Also no one
is overseeing the PDO project (all drivers) so it is decaying and
fragmenting.  (Volunteers to assist are welcome).  Even the MySQL team
would recommend mysqli instead of PDO_MYSQL.

Chris

--
christopher.jo...@oracle.com  http://twitter.com/ghrd
Newly updated, free PHP & Oracle book:
http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html

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



Re: [PHP-DB] Probleme upper accents

2013-04-05 Thread Matijn Woudt
On Fri, Apr 5, 2013 at 3:19 PM, Toby Hart Dyke  wrote:

>
> It looks similar to this bug: 
> http://bugs.php.net/bug.php?**id=54379- 
> possibly fixed in a later version? Your PHP is pretty elderly.
>
>   Toby
>
>
>
I would suggest to upgrade the full system.
LC_* shows the OS is using ISO-8859-1, which is extremely outdated.  It
should use UTF-8 of course, or at least the ISO-8859-15.
The database uses ISO-8859-15, and then you output it to the browser
(without converting it I assume), and you tell the browser it is UTF-8 data?

About your problem, it seems Toby is right about the bug report. It seems
it has not been fixed yet, there is a patch but devs didn't find I good
enough it. You might want to look at the options to use an ISO-8859-15
connection instead of UTF-8 while the bug has not been fixed.

- Matijn


Re: [PHP-DB] Probleme upper accents

2013-04-05 Thread Toby Hart Dyke


It looks similar to this bug: http://bugs.php.net/bug.php?id=54379 - 
possibly fixed in a later version? Your PHP is pretty elderly.


  Toby


On 4/5/2013 1:38 PM, André LAGADEC wrote:

Hi,

On my application PHP with Oracle database, all work fine with 
Oracle9i client, but when I test with Oracle11gR2 client

I get warning with PDO driver.
*Warning*: PDOStatement::fetch() [function.PDOStatement-fetch 
]: column 0 data was too 
large for buffer and was truncated to fit it in

with this request
" SELECT DISTINCT UPPER(SUBSTR(NOM, 1, 1)) AS INITIALE, NOM
   FROM MY_TABLE ORDER BY INITIALE ";

The field NOM contain in first character upper character with accent 
like this


É

Î

Here are my configuration :
   - Apache2.2.21
   - Php-5.1.4 with PDO Oracle
   - Client Oracle 11.2.0.1
   - Base Oracle 11.2.0.1



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



Re: [PHP-DB] enabled PDO driver for MySQL and other database server

2013-04-01 Thread Dian Syarif Nasution
hi iccsi,
make sure your configure file "php.ini" unmark the pdo_mysql


On Mon, Apr 1, 2013 at 2:53 AM, iccsi  wrote:

> I tried to run PHP Report, Reporttico, and I got "PDO Driver MySQL not
> found"
> I do some research on Google learn that PHP deliver with PDO driver and
> tried to enable it using IIS, but I could not make it work.
> I would like to know how to enable PDO driver for the database servers.
>
> I use Windows 7 Home Edition and IIS 7.
>
> Your help and information is great appreciated,
>
> Regards,
>
> Iccsi
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Dian Syarif Nasution
YM : di_armstrong

www.19warna.com
www.kreatifroom.co.id
www.koolinci.com


RE: [PHP-DB] Undefined variables in update query

2013-03-27 Thread VanderHart, Robert
Many thanks for this great advice!  Definitely worth keeping and putting into 
practice!  Any way to write cleaner and more concise code is always worth 
learning.

Best regards,

Robert

--
Robert J. Vander Hart
Electronic Resources Librarian | Lamar Soutter Library
University of Massachusetts Medical School 01655
508-856-3290 | robert.vanderh...@umassmed.edu
http://library.umassmed.edu | LinkedIn: 
http://www.linkedin.com/in/robertvanderhart


-Original Message-
From: tamouse mailing lists [mailto:tamouse.li...@gmail.com] 
Sent: Tuesday, March 26, 2013 6:57 PM
To: VanderHart, Robert
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Undefined variables in update query

On Tue, Mar 26, 2013 at 10:57 AM, VanderHart, Robert 
 wrote:
> I appreciate the replies I've received already; thanks!  Sorry for not 
> catching my simple errors before sending out that message.


No worries, no one I have met yet begins life knowing this stuff!

If you don't mind, Robert, I'd like to introduce you to a couple of concepts 
that might make your way easier:

1) Don't Repeat Yourself, aka DRY -- in writing code, it sometimes seems easier 
to just cut and paste something over and over again with a couple of minor 
tweaks. However, if you find you have to change something structurally (like 
that form!), having the change in one place is so much simpler.

2) Think in functions, procedures, and modules. It's sometimes very easy when 
starting out to just write everything in one straight, linear flow. Going along 
with #1, using functions to handle the reduced repetition should help a lot.

If I can give a simple example, you have a whole swath of lines dealing with 
pulling things out of $_POST that look almost exactly the same, save for the 
key.

$fields = ['authorid','lname','fname','mname','email','institution',
   'department','comments','sent_email','suffix']

foreach ($fields as $field) {
  if (isset($_POST[$field])) $$field =
mysqli_real_escape_string($link, $_POST[$field]); }

If you notice the '$$field' thing in the middle there, it's a Variable 
Variable, which is described in:

http://www.php.net/manual/en/language.variables.variable.php

It might look advanced, but most every language has some form of indirection 
like that. Makes the above operation really nice and short. You said you've 
been around the block a couple of times in other languages and scripts (and if 
your photo is accurate, we're probably of an age!) so I hope you'll take this 
as just trying to help a person get a leg up.


Re: [PHP-DB] Undefined variables in update query

2013-03-26 Thread tamouse mailing lists
On Tue, Mar 26, 2013 at 10:57 AM, VanderHart, Robert
 wrote:
> I appreciate the replies I've received already; thanks!  Sorry for not 
> catching my simple errors before sending out that message.


No worries, no one I have met yet begins life knowing this stuff!

If you don't mind, Robert, I'd like to introduce you to a couple of
concepts that might make your way easier:

1) Don't Repeat Yourself, aka DRY -- in writing code, it sometimes
seems easier to just cut and paste something over and over again with
a couple of minor tweaks. However, if you find you have to change
something structurally (like that form!), having the change in one
place is so much simpler.

2) Think in functions, procedures, and modules. It's sometimes very
easy when starting out to just write everything in one straight,
linear flow. Going along with #1, using functions to handle the
reduced repetition should help a lot.

If I can give a simple example, you have a whole swath of lines
dealing with pulling things out of $_POST that look almost exactly the
same, save for the key.

$fields = ['authorid','lname','fname','mname','email','institution',
   'department','comments','sent_email','suffix']

foreach ($fields as $field) {
  if (isset($_POST[$field])) $$field =
mysqli_real_escape_string($link, $_POST[$field]);
}

If you notice the '$$field' thing in the middle there, it's a Variable
Variable, which is described in:

http://www.php.net/manual/en/language.variables.variable.php

It might look advanced, but most every language has some form of
indirection like that. Makes the above operation really nice and
short. You said you've been around the block a couple of times in
other languages and scripts (and if your photo is accurate, we're
probably of an age!) so I hope you'll take this as just trying to help
a person get a leg up.

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



RE: [PHP-DB] Undefined variables in update query

2013-03-26 Thread VanderHart, Robert
Premek,

Thanks for the reply.  I actually found that silly mistake after I sent out my 
message.  You're absolutely right that I need to hardcode the field name into 
the input name attribute.  Even a newbie like me should have realized that one; 
even though I'm new to PHP I've used other scripting languages for quite a 
while.

I appreciate the replies I've received already; thanks!  Sorry for not catching 
my simple errors before sending out that message.

Best to all,

Robert

--
Robert J. Vander Hart
University of Massachusetts Medical School
508-856-3290 | robert.vanderh...@umassmed.edu


-Original Message-
From: Přemysl [mailto:premysl.fi...@lim.cz]
Sent: Tuesday, March 26, 2013 11:46 AM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Undefined variables in update query

Hi,

it appears to me that you have some strange input[name] attribute.
instead of
...
try
...

In php you are not initializing variables. That means $department is only set 
if $_POST['department'] exists.
You can try this:
add: $sql = '';

instead of
   if (isset($_POST['department']))
{
$department = mysqli_real_escape_string($link, $_POST['department']);
  }
try

   if (isset($_POST['department']))
{
 $sql .= $sql ? ", department='$_POST[department]'" : "  
department='$_POST[department]";
  }
..
database:
  $sql = "update intr_stats_eschol set $sql  where authorid='$authorid'";

If you want to update all the rows in you table you can use (for example):
... name="department[$row[authorId]" and in php:  
$department=$_POST['department'][$authorId]...

Premek.

On Tue, 26 Mar 2013 16:19:24 +0100, VanderHart, Robert 
 wrote:

> Hi,
>
> I'm pretty new to PHP and to this discussion list.
>
> I have a web form to update some fields in a data table.  I'm getting 
> "undefined variable" notices in my error logs when I submit the form 
> and the table row doesn't get updated.
>
> Here's the code for the form page:
>
> 
> include '../db.inc.php';
>
> $ID = mysqli_real_escape_string($link, $_GET['ID']); $result = 
> mysqli_query($link, "select * from intr_stats_eschol where 
> authorid='$ID'"); if (!$result) {
> $error = 'Error fetching eScholarship author details: ' .  
> mysqli_error($link);
> include 'error.html.php';
> exit();
> }
>
> $num=mysqli_num_rows($result);
>
> echo "Editing Record  action=\"eschol-edit-process.php\"> ";
>
> for ($i=0; $i<$num; $i++) {
> $row = mysqli_fetch_assoc ($result);
>
> echo
> "Last Name: value=\"$row[lname]\">
> First Name: value=\"$row[fname]\">
> Middle Name: value=\"$row[mname]\">
> Suffix: value=\"$row[suffix]\">
> Email: value=\"$row[email]\">
> Institution: name=\"$row[institution]\" value=\"$row[institution]\">
> Department: name=\"$row[department]\" value=\"$row[department]\">
> Comments: value=\"$row[comments]\">
> Send Email?$row[sent_email]
>  value=\"$row[authorid]\"> Author\"> ";
>
> } echo " 
> ";
>
> ?>
>
> The data are inserted correctly into the form input fields, but when I 
> click the "Update Author" button, an "undefined variable" notice gets
> logged for each of the variables and the table row doesn't get updated.   
> The only variable that seems to be OK is the authorid field; it 
> outputs the correct ID from the var_dump() I have inserted.
>
> Here's the code that processes the form:
>
> 
> include '../db.inc.php';
>
> if (isset($_POST['authorid']))
> {
> $authorid = mysqli_real_escape_string($link, $_POST['authorid']); 
> var_dump($authorid); } if (isset($_POST['lname'])) { $lname = 
> mysqli_real_escape_string($link, $_POST['lname']); } if
> (isset($_POST['fname'])) { $fname = mysqli_real_escape_string($link, 
> $_POST['fname']); } if (isset($_POST['mname'])) { $mname = 
> mysqli_real_escape_string($link, $_POST['mname']); } if
> (isset($_POST['email'])) { $email = mysqli_real_escape_string($link, 
> $_POST['email']); } if (isset($_POST['institution'])) { $institution = 
> mysqli_real_escape_string($link, $_POST['institution']); } if
> (isset($_POST['department'])) { $department = 
> mysqli_real_escape_string($link, $_POST['dep

Re: [PHP-DB] Undefined variables in update query

2013-03-26 Thread Přemysl

Hi,

it appears to me that you have some strange input[name] attribute.
instead of
value=\"$row[department]\">...

try
...

In php you are not initializing variables. That means $department is only  
set if $_POST['department'] exists.

You can try this:
add: $sql = '';

instead of
  if (isset($_POST['department']))
{
$department = mysqli_real_escape_string($link, $_POST['department']);
 }
try

  if (isset($_POST['department']))
{
$sql .= $sql ? ", department='$_POST[department]'" : "  
department='$_POST[department]";

 }
..
database:
 $sql = "update intr_stats_eschol set $sql  where authorid='$authorid'";

If you want to update all the rows in you table you can use (for example):
... name="department[$row[authorId]" and in php:  
$department=$_POST['department'][$authorId]...


Premek.

On Tue, 26 Mar 2013 16:19:24 +0100, VanderHart, Robert  
 wrote:



Hi,

I'm pretty new to PHP and to this discussion list.

I have a web form to update some fields in a data table.  I'm getting  
"undefined variable" notices in my error logs when I submit the form and  
the table row doesn't get updated.


Here's the code for the form page:

$error = 'Error fetching eScholarship author details: ' .  
mysqli_error($link);

include 'error.html.php';
exit();
}

$num=mysqli_num_rows($result);

echo "Editing Record  ";

for ($i=0; $i<$num; $i++) {
$row = mysqli_fetch_assoc ($result);

echo
"Last Name:value=\"$row[lname]\">
First Name:value=\"$row[fname]\">
Middle Name:value=\"$row[mname]\">
Suffix:value=\"$row[suffix]\">
Email:value=\"$row[email]\">
Institution:name=\"$row[institution]\" value=\"$row[institution]\">
Department:name=\"$row[department]\" value=\"$row[department]\">
Comments:value=\"$row[comments]\">

Send Email?$row[sent_email]
value=\"$row[authorid]\">Author\"> ";


}
echo " ";

?>

The data are inserted correctly into the form input fields, but when I  
click the "Update Author" button, an "undefined variable" notice gets  
logged for each of the variables and the table row doesn't get updated.   
The only variable that seems to be OK is the authorid field; it outputs  
the correct ID from the var_dump() I have inserted.


Here's the code that processes the form:

$error = 'Error fetching eScholarship author details: ' .  
mysqli_error($link);

include 'error.html.php';
exit();
}
?>

Can anyone tell where I'm going wrong?  I thought it might be some  
obvious thing like the use of single quotes instead of double quotes in  
the update query, or vice-versa, but I've tried several different ways.   
I've looked at numerous stackoverflow.com postings but nothing seems to  
remedy the issue I'm having.  I'm also wondering if the problem is  
related to my using echo() to output the form fields in the first  
template.


FWIW, here's the design of my table:

+-+--+--+-+-++
| Field   | Type   | Null  | Key | Default   
| Extra  |

+-+--+--+-+-++
| email  | varchar(255)   | YES  | | NULL
|   |
| institution | varchar(200)  | YES  | | NULL
|   |
| lname| varchar(100)  | YES  | | NULL 
|   |
| fname   | varchar(80)| YES  | | NULL 
||
| mname   | varchar(20)  | YES  | | NULL
| |
| department  | varchar(200) | YES  | | NULL   
| |
| comments| varchar(255) | YES  | | NULL
| |
| authorid| int(5) | NO   | PRI  | NULL|  
auto_increment |
| sent_email  | varchar(20)  | YES  |  | NULL 
|  |
| suffix | varchar(50)| YES  || NULL  
| |

+-+--+--+-+-++

Thanks for any help you can give me!

--
Robert J. Vander Hart
University of Massachusetts Medical School
508-856-3290 | robert.vanderh...@umassmed.edu



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



Re: [PHP-DB] Saving Image in mySQL

2013-03-20 Thread Jim Giner

On 3/20/2013 8:43 AM, Toby Hart Dyke wrote:


You're right - you're pulling $file out of thin air. Once uploaded, the
file is stored in $_FILES['file']['tmp_name'], and you need to manually
read the data into $file yourself. Something like:

   file_get_contents($_FILES['file']['tmp_name'])

   Toby


On 3/19/2013 8:15 PM, Ron Piggott wrote:

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



# bind variables

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



And in doing this your destination would then be the final resting place 
for the image(s), with the pointer to each stored in your table  record 
for that image.  :)


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



Re: [PHP-DB] Saving Image in mySQL

2013-03-20 Thread Jim Giner
Absolutely - do not store any images in a db.  Makes no sense.  The data 
(the image) is static, basically safe from alteration or changing in any 
way, so what is the need?  Save the location/name of the image only and 
store all of them in one (or more) secured folders on the server.  No db 
overhead, no potential roadblocks as you grow your data tables and no 
excess time spent by the os storing and retrieving from the db.


Really - not a good idea.

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



Re: [PHP-DB] Saving Image in mySQL

2013-03-20 Thread Toby Hart Dyke


You're right - you're pulling $file out of thin air. Once uploaded, the 
file is stored in $_FILES['file']['tmp_name'], and you need to manually 
read the data into $file yourself. Something like:


  file_get_contents($_FILES['file']['tmp_name'])

  Toby


On 3/19/2013 8:15 PM, Ron Piggott wrote:

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



# bind variables

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




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



Re: [PHP-DB] Saving Image in mySQL

2013-03-20 Thread Karl DeSaulniers

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

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

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

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

Best,
Karl


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


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


image_url – VARCHAR 100

Best,
Karl



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



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


===

Filename:



===

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

Prepared Statement:

===
# mySQL query

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


# apply query to Prepared Statement

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

# bind variables

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

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

# execute query

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


# retrieve auto_increment value

  $new_record_reference = $dbh->lastInsertId();

  }

  }
===


Ron Piggott



www.TheVerseOfTheDay.info


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP-DB] Saving Image in mySQL

2013-03-20 Thread Gavin Chalkley
I am with Karl on this.

Storing an image in the db is very heavy on lpad times.

Upload the image to a folder with name saved with location
On Mar 19, 2013 11:12 PM, "Karl DeSaulniers"  wrote:

> Hey Ron,
> I don't know how others feel, but I say save yourself a headache and dont
> store the image data, just the url to the image on the server.
>
> image_url – VARCHAR 100
>
> Best,
> Karl
>
>
>
> On Mar 19, 2013, at 3:15 PM, Ron Piggott wrote:
>
>
>> Hi All
>> I don’t understand how to save an image to a mySQL table based on the
>> following form. I am trying to do this using Prepared Statements.  All the
>> fields except the image file itself save in the database.  Right now I have
>> $file as the variable when binding the values.  What should it be?  Ron
>>
>> ===
>> > enctype="multipart/form-data">
>> Filename:
>> 
>> 
>> 
>> ===
>>
>> mySQL table structure:
>> ===
>> reference – INT 10 auto_increment primary
>> caption – VARCHAR 250
>> image_type – VARCHAR 100
>> image_size – INT 10
>> image_name – VARCHAR 100
>> image – LONGBLOB
>> ===
>>
>> Prepared Statement:
>>
>> ===
>> # mySQL query
>>
>>$query = "INSERT INTO `my_images` ( `reference` , `caption` ,
>> `image_type` , `image_size` , `image_name` , `image` ) VALUES ( NULL ,
>> :caption , :image_type , :image_size , :image_name , :image );";
>>
>> # apply query to Prepared Statement
>>
>>if($stmt = $dbh->prepare( $query )) {
>>
>> # bind variables
>>
>>$stmt->bindValue(':caption', 'Test Caption', PDO::PARAM_STR);
>>$stmt->bindValue(':image_type'**, $_FILES["file"]["type"],
>> PDO::PARAM_STR);
>>$stmt->bindValue(':image_size'**, $_FILES["file"]["size"],
>> PDO::PARAM_INT);
>>$stmt->bindValue(':image_name'**, $_FILES["file"]["name"],
>> PDO::PARAM_STR);
>>$stmt->bindValue(':image', $file, PDO::PARAM_STR);
>>
>> # execute query
>>
>>if ( $stmt->execute() or die(print_r($stmt->errorInfo()**,
>> true)) ) {
>>
>> # retrieve auto_increment value
>>
>>$new_record_reference = $dbh->lastInsertId();
>>
>>}
>>
>>}
>> ===
>>
>>
>> Ron Piggott
>>
>>
>>
>> www.TheVerseOfTheDay.info
>>
>
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP-DB] Saving Image in mySQL

2013-03-19 Thread Karl DeSaulniers

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


image_url – VARCHAR 100

Best,
Karl



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



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


===

Filename:



===

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

Prepared Statement:

===
# mySQL query

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


# apply query to Prepared Statement

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

# bind variables

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

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

# execute query

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


# retrieve auto_increment value

   $new_record_reference = $dbh->lastInsertId();

   }

   }
===


Ron Piggott



www.TheVerseOfTheDay.info


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP-DB] My Comments

2013-02-22 Thread Jim Giner

Ethan,

I've spent several hours - at least 7-8 - working with you on this 
latest project.  As you know it has morphed from one "problem" to 
another in the course of days.  Yes - miscommunication on your part 
which you took responsibility for.  That happens.  I even had a whole 
new pair of working scripts tested out and ready to send to you when you 
informed me of this snafu.  But - when you took the functional, working 
example scripts that I wrote and previously gave to you and turned them 
into something unrecognizable and non-functional I realized that I am 
helping the blind.  You don't know the least bit about html structure. 
You don't understand how to code in 3 different "languages" at the same 
time and make them readable, workable, and maintainable.   You also 
don't understand how to diagnose your problem and present it to this 
community in a way that's fathomable and understandable to someone who 
has no clue what your overall goal is.  Sure you may want to include the 
whole g..d... script at this point, but again, that's not what you want 
to do.  You need to debug, to isolate, and to work hard at getting to 
the root of your problem and then, and ONLY THEN, come to others with 
your request for help.  Present a clearly manageable and functioning 
piece of code that you feel is the problem area and ask for help on it.


It is also clear to me that you cannot see the forest for the trees when 
it comes to designing and developing your programming solutions.  After 
our miscommunication and the alteration of your solution from one 
involving an ajax call to obtain data "behind the scenes", two days 
later you post a request for help on exactly that thing.


Your latest plea for help was *impossible* to look at from the outside 
and help you with.  You had the same repeated statements in it.  You 
even had a loop executing twice in it - what's up with that?  You throw 
pieces of your coding attempts at us that clearly don't fit together and 
expect us to make something of it.


And lastly - you just don't get it.  You are dealing with a forum of 
people who have a better understanding of the things you are trying to 
grasp and yet you persevere in blaming us for not helping you.  This is 
not the first time you have complained about that.  And yet you haven't 
learned from it.


For the last time ( on my part at least), LOOKAT THE SCRIPTS I GAVE YOU. 
 STUDY THEM LIKE YOU WOULD A CHEMISTRY BOOK.  THIS IS THE WAY YOU 
SHOULD LEARN TO CODE.  From this point forward adopt *that* style of 
coding until you can morph it into your own style (which everyone has). 
 Only at that point will you be able to converse knowledgeably with the 
people here of whom you are asking for help.  Karl has clearly told you 
the same thing yet you took it with offense (as I'm sure you will this 
letter).  Think - there is a reason behind our harshness.  We could have 
just laughed ourselves silly and ignored your posts instead of putting 
time and effort into trying to interpret and help (when possible) and be 
faced time and again with the same clearly unmanageable contexts in your 
confusing posts.


You can choose to ignore this blatantly punishing post and call me 
whatever you wish.  I just could not ignore your silly rejoinder to the 
latest criticism of your attempt at coding.  I'm sure you regretted 
hitting Send almost immediately.


And one more thing - I realize that you are so very proud of that 'PhD' 
at the end of your name.  Well, I'm sure I can speak for many of us here 
- it means nothing.  Painfully obvious when you demonstrate such 
woefully poor computer skills that have not changed one bit in the 6-8 
months that I (and others) have been reading and responding to your 
posts.  Besides - it's a degree in Chemistry.  It's of no use here and I 
would think it's an embarassment to you by now that you continue to tout 
your academic prowess yet do not show the slightest bit of improvement 
as a student of PHP.


By the way - Fortran is nothing like the kind of involved technology 
that you are attempting to work with now.  Why do you keep pointing it 
out?  Many of us (older folks) here probably wrote Fortran at some point 
in our careers - do you think any of us remember the first thing about 
it?  Or use anything gleaned from it in today's world?


Sincerely, seriously, and known for holding no punches,
Jim Giner


ps - if you want my unsent, last attempts that I mentioned, drop me a 
line.  Or not.


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



Re: [PHP-DB] My Comments

2013-02-21 Thread Karl DeSaulniers


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


Dear List -

Correction

William N. Lipscomb, Jr.

Ethan


Dear List -

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


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


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


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


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

and

Prof. Richard Courant, director of what is now the Courant Institute  
of Mathematical Sciences  at New York University.

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


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


My two cents.

Ethan


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




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


Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP-DB] My Comments

2013-02-21 Thread Matijn Woudt
On Thu, Feb 21, 2013 at 10:08 PM, Ethan Rosenberg, PhD <
erosenb...@hygeiabiomedical.com> wrote:
>
> Dear List -
>
> I feel, and correct me if I am wrong, that a list as this or similar,
> should be devoted to help and not sarcasm.  I try to be quiet and to not
> "toot my horn", but as events have progressed, I feel I must.
> <<>>
> Ethan
>
>
Ethan,

First of all, Professors and PhD students get paid, we don't. There are
plenty of people that want to spends hours and hours with your PHP problems
if they get paid.
Second, the amount of questions on this list you ask are higher than
average.
Third, you have been given quite a lot tips on how to learn PHP better, how
to learn other things, including tips on how to make it easier for us to
answer your questions by providing better information your questions. But
somehow you seem to ignore those.

My third point is maybe the most important one. We all try to help, but if
the person asking questions does not take the effort to make it easier for
the ones that help (voluntary!), it's not worth the effort. You might have
noticed that I simply ignore the questions you ask, because of this.

- Matijn


Re: [PHP-DB] My Comments

2013-02-21 Thread Karl DeSaulniers

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


Dear List -

Correction

William N. Lipscomb, Jr.

Ethan


Dear List -

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


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


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


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


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

and

Prof. Richard Courant, director of what is now the Courant Institute  
of Mathematical Sciences  at New York University.

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


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


My two cents.

Ethan


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




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


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


Ever heard of the teddy bear technique?

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


GL 2 U,

Best,

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

Design Drumm
http://designdrumm.com


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



Re: [PHP-DB] Ajax

2013-02-21 Thread Jim Giner

On 2/21/2013 2:34 AM, Karl DeSaulniers wrote:

Hi Ethan,
With all due respect, I really wish I could help, but your structure of
how your doing your
html and php and javascript mix doesn't make sense enough for me
to understand what it is your doing or how to help you. I copied and
pasted your original code
in my editor and it broke all over the place with the syntax
highlighting I have.
That is a big sign your code is not developed properly. Not even the
basic HTML.

I'd suggest getting yourself aquatinted with basic HTML structure first,
then continue with any front or back end languages like
learn how to get the value of fields vs. a TD and how to pass them to
functions.
How to echo php vars into javascript vars, etc.

Got to learn to crawl before you can walk as they say.

:)

GL,
Karl


ROFL


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



Re: [PHP-DB] Re: AJAX/Javascript??

2013-02-11 Thread Jim Giner

On 2/11/2013 10:08 AM, Michael Oki wrote:

Create a form and add a submit button that will run a php file.
The SQL query in the php file will have something like
"SELECT custName FROM table WHERE lname='$lname';
This will come after you have retrieved the data from a form like this
$lname = $_POST['lname'];




Michael,
The OP has the skills in hand to do what you proposed for him, as 
evidenced by his extensive posts on previous problems. From his subject 
line, I think he's more interested in an interactive ie, client-side, 
solution, but I could be totally off-base.  We'll just have to wait for 
Ethan's response to our posts.


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



Re: [PHP-DB] Re: AJAX/Javascript??

2013-02-11 Thread Michael Oki
Create a form and add a submit button that will run a php file.
The SQL query in the php file will have something like
"SELECT custName FROM table WHERE lname='$lname';
This will come after you have retrieved the data from a form like this
$lname = $_POST['lname'];


On 10 February 2013 15:45, Jim Giner  wrote:

> On 2/9/2013 10:51 PM, Ethan Rosenberg, PhD wrote:
>
>> I know that this might be an Ajax/Javascript question.  Hopefully you
>> can help.  I do not know of any other source for good info.
>>
>> I would like to be able to click on one field in a table, and retrieve
>> the data in another field.  Here is the information:
>>
>> The table is:
>>
>> +--+--**+--+-+-+--**-+
>> | Field| Type | Null | Key | Default | Extra |
>> +--+--**+--+-+-+--**-+
>> | Cust_Num | smallint(5) unsigned | NO   | PRI | NULL|   |
>> | Fname| varchar(25)  | NO   | | NULL|   |
>> | Lname| varchar(25)  | NO   | | NULL|   |
>> | Street   | varchar(25)  | NO   | | NULL|   |
>> | City | varchar(25)  | NO   | | NULL|   |
>> | State| varchar(2)   | NO   | | NULL|   |
>> | Zip  | mediumint(9) | NO   | | NULL|   |
>> | Phone| int(10)  | NO   | | NULL|   |
>> | Date | date | NO   | | NULL|   |
>> | Notes| text | YES  | | NULL|   |
>> | P1   | int(3)   | YES  | | NULL|   |
>> | P2   | int(3)   | YES  | | NULL|   |
>> | P3   | int(4)   | YES  | | NULL|   |
>> +--+--**+--+-+-+--**-+
>>
>> Click on Lname and retrieve the Cust_Num.
>>
>> Here is the sql query that will be used:
>>
>> $sql12 = 'SELECT Cust_Num, Fname, Lname, Street, City, State, Zip,
>> Phone, Notes FROM Customers WHERE Cust_Num = $_POST['Cust_Num'];
>>
>> [I'm actually doing this w/ prepared statements]
>>
>>  $i = 0;
>>  do
>>  {
>>  {
>>
>>  $vara2 = array(array($Cust_Num, $Fname,
>> $Lname, $Street, $City, $State, $Zip, $Phone, $Notes));
>>  $vara2[$i][0]= $Cust_Num;
>>  $vara2[$i][1]= $Fname;
>>  $vara2[$i][2]= $Lname;
>>  $vara2[$i][3]= $Street;
>>  $vara2[$i][4]= $City;
>>  $vara2[$i][5]= $State;
>>  $vara2[$i][6]= $Zip;
>>  $vara2[$i][7]= $Phone;
>>  $vara2[$i][8]= $Notes;
>>
>>  $_SESSION['exe'] = 2;
>>
>> ?>
>> 
>>   
>>   
>>   
>>   
>>   
>>   
>>   
>>   
>> 
>> >  echo "\n";
>>  $i = $i + 1;
>>  }
>>  } while (mysqli_stmt_fetch($stmt)); //end
>> do-while
>>  $imax = $i;
>>  echo "";
>>  echo "";
>>
>>  }//end count($errors_array)
>>
>>
>> Any ideas?
>>
>> Eitan
>>
>>
>>  I'm not sure what you are going to do with the customer number when you
> get it since you are outside of php but here's one way of getting it on the
> fly:
>
> As you build your html table wtih php, assign an id to the name fields and
> the custno fields, such as 'id=name1' id='name2', etc. and 'id=cust1',
> 'it=cust2' and so on.
>
> On the name field also add an onclick=getCustNo($i) where $i has the value
> of the id value.  Then write a javascript function like:
>
> function getCustNo(id)
> {
> var cno = "cust"+id;
> var cname = "name"+id;
> namefld = document.getElementById(cname)**.value;
> custno = document.getElementById(cno).**value;
> alert("Customer "+namefld+ "has customer number "+custno);
> return;
> }
>
> As I said - I don't know what you think you are going to do now but you
> got it.
>
> PS - I might have used ".value" when it should be ".innerHTML" in the js
> code.  You'll have to experiment.
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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

2013-02-07 Thread Karl DeSaulniers

Ron, got you covered.. ;)

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


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

Best,
Karl


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


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

Hi Everyone

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

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

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



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


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


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


Ron Piggott


www.TheVerseOfTheDay.info

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


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


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


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


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


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


Piece of cake!

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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



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

2013-02-02 Thread tamouse mailing lists
On Sat, Feb 2, 2013 at 8:08 PM, Ethan Rosenberg, PhD
 wrote:
> I  must be missing something fundamental!!

Yes.

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

Please explain why you are not checking error returns from function calls?

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



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

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


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

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

else
{
echo "Ouch result13";
}

mysqli_free_result($result13);

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

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

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

else
{
echo "Ouch result1";
}

Try that..

Best,
Karl


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


I  must be missing something fundamental!!

Here is a code snippet:

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


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


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

else
{
echo "Ouch result13";
}

mysqli_free_result($result13);

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


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

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

else
{
echo "Ouch result1";
}

Here are my results:


Ouch result13

Row count result1 is 45

What am I doing wrong??

Ethan
=


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


Sorry for bothering you with trivia.

Ethan



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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP-DB] pdo ?

2013-01-25 Thread Jim Giner

On 1/25/2013 10:56 AM, Jim Giner wrote:

On 1/24/2013 7:07 PM, Matt Pelmear wrote:

On 01/24/2013 04:02 PM, Jim Giner wrote:


I took my 6 line override php.ini file and replicated (with a script)
into all of my possible folders under my web root.  NOt exactly an
elegant solution, but with the script, easy to maintain.



Honestly, you would be better off just putting those 6 overrides into
your common include file.
I'm curious why would you do that as opposed to just putting it in the
webroot with a single .htaccess file (or changing the global php.ini)?

I don't have access to the global ini file.  As for .htaccess - I
thought your previous (?) said I would need to have multiple of them also.
Upon further research - I find that my domain has .htaccess files 
throughout the entire directory structure - not by my doing.  So I'm 
guessing that would mean having my individual php settings applied to each?


I think that I'll stay with a php.ini override file in each of my 
executable folders - now that I have the script necessary to easily 
apply new versions from my master one when needed.


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



Re: [PHP-DB] pdo ?

2013-01-25 Thread Jim Giner

On 1/24/2013 7:07 PM, Matt Pelmear wrote:

On 01/24/2013 04:02 PM, Jim Giner wrote:


I took my 6 line override php.ini file and replicated (with a script)
into all of my possible folders under my web root.  NOt exactly an
elegant solution, but with the script, easy to maintain.



Honestly, you would be better off just putting those 6 overrides into
your common include file.
I'm curious why would you do that as opposed to just putting it in the
webroot with a single .htaccess file (or changing the global php.ini)?
I don't have access to the global ini file.  As for .htaccess - I 
thought your previous (?) said I would need to have multiple of them also.


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



Re: [PHP-DB] pdo ?

2013-01-24 Thread Matt Pelmear

On 01/24/2013 04:02 PM, Jim Giner wrote:


I took my 6 line override php.ini file and replicated (with a script) 
into all of my possible folders under my web root.  NOt exactly an 
elegant solution, but with the script, easy to maintain.




Honestly, you would be better off just putting those 6 overrides into 
your common include file.
I'm curious why would you do that as opposed to just putting it in the 
webroot with a single .htaccess file (or changing the global php.ini)?


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



Re: [PHP-DB] pdo ?

2013-01-24 Thread Jim Giner

On 1/24/2013 6:09 PM, Matt Pelmear wrote:

On 01/24/2013 01:34 PM, Jim Giner wrote:


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

-Matt

It sounds like I'll have to modify multiple htaccess files - which is
about the same as this php.ini problem - having multiples perhaps.

I've been working fine with a php.ini that merges onto the "full" ini
file.  Suddenly this new appl is not seeing the overrides.

Any info you can point me to about how php.ini files work?  The manual
doesn't get very specific about it.



You would only have to modify multiple .htaccess files if you have
multiple document roots that need this change applied to them.
Otherwise just create/edit the .htaccess file in the document root for
the site you want the change applied to.
.htacess isn't always read by Apache. Some configurations tell it to
read or not read that file, so you may need to check that as well.

phpinfo() will tell you which php.ini file is being used-- if you edit
the one it says is being used you should see a change unless something
else is overriding the setting (like an .htaccess file or your code).

-Matt

I took my 6 line override php.ini file and replicated (with a script) 
into all of my possible folders under my web root.  NOt exactly an 
elegant solution, but with the script, easy to maintain.


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



Re: [PHP-DB] pdo ?

2013-01-24 Thread Jim Giner

On 1/24/2013 6:03 PM, Matt Pelmear wrote:

On 01/24/2013 01:37 PM, Karl DeSaulniers wrote:


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


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

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

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

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


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



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



Every pro has this feature (magic_quotes_gpc) turned off. If you
understand SQL Injection vulnerabilities, and properly bind
things into
your queries, I would recommend disabling it.

-Matt

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


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

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

49'ers

I can confirm it by using my browser's "view source" to see
that is
exactly how it exists in the page.

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

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




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

My root folder has a php.ini file with the magic quotes set off.
Doesn't
that carry on down to folders beneath it?



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

-Matt


Create an info.php file containing ...


Matt & Rich,

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

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



Jim,

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

Official reference pages:
http://php.net/manual/en/configuration.changes.php  (you might want
to read through the comments here, too)
http://httpd.apache.org/docs/current/howto/htaccess.html

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

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

-Matt

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




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

adding slashes if magic_quotes is disabled:

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

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

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

I wouldn't suggest the last one if your not going to sanitize yourself
as it will make you vulnerable.
But all-in-all very simple to implement.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com




You shouldn't be sanitizing using addslashes() regardless, or using
magic_quotes_gpc at all really, if you can help it.
See: http://php.net/manual/en/security.magicquotes.whynot.php
(magic_quotes was deprecated because it is bad.)

-Matt


And I'm not.

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



Re: [PHP-DB] pdo ?

2013-01-24 Thread Jim Giner

On 1/24/2013 4:37 PM, Karl DeSaulniers wrote:


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


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

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

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

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


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



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



Every pro has this feature (magic_quotes_gpc) turned off. If you
understand SQL Injection vulnerabilities, and properly bind
things into
your queries, I would recommend disabling it.

-Matt

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


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

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

49'ers

I can confirm it by using my browser's "view source" to see that is
exactly how it exists in the page.

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

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




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

My root folder has a php.ini file with the magic quotes set off.
Doesn't
that carry on down to folders beneath it?



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

-Matt


Create an info.php file containing ...


Matt & Rich,

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

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



Jim,

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

Official reference pages:
http://php.net/manual/en/configuration.changes.php  (you might want to
read through the comments here, too)
http://httpd.apache.org/docs/current/howto/htaccess.html

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

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

-Matt

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




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

adding slashes if magic_quotes is disabled:

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

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

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

I wouldn't suggest the last one if your not going to sanitize yourself
as it will make you vulnerable.
But all-in-all very simple to implement.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


Not the problem.  I have other overrides that I need to include somehow.

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



Re: [PHP-DB] pdo ?

2013-01-24 Thread Matt Pelmear

On 01/24/2013 01:34 PM, Jim Giner wrote:


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

-Matt
It sounds like I'll have to modify multiple htaccess files - which is 
about the same as this php.ini problem - having multiples perhaps.


I've been working fine with a php.ini that merges onto the "full" ini 
file.  Suddenly this new appl is not seeing the overrides.


Any info you can point me to about how php.ini files work?  The manual 
doesn't get very specific about it.




You would only have to modify multiple .htaccess files if you have 
multiple document roots that need this change applied to them.
Otherwise just create/edit the .htaccess file in the document root for 
the site you want the change applied to.
.htacess isn't always read by Apache. Some configurations tell it to 
read or not read that file, so you may need to check that as well.


phpinfo() will tell you which php.ini file is being used-- if you edit 
the one it says is being used you should see a change unless something 
else is overriding the setting (like an .htaccess file or your code).


-Matt


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



Re: [PHP-DB] pdo ?

2013-01-24 Thread Matt Pelmear

On 01/24/2013 01:37 PM, Karl DeSaulniers wrote:


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


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

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

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

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


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



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




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

your queries, I would recommend disabling it.

-Matt

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


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


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


49'ers

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

exactly how it exists in the page.

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

updating my sql database.

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




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

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

that carry on down to folders beneath it?



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

-Matt


Create an info.php file containing ...


Matt & Rich,

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


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




Jim,

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


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

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

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

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


-Matt

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




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

adding slashes if magic_quotes is disabled:

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

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


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

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

But all-in-all very simple to implement.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com




You shouldn't be sanitizing using addslashes() regardless, or using 
magic_quotes_gpc at all really, if you can help it.
See: http://php.net/manual/en/security.magicquotes.whynot.php 
(magic_quotes was deprecated because it is bad.)


-Matt


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



Re: [PHP-DB] pdo ?

2013-01-24 Thread Karl DeSaulniers


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


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

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

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

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


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



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


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

your queries, I would recommend disabling it.

-Matt

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


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


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


49'ers

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

exactly how it exists in the page.

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

updating my sql database.

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




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

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

that carry on down to folders beneath it?



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

-Matt


Create an info.php file containing ...


Matt & Rich,

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


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




Jim,

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


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

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

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

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


-Matt

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




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

adding slashes if magic_quotes is disabled:

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

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


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

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

But all-in-all very simple to implement.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP-DB] pdo ?

2013-01-24 Thread Jim Giner


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

-Matt
It sounds like I'll have to modify multiple htaccess files - which is 
about the same as this php.ini problem - having multiples perhaps.


I've been working fine with a php.ini that merges onto the "full" ini 
file.  Suddenly this new appl is not seeing the overrides.


Any info you can point me to about how php.ini files work?  The manual 
doesn't get very specific about it.


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



Re: [PHP-DB] pdo ?

2013-01-24 Thread Matt Pelmear

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

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

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

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


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



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




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

your queries, I would recommend disabling it.

-Matt

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


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

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


49'ers

I can confirm it by using my browser's "view source" to see that is
exactly how it exists in the page.

When I hit a submit button and my script retrieves the 'post' 
vars my

debugging steps are showing that the var $_POST['team'] contains the
above value with a backslash (\) already inserted. This is 
causing me

a problem when I then try to use pdo->quote to safely encode it for
updating my sql database.

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




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

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

that carry on down to folders beneath it?



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

-Matt


Create an info.php file containing ...


Matt & Rich,

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


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




Jim,

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


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

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

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

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


-Matt

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



Re: [PHP-DB] pdo ?

2013-01-24 Thread Jim Giner

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

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

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


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



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


Every pro has this feature (magic_quotes_gpc) turned off. If you
understand SQL Injection vulnerabilities, and properly bind things into
your queries, I would recommend disabling it.

-Matt

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


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

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

49'ers

I can confirm it by using my browser's "view source" to see that is
exactly how it exists in the page.

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

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




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

My root folder has a php.ini file with the magic quotes set off. Doesn't
that carry on down to folders beneath it?



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

-Matt


Create an info.php file containing ...


Matt & Rich,

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


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


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



Re: [PHP-DB] pdo ?

2013-01-24 Thread Richard Quadling
On 24 January 2013 17:48, Matt Pelmear  wrote:
> On 01/24/2013 09:23 AM, Jim Giner wrote:
>>
>> On 1/24/2013 12:05 PM, Matt Pelmear wrote:
>>>
>>>
>>> http://stackoverflow.com/questions/5801951/does-php-auto-escapes-quotes-in-string-which-is-passed-by-get-or-post
>>>
>>>
>>> Every pro has this feature (magic_quotes_gpc) turned off. If you
>>> understand SQL Injection vulnerabilities, and properly bind things into
>>> your queries, I would recommend disabling it.
>>>
>>> -Matt
>>>
>>> On 01/24/2013 08:55 AM, Jim Giner wrote:

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

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

 49'ers

 I can confirm it by using my browser's "view source" to see that is
 exactly how it exists in the page.

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

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

>>>
>> You're right!  But I must not understand something.
>>
>> My root folder has a php.ini file with the magic quotes set off. Doesn't
>> that carry on down to folders beneath it?
>>
>
> I would check phpinfo() to see if it is being overridden.
>
> -Matt

Create an info.php file containing ...

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] pdo ?

2013-01-24 Thread Matt Pelmear

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

On 1/24/2013 12:05 PM, Matt Pelmear wrote:
http://stackoverflow.com/questions/5801951/does-php-auto-escapes-quotes-in-string-which-is-passed-by-get-or-post 




Every pro has this feature (magic_quotes_gpc) turned off. If you
understand SQL Injection vulnerabilities, and properly bind things into
your queries, I would recommend disabling it.

-Matt

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

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

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

49'ers

I can confirm it by using my browser's "view source" to see that is
exactly how it exists in the page.

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

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




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

My root folder has a php.ini file with the magic quotes set off. 
Doesn't that carry on down to folders beneath it?




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

-Matt


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



Re: [PHP-DB] pdo ?

2013-01-24 Thread Jim Giner

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

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


Every pro has this feature (magic_quotes_gpc) turned off. If you
understand SQL Injection vulnerabilities, and properly bind things into
your queries, I would recommend disabling it.

-Matt

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

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

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

49'ers

I can confirm it by using my browser's "view source" to see that is
exactly how it exists in the page.

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

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




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

My root folder has a php.ini file with the magic quotes set off. 
Doesn't that carry on down to folders beneath it?


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



Re: [PHP-DB] pdo ?

2013-01-24 Thread Matt Pelmear

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

Every pro has this feature (magic_quotes_gpc) turned off. If you 
understand SQL Injection vulnerabilities, and properly bind things into 
your queries, I would recommend disabling it.


-Matt

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

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

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

49'ers

I can confirm it by using my browser's "view source" to see that is 
exactly how it exists in the page.


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


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





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



Re: [PHP-DB] Firebird return wrong value

2013-01-18 Thread Lester Caine

Berko Bubu wrote:

INSERT INTO PRICE (ID, "NAME", COST)



You should not use double quotes around column names. Try to use backtick
operator instead:
INSERT INTO `PRICE` (`ID`, `NAME`, `COST`)
Don't know if that solves the problem, but it's atleast good practice.
Second, do you really need firebird database?
It's pretty outdated database, and there are much better alternatives.

It's an existing system, so i can't change it.
I have tried with firebird 2.5 and same result.

The value stored right. I have seen it in FlameRobin, ISQL, etc
And when i use native native lib (ibase_connect,ibase_prepare,ibase_execute) i 
get right value.
Maybe is it a bug in pdo_firebird driver ?


This is possible ...
Have you tried the other options to PDO::FETCH_ASSOC ?

I've not bothered with the PDO drivers as the Firebird one can't cope with 
two-phase commits cross database, and I know that others have found the 
restrictions imposed by PDO prevent things working well in older style Firebird 
Applications.


--
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] Firebird return wrong value

2013-01-18 Thread Lester Caine

Matijn Woudt wrote:

Dear List!
>
>i have a strange problem.
>
>I have a Firebird database (dialect 3). Firebird server: 2.0.6
>I create a table, and insert a row like that:
>CREATE TABLE PRICE (
>   ID INTEGER NOT NULL,
>   "NAME" VARCHAR(10),
>   COST NUMERIC(15, 2));
>
>INSERT INTO PRICE (ID, "NAME", COST)
>

You should not use double quotes around column names. Try to use backtick
operator instead:
INSERT INTO `PRICE` (`ID`, `NAME`, `COST`)
Don't know if that solves the problem, but it's atleast good practice.
Second, do you really need firebird database?
It's pretty outdated database, and there are much better alternatives.


Matijn ... All totally incorrect information for a REAL SQL database. Backticks 
are a bodge for MySQL only and not part of the SQL standard.


And Firebird is used for many systems worldwide and is a much better alternative 
to many later database engines. Many Oracle users are porting over to Firebird 
to reduce costs.


--
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] Firebird return wrong value

2013-01-18 Thread Berko Bubu
> > INSERT INTO PRICE (ID, "NAME", COST)
> >
> 
> You should not use double quotes around column names. Try to use backtick
> operator instead:
> INSERT INTO `PRICE` (`ID`, `NAME`, `COST`)
> Don't know if that solves the problem, but it's atleast good practice.
> Second, do you really need firebird database?
> It's pretty outdated database, and there are much better alternatives.
It's an existing system, so i can't change it. 
I have tried with firebird 2.5 and same result.

The value stored right. I have seen it in FlameRobin, ISQL, etc
And when i use native native lib (ibase_connect,ibase_prepare,ibase_execute) i 
get right value.
Maybe is it a bug in pdo_firebird driver ?


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



Re: [PHP-DB] Firebird return wrong value

2013-01-18 Thread Matijn Woudt
On Fri, Jan 18, 2013 at 12:49 PM,  wrote:

> Dear List!
>
> i have a strange problem.
>
> I have a Firebird database (dialect 3). Firebird server: 2.0.6
> I create a table, and insert a row like that:
> CREATE TABLE PRICE (
>   ID INTEGER NOT NULL,
>   "NAME" VARCHAR(10),
>   COST NUMERIC(15, 2));
>
> INSERT INTO PRICE (ID, "NAME", COST)
>

You should not use double quotes around column names. Try to use backtick
operator instead:
INSERT INTO `PRICE` (`ID`, `NAME`, `COST`)
Don't know if that solves the problem, but it's atleast good practice.
Second, do you really need firebird database?
It's pretty outdated database, and there are much better alternatives.

- Matijn


Re: [PHP-DB] Firebird return wrong value

2013-01-18 Thread Lester Caine

vbe...@mail.com wrote:

result:
Array ( [0] => Array ( [COST] => -0.00 ) )


As a starting point ... can you look at the database using Flamerobin and check 
what it shows has been stored. I don't see anything wrong with what you have 
done except that 'cost' should perhaps be -1.0, so once we know what IS in the 
database we can look at which end has gone wrong ;)


--
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] PDO ?

2013-01-15 Thread Kapu®

On 15. 1. 2013 18:25, Jim Giner wrote:

Doing some conversion - looking for a solution.

Currently I do something like this:

while (list($var1,$var2) = mysql_fetch_array($qrslts))
{
handle the vars
}

Is there something in the PDO functions that emulates this same 
ability?  Some of my uses of the sql syntax have many more vars and I'm
trying to avoid having to move the fetch-ed fields one at a time to 
vars that I wish to use.

I already tried:

list($var1,$var2) = $qrslts->fetch(PDO::FETCH_ASSOC);

this does not populate the vars.


Hi,

using PDO::FETCH_NUM instead PDO::FETCH_ASSOC should do the job.

Kapu

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



Re: [PHP-DB] Re: SQL syntax

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


Thanks all,

Best,
Karl

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


Try It And See

Bastien Koert

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




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


Karl DeSaulniers wrote:


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

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

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

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

TIA,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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

it looks wrong to me.

But you might try the IN operator - something like

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

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

A cynic smells flowers and looks for the casket.


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



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

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

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP-DB] Re: SQL syntax

2013-01-15 Thread Bastien
Try It And See

Bastien Koert

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

> 
> On Jan 15, 2013, at 5:31 AM, David Robley wrote:
> 
>> Karl DeSaulniers wrote:
>> 
>>> Hello Everyone,
>>> Hope your 2013 is treating you well.
>>> Quick question and apologies if it is a stupid question.
>>> Is this a viable syntax?
>>> 
>>> $sql = "SELECT orderid
>>> FROM ORDERS_TABLE
>>> WHERE orderstatus = 'Cancelled' OR (orderstatus = ('New' OR
>>> 'Denied' OR 'Expired' OR 'Failed' OR 'Pending' OR 'Refunded' OR
>>> 'Reversed' OR 'Under Review' OR 'Voided') AND orderdate <
>>> '".mysqli_real_escape_string($yesterday)."')";
>>> 
>>> Namely the orderstatus = (a whole bunch of options).
>>> In my database `orderstatus` field is an enum() list btw.
>>> Or is there a better way to check multiple options against an enum
>>> inside your select statement?
>>> Reason I am doing this is to avoid having to do...
>>> 
>>> $sql = "SELECT orderid
>>> FROM ORDERS_TABLE
>>> WHERE orderstatus = 'Cancelled' OR (orderstatus = 'New'  AND
>>> orderdate < '".mysqli_real_escape_string($yesterday)."') OR
>>> (orderstatus = 'Denied'  AND orderdate <
>>> '".mysqli_real_escape_string($yesterday)."') OR (orderstatus =
>>> 'Expired'  AND orderdate <
>>> '".mysqli_real_escape_string($yesterday)."') ... etc";
>>> 
>>> TIA,
>>> 
>>> Karl DeSaulniers
>>> Design Drumm
>>> http://designdrumm.com
>> 
>> The best way to check if your SQL query is valid is to feed it to mysql
>> which will return an error if the syntax is incorrect :-) So TIAS! Although
>> it looks wrong to me.
>> 
>> But you might try the IN operator - something like
>> 
>> OR (orderstatus IN ('New', 'Denied', 'Expired', 'Failed', 'Pending',
>> 'Refunded', 'Reversed', 'Under Review', 'Voided') AND orderdate <
>> '".mysqli_real_escape_string($yesterday)."')
>> 
>> Personally I would have used a lookup table for the order status.
>> -- 
>> Cheers
>> David Robley
>> 
>> A cynic smells flowers and looks for the casket.
>> 
>> 
>> -- 
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> Thanks for the suggestion. Your the second to offer the IN as a solution.
> I will try that out. I currently have enough tables and don't want to create 
> a separate table for the status.
> BTW what is TIAS... havent seen that one.. lol
> 
> Best,
> 
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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



Re: [PHP-DB] Re: SQL syntax

2013-01-15 Thread Karl DeSaulniers


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


Karl DeSaulniers wrote:


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

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

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

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

TIA,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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

it looks wrong to me.

But you might try the IN operator - something like

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

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

A cynic smells flowers and looks for the casket.


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




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

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

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP-DB] SQL syntax

2013-01-15 Thread Karl DeSaulniers


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


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

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

Another option would be to use either  of these functions

  - Find-in-set.

  This is useful if your data type is SET/ENUM type
  - Field



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



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

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






regds
amit

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



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

I will try the IN option.

Thank you.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP-DB] SQL syntax

2013-01-15 Thread Amit Tandon
SELECT orderid
FROM ORDERS_TABLE
WHERE orderstatus IN ( 'Cancelled', 'New'", 'Denied',
'Expired' , 'Failed' , 'Pending' , 'Refunded' , 'Reversed' , 'Under Review'
, 'Voided') AND orderdate < '".mysqli_real_escape_string($
yesterday);

Another option would be to use either  of these functions

   - 
Find-in-set.
   This is useful if your data type is SET/ENUM type
   - 
Field


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

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




regds
amit

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


Re: [PHP-DB] Error Checking

2013-01-08 Thread tamouse mailing lists
On Tue, Jan 8, 2013 at 11:54 AM, Ethan Rosenberg, PhD
 wrote:
> Dear List -
>
> 1] What function(s) do you use for error checking?
> 2] What are the settings for the parameter(s) in the functions?
> 3] Do you have different php.ini files for development and production?

This makes more sense answered in reverse:

3. Yes, I have different php.ini files for each of my environments:
development, testing, staging, and production. Generally speaking, my
development and test environments run on the same box, my local
workstation. Sometimes, test is run in a VM on my local workstation,
but is entirely self-contained. Staging and production are generally
on my VPS, under different directories and subdomains.

2. This is what I set in the appropriate php.ini for the environment:

For dev and test:

error_reporting = E_ALL | E_STRICT
display_errors = On
display_startup_errors = On
html_errors = On
log_errors = On

For staging and production:

error_reporting = E_ALL & ~E_STRICT
display_errors = Off
display_startup_errors = Off
html_errors = Off
log_errors = On


1. Functions I use for reporting errors:

error_log() to indicate internal application problems the code can detect.

a home-brewed debugging function that provides a single call for
insertion in code that will provide additional debugging information
based on environment and configuration.

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



Re: [PHP-DB] Netbeans

2013-01-08 Thread Bastien


Bastien Koert

On 2013-01-08, at 1:00 PM, "Ethan Rosenberg, PhD" 
 wrote:

> Dear List -
> 
> Does anyone know how to set up Netbeans?
> 
> I've tried and am unsuccessful.
> 
> Thanks
> 
> Ethan
> 

It's a simple installer for the OS you're running. 

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



Re: [PHP-DB] Programs not running - Mystery SOLVED

2013-01-08 Thread tamouse mailing lists
On Tue, Jan 8, 2013 at 1:12 AM, Matt Pelmear  wrote:
> I personally *never* set the error reporting level in the code, and during
> code reviews I reject code that does so.
> It is much cleaner to manage this in php.ini.

I tend to agree -- settings like this are environment (dev, test,
stage, prod) dpendent and generally the code being developed should
work in all of them without modification.

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



Re: [PHP-DB] Programs not running - Mystery SOLVED

2013-01-07 Thread Matt Pelmear

This is a *very* common problem, so don't feel too bad :-)

I personally *never* set the error reporting level in the code, and 
during code reviews I reject code that does so.

It is much cleaner to manage this in php.ini.

Glad you solved your problem.

-Matt

On 01/07/2013 08:49 AM, Ethan Rosenberg, PhD wrote:

Dear list -

Boy, Do I make STUPID MISTAKES!

The show_errors was turned off in the program in question!!
When I ran another program, that displayed errors, is threw the 
correct error message.


My apologies for running everyone around numerous trees.

Ethan





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



Re: [PHP-DB] Programs not running

2013-01-07 Thread Matt Pelmear

On 01/06/2013 07:09 PM, tamouse mailing lists wrote:
Actually, you might find netbeans just all that for writing the HTML, 
CSS and JS stuff, too. I used Dreamweaver when it first came out and 
compared to the other sorts of things available at the time, it was 
pretty spiffy. But time has marched on, and creating HTML isn't 
something I want a visual editor for. 


+1 for Netbeans.
I've used all the major IDEs that support PHP over the years. I keep 
coming back to Netbeans. (And ended up using it for Java and C/C++ as 
well, for small projects anyway.)
As much as it is terrible, it is still that much better than the 
alternatives. I don't even have that many complaints about the most 
recent versions. I suggest it for newcomers to multiple teams I work with.


I did really like NuSphere's PhpED, but unfortunately that was only an 
option for me when I still dual-booted into Windows. (They say it runs 
fine in Wine, but major things like the code completion popup are either 
difficult or impossible to get working. Anyone from NuSphere listening? 
I want to pay you for a native Linux version like you used to have...)


-Matt

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