Re: [PHP] SQL Readability.. (was Re: most powerful php editor)

2007-01-28 Thread Jochem Maas
Larry Garfield wrote:
 On Saturday 27 January 2007 1:14 pm, Jochem Maas wrote:
 
 query builders are alot more fiddly to get 'right' than one might
 imagine, dealing with NULLs, booleans and dates for example (as Satyam
 pointed out) can be a right PITA.
 I actually almost never use native date types in the SQL database.  I
 just store unix timestamps and do the math in PHP.  Dates are completely
 unportable anyway.  I also tend to use ints for booleans, too, although
 beefing up the switch statements in the code to handle native booleans
 should be trivial.
 mysql doesn't have booleans does it? at least not versions I have to use.
 with regard to date stuff, many people take the opposite approach and do
 most of the date math inside SQL - most DBs have kickass date calculation
 functions btw.

 and for the times when you need/want unix timestamps, mysql atleast, gives
 you UNIX_TIMSTAMP().
 
 At least as of MySQL 4.1 (haven't played with MySQL 5 much yet), yes, MySQL 
 has no native boolean data type that I know of.  The standard alternative is 
 TINYINT(1), which technically gives you values 0-9.  
 
 And yes, I agree that MySQL has fairly decent date manipulation routines.  
 But 
 at work we do try for database independence when possible, so except on 
 specific projects we try to avoid it.

again we differ :-) I have never bought the 'data independence' story - in 
practice
it's of little value imho most of the time (granted certain products do benefit 
- but
what I build doesn't fall into that category) and I find it crazy to end up with
a situation where the most advanced peice of data manipulation software in a 
given stack
is dumbed down to the lowest common denominator [of DB engines]. On more 
complex project
I try to cram as much of the data intregity and business logic in to the 
database itself
(for which I use firebird mostly) because it means being able to create 
different clients
to the data without replicating [as much] business logic (e.g. website and 
desktop app).
besides which the required stored procedures and triggers are usually hundreds 
of lines less
than their php equivalent AND more importantly they are intrinsically atomic 
(in the sense that
database transaction 'should' be).

rgds :-)

 

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



Re: [PHP] SQL Readability.. (was Re: most powerful php editor)

2007-01-28 Thread Satyam


- Original Message - 
From: Jochem Maas [EMAIL PROTECTED]

To: Larry Garfield [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Sunday, January 28, 2007 12:55 PM
Subject: Re: [PHP] SQL Readability.. (was Re: most powerful php editor)



Larry Garfield wrote:

On Saturday 27 January 2007 1:14 pm, Jochem Maas wrote:


query builders are alot more fiddly to get 'right' than one might
imagine, dealing with NULLs, booleans and dates for example (as Satyam
pointed out) can be a right PITA.

I actually almost never use native date types in the SQL database.  I
just store unix timestamps and do the math in PHP.  Dates are 
completely

unportable anyway.  I also tend to use ints for booleans, too, although
beefing up the switch statements in the code to handle native booleans
should be trivial.
mysql doesn't have booleans does it? at least not versions I have to 
use.

with regard to date stuff, many people take the opposite approach and do
most of the date math inside SQL - most DBs have kickass date 
calculation

functions btw.

and for the times when you need/want unix timestamps, mysql atleast, 
gives

you UNIX_TIMSTAMP().


At least as of MySQL 4.1 (haven't played with MySQL 5 much yet), yes, 
MySQL
has no native boolean data type that I know of.  The standard alternative 
is

TINYINT(1), which technically gives you values 0-9.

And yes, I agree that MySQL has fairly decent date manipulation routines. 
But

at work we do try for database independence when possible, so except on
specific projects we try to avoid it.


again we differ :-) I have never bought the 'data independence' story - in 
practice
it's of little value imho most of the time (granted certain products do 
benefit - but
what I build doesn't fall into that category) and I find it crazy to end 
up with
a situation where the most advanced peice of data manipulation software in 
a given stack
is dumbed down to the lowest common denominator [of DB engines]. On more 
complex project
I try to cram as much of the data intregity and business logic in to the 
database itself
(for which I use firebird mostly) because it means being able to create 
different clients
to the data without replicating [as much] business logic (e.g. website and 
desktop app).
besides which the required stored procedures and triggers are usually 
hundreds of lines less
than their php equivalent AND more importantly they are intrinsically 
atomic (in the sense that

database transaction 'should' be).

rgds :-)



