从arry中选择? [英] SELECT'ing from an arry?
问题描述
$ 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''");
在list.txt中它会有数据如:
代码:
一个
两个
三个
和echo $ list [0];将出现为一。
我需要选择名称一。并返回列数据。
它没有选择任何东西,即使它确实正确地获取数据
当echo''d。怎么了?
或者我错了吗? :x
$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
推荐答案
lines = file(" list.txt");
lines = file("list.txt");
>
l_count = count(
l_count = count(
lines);
for(
lines);
for(
这篇关于从arry中选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!