RE: [PHP-DB] Concat 3 fields in a query

2004-12-03 Thread Khristopher_Klaich
Thank you again for the help.  I have constructed my sql statements and am 
able to insert and update the data with the help everyone's feedback.

Martin, thanks for the little turotial on strings it makes sense now and 
sorry if I mis-posted my question to this list.

Khris



"Norland, Martin" <[EMAIL PROTECTED]> 
12/03/2004 02:40 PM
Please respond to
<[EMAIL PROTECTED]>


To
<[EMAIL PROTECTED]>
cc

Subject
RE: [PHP-DB] Concat 3 fields in a query






http://www.php.net/manual/
http://www.php.net/manual/en/language.types.string.php

Basically:
 * quoting with ' is when you just literally want that 
string
output.
 You can't call functions or print variables values within 
it.
e.g. print 'hello_world() 
$name';
 prints just that.
 * if you want to quote with ' - you'll have to mix it up.
e.g. print hello_world() . ' ' 
. $name;
 * the {}'s we saw earlier is a way of explicitly telling 
php to
analyze the whole thing, not just the first bit.
e.g. print 
"$_POST['PO_YEAR']";
 equates to
 print $_POST . 
"['PO_YEAR']";
 and is properly written
 print 
"{$_POST['PO_YEAR']}";

My apologies to both the list for a non-db related post, and to anyone
whos client munges this up something fierce.  Outlook will likely strip
the extra line feeds - click the little yellow box at the top for
legibility.

Cheers,
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.

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




RE: [PHP-DB] Concat 3 fields in a query

2004-12-03 Thread Khristopher_Klaich
Thanks to all that responded to this thread I learned from it.

I actually validate the data before it even gets to the insert or update 
statment to make sure there are no evil characters out there trying to 
cause me pain.

I do have one more question I fixed the insert query now onto the update 
query where the syntax is a little different so from your example I should 
be able to do this then correct?

PO_Date= '" 
concat_ws('-',$_POST['PO_Year'],$_POST['PO_Month'],$_POST['PO_Day'])'"

or would I not need the ' around all of them.  Any good sites out there to 
explain when to use ' and when to use "  sorry kind of a newbie but 
appreicate all of the help maybe one day I can return the favor.

Khris



"Norland, Martin" <[EMAIL PROTECTED]> 
12/03/2004 12:03 PM
Please respond to
<[EMAIL PROTECTED]>


To
<[EMAIL PROTECTED]>
cc

Subject
RE: [PHP-DB] Concat 3 fields in a query






-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED]
>
concat_ws('-',{$_POST['PO_Year']},{$_POST['PO_Month']},{$_POST['PO_Day']
})

I'm pretty sure this will error because of the unneccessary {}'s around
the POST array items.  PHP really doesn't like you using extra curlies
around variables, it's very picky.

Instead:
concat_ws('-',$_POST['PO_Year'],$_POST['PO_Month'],$_POST['PO_Day'])

Not trying to be anal, I've just been bitten many a time as I do lots of
dynamic class and variable coding, and ritualistically try to thunk
curlies around most everything.

> ps. I strongly recommend validating data before you insert into the db

I couldn't agree more.

Cheers,

- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.

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




[PHP-DB] Concat 3 fields in a query

2004-12-03 Thread Khristopher_Klaich
Hello I have a application that has an insert query (using a mysql 
database) and I am having an issue with trying to combine three fields 
with a dash .  Here is my code can anyone please help me out with what 
else I need to add or point me to somewhere that explains how to combine 
field's in a query..

'{$_POST['PO_Year']}-{$_POST['PO_Month']}-{$_POST['PO_Day']}'

Thanks-
Khris


[PHP-DB] looping code

2003-08-11 Thread Khristopher_Klaich
Hello all I have a helpdesk application that was written in php and I 
would like to create a script that will e-mail the systems staff how many 
open helpdesk tickets they have.  There are 10 users and I can wrtie a 
script no problem to do a count and then e-mail that to a user I just have 
no idea how the heck to loop it through all of the users .