Hear!, hear! (or something to that effect)

Satyam






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



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



[PHP] CMS Engine(s) with Savant (or other non-compiling template engine)

2007-01-28 Thread Andrei Verovski (aka MacGuru)
Hi !


Anyone knows if there any CMS engine(s) which PHP Savant template engine or 
any similar non-compiling template system ?

Unlike other template systems, Savant by default does not compile your 
templates into PHP; instead, it uses PHP itself as its template language so 
you don't need to learn a new markup system.

Thanks in advance for any suggestion(s)

Andrei

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



Re: [PHP] __construct __destruct in PHP 4

2007-01-28 Thread Larry E. Ullman

I have been trying going thru the PHP manual to find if there are any
equivalent to the __contruct and __destruct in PHP 4, but I cannot  
find any
solution for this part. I know it was introduced in PHP 5, but as  
__sleep
and __wakeup exist in PHP 4 already I was hoping there is something  
like

__init and __die in PHP 4 :-)


In PHP 4 the constructor has the same name as the class (like C++). See
http://us3.php.net/manual/en/language.oop.constructor.php

There is no destructor in PHP 4.

Larry

PS The manual has two sets of OOP documentation: one for PHP 4   
another for PHP 5. Make sure you're viewing the right set.


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



RE: [PHP] __construct __destruct in PHP 4

2007-01-28 Thread Peter Lauri
Hi,

Yes I have been reading both sections and is aware of the different sections
for PHP 4 and 5. I was just hoping there was something missing in the manual
for PHP 4 as I'd love to have a __destruct method to work with. There are
other solutions around this. Basically I just want to make sure that the
objects that have a save() method are saved correctly before they are
destroyed. With PHP 4 I just need to do this manually. I could probably
just write a cleanup function that will be executed in the end of each
scripts that checks if objects have a save() method and then executes that
one. Or better: Check if there is a method __destruct() existing and use
that when cleaning up. Then it would be forward compatible with PHP 5 as
well :)

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: Larry E. Ullman [mailto:[EMAIL PROTECTED] 
Sent: Sunday, January 28, 2007 4:09 PM
To: Peter Lauri
Cc: php-general@lists.php.net
Subject: Re: [PHP] __construct __destruct in PHP 4

 I have been trying going thru the PHP manual to find if there are any
 equivalent to the __contruct and __destruct in PHP 4, but I cannot  
 find any
 solution for this part. I know it was introduced in PHP 5, but as  
 __sleep
 and __wakeup exist in PHP 4 already I was hoping there is something  
 like
 __init and __die in PHP 4 :-)

In PHP 4 the constructor has the same name as the class (like C++). See
http://us3.php.net/manual/en/language.oop.constructor.php

There is no destructor in PHP 4.

Larry

PS The manual has two sets of OOP documentation: one for PHP 4   
another for PHP 5. Make sure you're viewing the right set.

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



Re: [PHP] __construct __destruct in PHP 4

2007-01-28 Thread Jochem Maas
Peter Lauri wrote:
 Hi,
 
 Yes I have been reading both sections and is aware of the different sections
 for PHP 4 and 5. I was just hoping there was something missing in the manual
 for PHP 4 as I'd love to have a __destruct method to work with. There are
 other solutions around this. Basically I just want to make sure that the
 objects that have a save() method are saved correctly before they are
 destroyed. With PHP 4 I just need to do this manually. I could probably
 just write a cleanup function that will be executed in the end of each
 scripts that checks if objects have a save() method and then executes that
 one. Or better: Check if there is a method __destruct() existing and use
 that when cleaning up. Then it would be forward compatible with PHP 5 as
 well :)

alternative:

