Re: Re: Database Problems

"Jim Giner" <[email protected]>
Newsgroups gmane.comp.php.database
Message-ID <[email protected]>
"Matijn Woudt" <[email protected]> wrote in message 
news:CAC_gtuP8FJUV7Jyut89W2491nM-7ZnO8MrJ3w0MEp6totM2G4g@mail.gmail.com...
On Sun, Jun 17, 2012 at 10:21 PM, Jim Giner
<[email protected]> wrote:
>
> "Ethan Rosenberg" <[email protected]> wrote in message
> news:[email protected]...
>> At 03:30 PM 6/17/2012, Jim Giner wrote:
>>>"Ethan Rosenberg" <[email protected]> wrote in message
>>>news:[email protected]...
>>> > Dear List -
>>> >
>>>
>>> >
>>> > The same query in a PHP program will only give me results for MedRec
>>> > 10003
>>> >
>>>
>>>why the "where 1" clause? Do you know what that is for?
>> =================
>> Dear Jim
>>
>> Thanks
>>
>> As I understand, to enable me to concatenate phases to construct a query.
>>
>> The query does work in MySQL fro the terminal.
>>
>> Ethan
>>
>
> I don't think so. All it does is return one record. The where clause
> defines what you want returned. A '1' returns one record, the first one.
> #10003
>
> I wonder why you think "where 1" enables concatenation?? A query (IN 
> SIMPLE
> TERMS PEOPLE) is simply a SELECT ion of fields from a group of tables,with 
> a
> WHERE clause to define the criteria to limit the rows, and an ORDER BY to
> sort the result set. More complex queries can include GROUP BY when you 
> are
> including summary operators such as SUM(fldname) or MAX(fldname), or a 
> JOIN
> clause, or a host of other clauses that make sql so powerful. In your case
> I think you copied a sample query that (they always seem to be displayed
> with a 'where 1' clause) and left the "1" on it. To summarzie:
>
> SELECT a.fld1, a.fld2,b.fld1 from table1 as a, table2 as b WHERE a.key 
>  >100
> and a.key = b.key ORDER BY a.fld1
>
> I"m no expert, but hopefully this makes it a little less complex for you.
>

Right, Why would WHERE 1 return only 1 record? That makes no sense
and, no offense, it sounds like you really don't know where you're
talking about.

WHERE 1 is just a useless statement, but in his case makes it easier
to concatenate multiple "AND ..." statements.

As to the original problem, I guess that there might be something
wrong with your code later on that parses the result? Did you try to
use echo mysqli_num_rows($result1), just after the query to see how
many rows it returned?

- Matijn

You could be right.  My interpretation of  "where 1" is it returns one 
record.  And as I said I'm no expert.  I guess where 1 could mean "where 
true". 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.