php-general Digest 29 Jan 2007 00:19:29 -0000 Issue 4595

Topics (messages 247907 through 247923):

Re: SQL Readability..  (was Re: most powerful php editor)
        247907 by: Satyam
        247916 by: Larry Garfield

__construct __destruct in PHP 4
        247908 by: Peter Lauri
        247910 by: Larry E. Ullman
        247911 by: Peter Lauri
        247912 by: Jochem Maas
        247913 by: Peter Lauri

CMS Engine(s) with Savant (or other non-compiling template engine)
        247909 by: Andrei Verovski (aka MacGuru)

Re: DATE
        247914 by: David Giragosian
        247915 by: Ron Piggott

Select record by ID
        247917 by: nitrox .
        247918 by: Francisco M. Marzoa Alonso
        247919 by: nitrox .
        247920 by: Francisco M. Marzoa Alonso
        247921 by: Paul Novitski
        247922 by: Francisco M. Marzoa Alonso
        247923 by: Larry Garfield

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---

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


--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
Hi,

 

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

 

Best regards,

Peter Lauri

 

 <http://www.dwsasia.com/> www.dwsasia.com - company web site

 <http://www.lauri.se/> www.lauri.se - personal web site

 <http://www.carbonfree.org.uk/> www.carbonfree.org.uk - become Carbon Free

 


--- End Message ---
--- Begin Message ---
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.
--- End Message ---
--- Begin Message ---
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.

--- End Message ---
--- Begin Message ---
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.
> 

--- End Message ---
--- Begin Message ---
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.
> 

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---

Ron Piggott wrote:
> I have date in the variable $date_reference in the format YYYY-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

--- End Message ---
--- Begin Message ---
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
>         YYYY-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 
> 
>  

--- End Message ---
--- Begin Message --- 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/msnnkwex0010000001msn/direct/01/?href=http://expo.live.com?s_cid=Hotmail_tagline_12/06
--- End Message ---
--- Begin Message ---
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/msnnkwex0010000001msn/direct/01/?href=http://expo.live.com?s_cid=Hotmail_tagline_12/06
> 

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


--- End Message ---
--- Begin Message --- 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/msnnkwme0020000001msn/direct/01/?href=http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=hmtagline
--- End Message ---
--- Begin Message ---
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/msnnkwex0010000001msn/direct/01/?href=http://expo.live.com?s_cid=Hotmail_tagline_12/06
> > 

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


--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
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/msnnkwme0020000001msn/direct/01/?href=http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=hmtagline
> 

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


--- End Message ---
--- Begin Message ---
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

--- End Message ---

Reply via email to