have each object register itself with a 'stack' and register a shutdown function
which automatically calls the save() method of each object in said stack...
be careful to always using the 'reference' operator.

I wouldn't bother to try and make it php4/php5 compatible - the reference 
operator
of itself will make sure that you have to change the code for php5, besides 
that __destruct()
is not 'meant' to be called by userland code - and as far as I can tell it's
a bit lame (there is no garanteed order of destruction so you can't rely on 
other object still
being around and IIRC [somebody correct me if I'm wrong please] things like DB 
connections
are also gone by the time __destruct() is called - the same goes for access to 
STDIN, STDOUT, etc.

 
 Best regards,
 Peter Lauri
 
 www.dwsasia.com - company web site
 www.lauri.se - personal web site
 www.carbonfree.org.uk - become Carbon Free
 
 
 -Original Message-
 From: Larry E. Ullman [mailto:[EMAIL PROTECTED] 
 Sent: Sunday, January 28, 2007 4:09 PM
 To: Peter Lauri
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] __construct __destruct in PHP 4
 
 I have been trying going thru the PHP manual to find if there are any
 equivalent to the __contruct and __destruct in PHP 4, but I cannot  
 find any
 solution for this part. I know it was introduced in PHP 5, but as  
 __sleep
 and __wakeup exist in PHP 4 already I was hoping there is something  
 like
 __init and __die in PHP 4 :-)
 
 In PHP 4 the constructor has the same name as the class (like C++). See
 http://us3.php.net/manual/en/language.oop.constructor.php
 
 There is no destructor in PHP 4.
 
 Larry
 
 PS The manual has two sets of OOP documentation: one for PHP 4   
 another for PHP 5. Make sure you're viewing the right set.
 

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



RE: [PHP] __construct __destruct in PHP 4

2007-01-28 Thread Peter Lauri
Of course __destruct (in php5) is not meant to be called by userland (as
you called it). I just want to make sure all objects are stored as they
should when a script ends. This kind of wrapper method is of course lame
as you called it, but it would do what I need it to do, thought it is lame
:) This is just to simulate something that is missing in PHP 4 and that I
as a standard am working with. To close down database connections etc are
not the purpose at this stage for me as PHP will take care of these
resources by it self.

Ok, back to Sunday afternoon programming :)

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: Jochem Maas [mailto:[EMAIL PROTECTED] 
Sent: Sunday, January 28, 2007 4:27 PM
To: Peter Lauri
Cc: 'Larry E. Ullman'; php-general@lists.php.net
Subject: Re: [PHP] __construct __destruct in PHP 4

Peter Lauri wrote:
 Hi,
 
 Yes I have been reading both sections and is aware of the different
sections
 for PHP 4 and 5. I was just hoping there was something missing in the
manual
 for PHP 4 as I'd love to have a __destruct method to work with. There are
 other solutions around this. Basically I just want to make sure that the
 objects that have a save() method are saved correctly before they are
 destroyed. With PHP 4 I just need to do this manually. I could probably
 just write a cleanup function that will be executed in the end of each
 scripts that checks if objects have a save() method and then executes that
 one. Or better: Check if there is a method __destruct() existing and use
 that when cleaning up. Then it would be forward compatible with PHP 5 as
 well :)

alternative:

have each object register itself with a 'stack' and register a shutdown
function
which automatically calls the save() method of each object in said stack...
be careful to always using the 'reference' operator.

