Re: SELECT'ing from an arry?



The Natural Philosopher wrote:
Austin wrote:
On Nov 6, 7:15 pm, The Natural Philosopher <a...@xxx> wrote:
Austin wrote:
$lines = file("list.txt");
$l_count = count($lines);
for($i = 0; $i < 3; $i++) {
$var = $lines[$i];
}
mysql_query("SELECT name FROM list WHERE name='$var'");
In the list.txt it would have data like:
Code:
One
Two
Three
And "echo $list[0];" would come up as "one".
I need to SELECT the name "one" and return the column data.
It doesn't select anything, even though it does get the data correctly
when echo'd. What's wrong?
OR am I going the wrong way w/ this? :x
I am completely baffled. What makes you think that Mysql has anything to
do with a file called 'list.txt'?

Well if you flatfile something then sure it does...
Now ignore the irrelevant and input something useful.

I wansn't aware that Mysql dealt with flat files.

I cant see the point of using it with a flat file that has already been opened another way..

I didnt think a mysql query worked without opening a connection to a database.

Now, what am I missing here?


You're missing the fact he only showed maybe 2% of his code, and that he's querying a MySQL database for rows that match the contents of the flat file.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================

.



Relevant Pages

  • Re: SELECTing from an arry?
    ... I wansn't aware that Mysql dealt with flat files. ... You're missing the fact he only showed maybe 2% of his code, and that he's querying a MySQL database for rows that match the contents of the flat file. ...
    (comp.lang.php)
  • Re: SELECTing from an arry?
    ... I wansn't aware that Mysql dealt with flat files. ... You're missing the fact he only showed maybe 2% of his code, and that he's querying a MySQL database for rows that match the contents of the flat file. ...
    (comp.lang.php)
  • Re: Fetch 6 records from a table randomly
    ... critical details (e.g. what sort of table? ... "I have a table 'documents' stored in a MySQL database that I'm accessing ... I haven't been able to find a function in Ruby to pick a random element. ...
    (comp.lang.ruby)
  • Re: sarge + postfix + mysql
    ... >So when postfix/courier is doing a mysql database lookup, ... >'vmail' that is only allowed to log in from localhost and has no ... >permissions for accessing the database 'provider'. ...
    (Debian-User)
  • Re: Insert multiple rows with a single statement
    ... don't look any further, and stick to MySQL. ... BULK INSERT ... I've given you methods, so has Sybrand Bakker, had you paid ... Bulk loads data from a flat file. ...
    (comp.databases.oracle.misc)