Here is my code for one user if they are logged in if anyone can help me 
or lead me in the right direction I would appreicate it very much my brain 
is just not working today:


function showSummary() {
   global $user, $mysql_link;
   $openTickets = 0;
   $userTickets = 0;
 
   $query = "SELECT events.e_id, events.t_id, events.e_status, " .
"events.e_assignedto, ticket.t_id FROM events,ticket " .
" WHERE events.t_id = ticket.t_id ORDER BY " .
" events.t_id, events.e_id;";
   $result = query( $query );

   $row = mysql_fetch_row( $result );

   $prev_e_id = $row[0]; 
   $prev_t_id = $row[1]; 
   $prev_e_status = $row[2]; 
   $prev_e_assignedto = $row[3];

   $done = 0;
   while( !$done  ) {
   $row = mysql_fetch_row( $result );
   if( !$row ) { 
   $done = 1;
   }
 
   $e_id = $row[0]; 
   $t_id = $row[1]; 
   $e_status = $row[2]; 
   $e_assignedto = $row[3];

   if( $t_id != $prev_t_id ) {
   if( $prev_e_status == "OPEN" ) {
   $openTickets++;
   if( $prev_e_assignedto == $user && isset($user) )
   $userTickets++;
   }
   }
 
   $prev_e_id = $e_id;
   $prev_t_id = $t_id;
   $prev_e_status = $e_status;
   $prev_e_assignedto = $e_assignedto;
   }
 
   print "Open Tickets: $openTickets\n";
   print "Assigned to you: $userTickets\n";
}


[PHP-DB] Khristopher Klaich/NYWD/02/USCOURTS is out of the office.

2002-08-15 Thread Khristopher_Klaich

I will be out of the office starting  08/15/2002 and will not return until
08/20/2002.

I will respond to your message when I return.  If this is a systems issue
please contact the helpdesk at 332-1774.


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




[PHP-DB] Php Cacheing everything?

2002-07-12 Thread Khristopher_Klaich

Hi everyone .

I recently upgraded apache to 1.3.26 and I configured it with php 4.0.5 
and now every page that I write get cached on the client.  I have tried to 
insert the code to prevent that in different formats in the  section 
of my page however no luck.  I am thinking it is somthing to do with the 
php.ini file but so far I have had no luck.anyone run into anything 
like this?



Re: [PHP-DB] cookies multiple pages

2002-07-03 Thread Khristopher_Klaich

One thing I did find was to look at your php.ini file and see where the 
session.save_path=/tmp this is now pointing to your server /tmp not the 
apache directory anymore so you will either have to change the permissions 
on that folder so apache can write there or make a directory somewhere 
else and do the same.  That is how I got my sessions to work again and or 
court to make sure it is enabled.  As for the mulitple cookies that is 
still a somthing I have not been able to get to work.

When I posted it in the bugs. section of php.net they said to use the cvs 
apache 2.0.4 version and it should work...but I am not in a position to 
put non-stable things in production.

HTH--
Khris




Terry Romine <[EMAIL PROTECTED]>
07/03/2002 11:32 AM

 
To: [EMAIL PROTECTED]
cc: php-db <[EMAIL PROTECTED]>
Subject:Re: [PHP-DB] cookies multiple pages


1) no, the commented
   setcookie("user_data","",time()+(3600));// set for 6 weeks *24*7*6
 I would move the *24*7*6 back into the (3600) to make it 
so. I just 
want to test for an hour

2) so maybe this is a problem with the server? I've been tearing my hair 
out because neither cookies nor sessions are acting the way that I have 
done them in the past on a different server.

**sigh**

On Wednesday, July 3, 2002, at 10:05 AM, [EMAIL PROTECTED] wrote:

> Is this a issue with register _globals = off.  try referencing it with
> $_COOKIE['user_data'].
> Also isn't 3600 only an hour.  60secs * 60mins?  i think 6 weeks would
> be...  151200  60 * 60 * 42days
> does that work?
>
> Jeff


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