I wouldn't bother to try and make it php4/php5 compatible - the reference
operator
of itself will make sure that you have to change the code for php5, besides
that __destruct()
is not 'meant' to be called by userland code - and as far as I can tell it's
a bit lame (there is no garanteed order of destruction so you can't rely on
other object still
being around and IIRC [somebody correct me if I'm wrong please] things like
DB connections
are also gone by the time __destruct() is called - the same goes for access
to STDIN, STDOUT, etc.

 
 Best regards,
 Peter Lauri
 
 www.dwsasia.com - company web site
 www.lauri.se - personal web site
 www.carbonfree.org.uk - become Carbon Free
 
 
 -Original Message-
 From: Larry E. Ullman [mailto:[EMAIL PROTECTED] 
 Sent: Sunday, January 28, 2007 4:09 PM
 To: Peter Lauri
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] __construct __destruct in PHP 4
 
 I have been trying going thru the PHP manual to find if there are any
 equivalent to the __contruct and __destruct in PHP 4, but I cannot  
 find any
 solution for this part. I know it was introduced in PHP 5, but as  
 __sleep
 and __wakeup exist in PHP 4 already I was hoping there is something  
 like
 __init and __die in PHP 4 :-)
 
 In PHP 4 the constructor has the same name as the class (like C++). See
 http://us3.php.net/manual/en/language.oop.constructor.php
 
 There is no destructor in PHP 4.
 
 Larry
 
 PS The manual has two sets of OOP documentation: one for PHP 4   
 another for PHP 5. Make sure you're viewing the right set.
 

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



Re: [PHP] DATE

2007-01-28 Thread David Giragosian


Ron Piggott wrote:
 I have date in the variable $date_reference in the format -MM-DD.
 How do I find out the date before this and the date after this?  Ron




Not enough information, Ron. Do you mean: 1. as exists in some data set that
you've created or stored, like in an array or a database; 2. in a general
sense, like a millisecond before and after, as in some increment/decrement
of linear time; 3. some other conceptual understanding of time, before and
after?

David


Re: [PHP] DATE

2007-01-28 Thread Ron Piggott

Someone sent me the strtotime function.  This was the command I was
needing.  Ron

On Sun, 2007-01-28 at 08:57 -0600, David Giragosian wrote:
 Ron Piggott wrote:
  I have date in the variable $date_reference in the format
 -MM-DD.
  How do I find out the date before this and the date after
 this?  Ron 
 
  
 Not enough information, Ron. Do you mean: 1. as exists in some data
 set that you've created or stored, like in an array or a database; 2.
 in a general sense, like a millisecond before and after, as in some
 increment/decrement of linear time; 3. some other conceptual
 understanding of time, before and after?
  
 David 
 
  

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



Re: [PHP] SQL Readability.. (was Re: most powerful php editor)

2007-01-28 Thread Larry Garfield
On Sunday 28 January 2007 5:55 am, Jochem Maas wrote:

  And yes, I agree that MySQL has fairly decent date manipulation routines.
   But at work we do try for database independence when possible, so except
  on specific projects we try to avoid it.

 again we differ :-) I have never bought the 'data independence' story - in
 practice it's of little value imho most of the time (granted certain
 products do benefit - but what I build doesn't fall into that category) and
 I find it crazy to end up with a situation where the most advanced peice of
 data manipulation software in a given stack is dumbed down to the lowest
 common denominator [of DB engines]. On more complex project I try to cram
 as much of the data intregity and business logic in to the database itself
 (for which I use firebird mostly) because it means being able to create
 different clients to the data without replicating [as much] business logic
 (e.g. website and desktop app). besides which the required stored
 procedures and triggers are usually hundreds of lines less than their php
 equivalent AND more importantly they are intrinsically atomic (in the sense
 that database transaction 'should' be).

 rgds :-)

Well, business reasons dictate that we keep our code portable when possible at 
work.  I'm not the business person.  I just write the code. :-)

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

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



[PHP] Select record by ID

2007-01-28 Thread nitrox .
Before I ask my next question I just wanted to thank you all for being in 
this mailing community and sharing your knowledge. Its communitys like this 
that make life easier for all of us. Ok enough with the mushy stuff


Im trying to display one record at a time by ID. Well im getting a blank 
page. Ive looked over my code and tried 20 different ways to get it to work 
to no avail. So any pointers on what Im doing wrong would be great. here is 
the code im working with so far.


