从arry中选择? [英] SELECT'ing from an arry?

查看:114
本文介绍了从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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