----- Original Message -----
From: "Tom Lobato" <tomlobato@stripped>
Sent: Saturday, April 22, 2006 4:18 PM
Subject: Re: WHERE doesn'r works
> From: "Rhino" <rhino1@stripped>
>> Most of the time, when I see a column named 'id', it is defined as an
>> integer. If _your_ 'id' column is defined as an integer, then the reason
>> your WHERE clause is failing is very simple: Your WHERE clause is looking
>> for all the rows where the 'id' value is a character-string containing
>> '5', not the integer value 5. In other words, remove the apostrophes on
>> either side of the 5 in the WHERE clause so that it says:
>> WHERE id = 5
>> WHERE id = '5'
> I tried this, but didn't work yet. I tried double, simple and no
> same problem: WHERE only works when executed directly in the mysql client,
> no from mysql api of the php.
> See the table creation:
> CREATE TABLE `clientes` (
> `id` int(5) NOT NULL auto_increment,
> `tipo` char(1) default NULL,
> `razao_social` varchar(30) default NULL,
Since your table definition says that 'id' is definitely an int,
WHERE id = 5
_should_ work. But obviously, it doesn't.
I'm not sure what to try next. It's possible that php is messing you up
somehow but I don't know how to be sure; I don't know php so I don't know
the problems that you can encounter with it.
There is one thing slightly odd about your table definition: you have
defined 'id' as int(5). Normally, I define a column like 'id' as int, not
int(5). According to the manual, it is okay for you to have int(5) but I
wonder if your problem is caused by the int(5)? Perhaps you could try
changing the column definition from int(5) to int and see if the php code
works after that? It shouldn't make any difference but you never know:
perhaps this will solve the problem.
If that doesn't work, you could try searching for bug reports involving int
(or int(5)) columns; perhaps this is a known bug?
If you don't find anything in the bug reports, perhaps you are the first to
find this problem; in that case, you could create a new bug report. Maybe
someone will be able to suggest a workaround.
I'd be surprised if this is a bug though; it seems like very basic
functionality that should have been debugged a long time ago.
>> and your WHERE clause will probably start working just fine.
>> If your 'id' column is defined as a CHAR, VARCHAR or similar data type,
>> then the apostrophes around the 5 are fine and there is some other
>>> The php and db structure and data are attacheds.
>> I don't see them in my copy of the email....
> Also, you can see the codes in...
> (thanks to GESHI project, http://qbnz.com/highlighter/index.php =)
>>> Two infos: 1) Im not a
>>> expert 2) The code is in the beggining of the development, so are too
>>> uglyness yet =)
>> Also, just a small note about English grammar since English doesn't
>> to be your first language: contractions like 'didnt' and 'dont' should
>> _always_ be spelled with apostrophes. In other words: use don't, not
>> use didn't, not didnt.
>> Unfortunately, even some people who know only English are starting to
>> spell contractions without the apostrophes but this is always wrong and
>> makes the writer look illiterate. Obviously, we make allowances for those
>> who are relatively new to English but I wanted you to know the right way
>> to handle contractions. I assume you want to write English as well as you
>> can so please don't copy the bad habits of English-speakers who don't
>> enough education or self-respect to spell their own language correctly.
> So I will have begin to pay the list =) Beyond mysql I learn English
> Well, thank you by the hint, I'll stay alive about this.
No charge for the English pointers :-) I just want you to know the correct
way to write things. I hope you'd do the same for me if I was trying to
write Portuguese and made a consistent mistake :-)
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.4.5/321 - Release Date: 21/04/2006