?php
include(db.php);

   $result = mysql_query(SELECT * FROM inf_member WHERE 
user_id='$user_id' );

   while($myrow = mysql_fetch_assoc($result))
 {
echo b;
echo $myrow['user_name'];
echo /b;
echo $myrow['rank'];
 echo /b;
echo $myrow['country'];
 echo /b;
echo $myrow['email'];
echo /b;
echo $myrow['quote'];
echo /b;
echo $myrow['config'];
 echo /b;
 echo $myrow['map'];
echo /b;
echo $myrow['gun'];
echo /b;
echo $myrow['brand'];
 echo /b;
 echo $myrow['cpu'];
 echo /b;
echo $myrow['ram'];
echo /b;
echo $myrow['video'];
echo /b;
echo $myrow['sound'];
 echo /b;
 echo $myrow['monitor'];
echo /b;
echo $myrow['mouse'];
echo /b;
echo $myrow['brand'];
 echo /b;

}
?

_
FREE online classifieds from Windows Live Expo – buy and sell with people 
you know 
http://clk.atdmt.com/MSN/go/msnnkwex001001msn/direct/01/?href=http://expo.live.com?s_cid=Hotmail_tagline_12/06


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



Re: [PHP] Select record by ID

2007-01-28 Thread Francisco M. Marzoa Alonso
The first thing that I probably do is to check for possible errors from
DB:

$result = mysql_query(SELECT * FROM inf_member WHERE
user_id='$user_id' );
if ( ! $result ) {
die (Could not perform query $query: .mysql_error().\n);
}

Regards,


On dom, 2007-01-28 at 18:21 -0500, nitrox . wrote:
 Before I ask my next question I just wanted to thank you all for being in 
 this mailing community and sharing your knowledge. Its communitys like this 
 that make life easier for all of us. Ok enough with the mushy stuff
 
 Im trying to display one record at a time by ID. Well im getting a blank 
 page. Ive looked over my code and tried 20 different ways to get it to work 
 to no avail. So any pointers on what Im doing wrong would be great. here is 
 the code im working with so far.
 
 ?php
 include(db.php);
 
 $result = mysql_query(SELECT * FROM inf_member WHERE 
 user_id='$user_id' );
 while($myrow = mysql_fetch_assoc($result))
   {
  echo b;
  echo $myrow['user_name'];
  echo /b;
  echo $myrow['rank'];
echo /b;
  echo $myrow['country'];
echo /b;
  echo $myrow['email'];
  echo /b;
  echo $myrow['quote'];
  echo /b;
  echo $myrow['config'];
echo /b;
echo $myrow['map'];
  echo /b;
  echo $myrow['gun'];
  echo /b;
  echo $myrow['brand'];
echo /b;
echo $myrow['cpu'];
echo /b;
  echo $myrow['ram'];
  echo /b;
  echo $myrow['video'];
  echo /b;
  echo $myrow['sound'];
echo /b;
echo $myrow['monitor'];
  echo /b;
  echo $myrow['mouse'];
  echo /b;
  echo $myrow['brand'];
echo /b;
 
  }
 ?
 
 _
 FREE online classifieds from Windows Live Expo – buy and sell with people 
 you know 
 http://clk.atdmt.com/MSN/go/msnnkwex001001msn/direct/01/?href=http://expo.live.com?s_cid=Hotmail_tagline_12/06
 


signature.asc
Description: This is a digitally signed message part


Re: [PHP] Select record by ID

2007-01-28 Thread nitrox .
I took the quotes off. I thought that quotes around numbers was wrong also. 
I added the error checking and this is the error:


Could not perform query : You have an error in your SQL syntax; check the 
manual that corresponds to your MySQL server version for the right syntax to 
use near '' at line 1


and this is the code again:

?php
include(db.php);
   $result = mysql_query(SELECT * FROM inf_member WHERE 
user_id=$user_id);

   if ( ! $result ) {
die (Could not perform query $query: .mysql_error().\n);
}

while($myrow = mysql_fetch_assoc($result))
 {
echo b;
echo $myrow['user_name'];
echo /b;
echo $myrow['rank'];
 echo /b;
echo $myrow['country'];
 echo /b;
echo $myrow['email'];
echo /b;
echo $myrow['quote'];
echo /b;
echo $myrow['config'];
 echo /b;
 echo $myrow['map'];
echo /b;
echo $myrow['gun'];
echo /b;
echo $myrow['brand'];
 echo /b;
 echo $myrow['cpu'];
 echo /b;
echo $myrow['ram'];
echo /b;
echo $myrow['video'];
echo /b;
echo $myrow['sound'];
 echo /b;
 echo $myrow['monitor'];
echo /b;
echo $myrow['mouse'];
echo /b;
echo $myrow['brand'];
 echo /b;

}
?

_
Laugh, share and connect with Windows Live Messenger 
http://clk.atdmt.com/MSN/go/msnnkwme002001msn/direct/01/?href=http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-ussource=hmtagline


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



Re: [PHP] Select record by ID

2007-01-28 Thread Francisco M. Marzoa Alonso
Ops!, Better this one:

$query = SELECT inf_member WHERE user_id='$user_id' ;
$result = mysql_query($query);
if ( ! $result ) {
die (Could not perform query $query: .mysql_error().\n);
}

I did copy and paste from my own code and you've not $query defined on
your one. I prefer to store first the query on a string to show it
complete if there's an error late, because it may show also the point.



On lun, 2007-01-29 at 00:39 +0100, Francisco M. Marzoa Alonso wrote:
 The first thing that I probably do is to check for possible errors from
 DB:
 
 $result = mysql_query(SELECT  inf_member WHERE
 user_id='$user_id' );
   if ( ! $result ) {
   die (Could not perform query $query: .mysql_error().\n);
   }
 
 Regards,
 
 
 On dom, 2007-01-28 at 18:21 -0500, nitrox . wrote:
  Before I ask my next question I just wanted to thank you all for being in 
  this mailing community and sharing your knowledge. Its communitys like this 
  that make life easier for all of us. Ok enough with the mushy stuff
  
  Im trying to display one record at a time by ID. Well im getting a blank 
  page. Ive looked over my code and tried 20 different ways to get it to work 
  to no avail. So any pointers on what Im doing wrong would be great. here is 
  the code im working with so far.
  
  ?php
  include(db.php);
  
  $result = mysql_query(SELECT * FROM inf_member WHERE 
  user_id='$user_id' );
  while($myrow = mysql_fetch_assoc($result))
{
   echo b;
   echo $myrow['user_name'];
   echo /b;
   echo $myrow['rank'];
   echo /b;
   echo $myrow['country'];
   echo /b;
   echo $myrow['email'];
   echo /b;
   echo $myrow['quote'];
   echo /b;
   echo $myrow['config'];
   echo /b;
   echo $myrow['map'];
   echo /b;
   echo $myrow['gun'];
   echo /b;
   echo $myrow['brand'];
   echo /b;
   echo $myrow['cpu'];
   echo /b;
   echo $myrow['ram'];
   echo /b;
   echo $myrow['video'];
   echo /b;
   echo $myrow['sound'];
   echo /b;
   echo $myrow['monitor'];
   echo /b;
   echo $myrow['mouse'];
   echo /b;
   echo $myrow['brand'];
   echo /b;
  
   }
  ?
  
  _
  FREE online classifieds from Windows Live Expo – buy and sell with people 
  you know 
  http://clk.atdmt.com/MSN/go/msnnkwex001001msn/direct/01/?href=http://expo.live.com?s_cid=Hotmail_tagline_12/06
  


signature.asc
Description: This is a digitally signed message part


Re: [PHP] Select record by ID

2007-01-28 Thread Paul Novitski

At 1/28/2007 03:21 PM, nitrox . wrote:
Im trying to display one record at a time by ID. Well im getting a 
blank page. Ive looked over my code and tried 20 different ways to 
get it to work to no avail. So any pointers on what Im doing wrong 
would be great. here is the code im working with so far.


?php
include(db.php);

   $result = mysql_query(SELECT * FROM inf_member WHERE 
user_id='$user_id' );

   while($myrow = mysql_fetch_assoc($result))
 {
echo b;
echo $myrow['user_name'];

...

My off-hand guess is that your user_id might be a numeric value 
(auto-increment?) and that putting it in quotes makes for an invalid query.


What is the value of $result?  If $result === false then display 
mysql_error() to diagnose the problem.


Regards,

Paul
__

Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] Select record by ID

2007-01-28 Thread Francisco M. Marzoa Alonso
On dom, 2007-01-28 at 18:51 -0500, nitrox . wrote:
 I took the quotes off. I thought that quotes around numbers was wrong also. 

Quotes are no necessary around numeric values, but they aren't wrong
neither, simply optional.

 I added the error checking and this is the error:
 
 Could not perform query : You have an error in your SQL syntax; check the 
 manual that corresponds to your MySQL server version for the right syntax to 
 use near '' at line 1

Try with the new code I sent you too see the query you're sending,
probably -but not sure- $user_id is void and you're doing:

SELECT * FROM inf_member WHERE user_id=

Anyway if you can see the query, you'll see the source of the error.

 
 and this is the code again:
 
 ?php
 include(db.php);
 $result = mysql_query(SELECT * FROM inf_member WHERE 
 user_id=$user_id);
 if ( ! $result ) {
   die (Could not perform query $query: .mysql_error().\n);
   }
 
   while($myrow = mysql_fetch_assoc($result))
   {
  echo b;
  echo $myrow['user_name'];
  echo /b;
  echo $myrow['rank'];
echo /b;
  echo $myrow['country'];
echo /b;
  echo $myrow['email'];
  echo /b;
  echo $myrow['quote'];
  echo /b;
  echo $myrow['config'];
echo /b;
echo $myrow['map'];
  echo /b;
  echo $myrow['gun'];
  echo /b;
  echo $myrow['brand'];
echo /b;
echo $myrow['cpu'];
echo /b;
  echo $myrow['ram'];
  echo /b;
  echo $myrow['video'];
  echo /b;
  echo $myrow['sound'];
echo /b;
echo $myrow['monitor'];
  echo /b;
  echo $myrow['mouse'];
  echo /b;
  echo $myrow['brand'];
echo /b;
 
  }
 ?
 
 _
 Laugh, share and connect with Windows Live Messenger 
 http://clk.atdmt.com/MSN/go/msnnkwme002001msn/direct/01/?href=http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-ussource=hmtagline
 


signature.asc
Description: This is a digitally signed message part


Re: [PHP] Select record by ID

2007-01-28 Thread Larry Garfield
On Sunday 28 January 2007 5:54 pm, Francisco M. Marzoa Alonso wrote:
 On dom, 2007-01-28 at 18:51 -0500, nitrox . wrote:
  I took the quotes off. I thought that quotes around numbers was wrong
  also.

 Quotes are no necessary around numeric values, but they aren't wrong
 neither, simply optional.

Actually, I believe they are wrong in some database engines but not others.  
MySQL doesn't care.  Some others do.  Yes, it sucks. :-(

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

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



[PHP] Fwd: Entries no longer appear in search

2007-01-28 Thread Kevin Jordan

This was originally sent to the OpenLDAP list, but it was rejected
because I mentioned PHP and phpLDAPadmin and said I should send it to
the appropriate lists there.

-- Forwarded message --
From: Kevin Jordan [EMAIL PROTECTED]
Date: Jan 27, 2007 4:24 PM
Subject: Entries no longer appear in search
To: openldap-software@openldap.org


I'm having the random problem of an OpenLDAPperson entry just no
longer showing up in the search results, causing havoc on my logins.
I used phpLDAPadmin to administer LDAP and I also use PHP wrappers
(they store all the information and then use the ldap functions to
modify the entry) to change information on my pages.  A simple move
and then move back seems to work to fix it, so they aren't completely
gone, but they just don't show up in the search.  Has anyone else
experienced this problem?

--
Kevin Jordan


--
Kevin Jordan

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



Re: [PHP] Sporadic MSSQL connection error

2007-01-28 Thread Chris

[EMAIL PROTECTED] wrote:

Hi

I'm having a sporadic connection problem with MSSQL. I have a php script which 
is called by a folder scanning application and sometimes it can run for hours 
without problem but other times it will run for just a few minutes and return 
connection errors. I tried using mssql_get_last_message but it always seems to 
return an empty string.

I'd like to find out why the connection is failing but in the absense of error 
info from MSSQL, it's a bit problematic. Is there a creative way to actually 
get error strings back from MSSQL in light of the fact that 
mssql_get_last_message basically does squat?

As a last ditch effort, I could run the connect line in a loop a set number of 
times until it succeeds but I would prefer to know why it fails.


Anything show up on the other end - ie mssql logs ?

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Select record by ID

2007-01-28 Thread Francisco M. Marzoa Alonso
On dom, 2007-01-28 at 18:20 -0600, Larry Garfield wrote:
 On Sunday 28 January 2007 5:54 pm, Francisco M. Marzoa Alonso wrote:
  On dom, 2007-01-28 at 18:51 -0500, nitrox . wrote:
   I took the quotes off. I thought that quotes around numbers was wrong
   also.
 
  Quotes are no necessary around numeric values, but they aren't wrong
  neither, simply optional.
 
 Actually, I believe they are wrong in some database engines but not others.  
 MySQL doesn't care.  Some others do.  Yes, it sucks. :-(

Good point, but he's using mysql in this case, and in mysql they're
simply optional but not wrong.

Regards,



signature.asc
Description: This is a digitally signed message part


Re: [PHP] Select record by ID

2007-01-28 Thread Craige Leeder

As someone else already stated, my best guess according to that error
is that $user_id has a null, or inappropriate value. The error occurs
at the last character of the query, so it has to be something like
hat. Echo the query and let us know what it outputs.

- Craige

On 1/28/07, Francisco M. Marzoa Alonso [EMAIL PROTECTED] wrote:

On dom, 2007-01-28 at 18:20 -0600, Larry Garfield wrote:
 On Sunday 28 January 2007 5:54 pm, Francisco M. Marzoa Alonso wrote:
  On dom, 2007-01-28 at 18:51 -0500, nitrox . wrote:
   I took the quotes off. I thought that quotes around numbers was wrong
   also.
 
  Quotes are no necessary around numeric values, but they aren't wrong
  neither, simply optional.

 Actually, I believe they are wrong in some database engines but not others.
 MySQL doesn't care.  Some others do.  Yes, it sucks. :-(

Good point, but he's using mysql in this case, and in mysql they're
simply optional but not wrong.

Regards,






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



[PHP] XSLTProcessor-transformToURI() error handling

2007-01-28 Thread Jason Karns
If there is a failure in 'XSLTProcessor-transformToURI()' (it returns
false) is nothing written to the file specified? I ask because I'm
implementing a caching system. I'm having the output written to a cache file
and want to be guaranteed that in case of error, the specified file remains
as it was before the operation. In other words, I'd like the destination
file to be written to IF and ONLY IF the transformation is successful.  Is
this the case?

Jason Karns
~~~
The Ohio State University [www.osu.edu]
Computer Science  Engineering [www.cse.osu.edu]

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



[PHP] HTTPS

2007-01-28 Thread chetan rane

hi everyone

i am writing a progrram for a Jabber COnnection manager. I want to access
the client XML using HTTPS. do any one know a way to so it


Have any one the

--
Have A plesant Day
Chetan. D. Rane
Location: Pune , India
Contact: +91-9890792762
otherID: [EMAIL PROTECTED]
[EMAIL PROTECTED]


RE: [PHP] HTTPS

2007-01-28 Thread Peter Lauri
http://php.net/curl

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: chetan rane [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 29, 2007 8:31 AM
To: php-general@lists.php.net
Subject: [PHP] HTTPS

hi everyone

i am writing a progrram for a Jabber COnnection manager. I want to access
the client XML using HTTPS. do any one know a way to so it


Have any one the

-- 
Have A plesant Day
Chetan. D. Rane
Location: Pune , India
Contact: +91-9890792762
otherID: [EMAIL PROTECTED]
 [EMAIL PROTECTED]

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