我正在使用cakephp 2.6.7。我有一个名为'客户'电子邮件是'没有'作为表结构的默认值。我重复它默认不是NULL。因此,当电子邮件字段为空时,此字段不会设置为空。在这种情况下,如何检索非空的所有数据。我试过这个:
$customers = $this->Customer->find('list',
array('fields' => array('email'),
'conditions' => array('event_id' => $this->request->data['Product']['event_id'],
'not' => array('Customer.email' => null)
)
)
);
print_r($customers);
给出以下结果:
Array
(
[103] => shuvo2782@gmail.com
[104] => tanjimtasfia95@gmail.com
[105] => tsiddique10@gmail.com
[106] => mahrana78@gmail.com
[107] => snehomay@yahoo.com
[108] => raifurrhaim95@gmail.com
[109] => billahm9@gmail.com
[110] => rahamanraju27@gmail.com
[111] => shaiful019@gmail.com
[112] => tawhid.cse@gmail.com
[113] => minhaazulislaam@gmail.com
[114] => helalkhan32@gmail.com
[115] => mshuvo080@gmail.com
[116] => jahidiu@gmail.com
[117] => rezahimel@gmail.com
[118] => soniagazi123@yahoo.com
[119] => MDRAFIQUEL.ISLAM457@GMAIL.COM
[120] => khan7733305@gmail.com
[121] => khrimel@yahoo.com
[122] => Kawserrabbi3@gmail.com
[123] => mr.samirulhaque@gmail.com
[124] => tithydac@yahoo.com
[125] => iftefci@yahoo.com
[126] => nipabangla@gmail.com
[127] => asheke.elahi15@gmail.com
[128] => enam_moni@yahoo.com
[129] => tipshridoy@gmail.com
[130] => easirarafat95@yahoo.com
[131] => munem.sohan@yahoo.com
[132] => mdmamunkobi9@gmail.com
[133] => zarinnpn@gmail.com
[134] => antohin.munna@gmail.com
[135] => isratpriyanka36@gmail.com
[136] => lipa.bhuiyan@yahoo.com
[137] => ra.latifa94@gmail.com
[138] => rif007at@gmail.com
[139] => jayadnur@gmail.com
[140] => gopalthmdu09@gmail.com
[141] => mehedidon007@gmail.com
[142] => ahmd.shuhan@gmail.com
[143] => md.jami.94@gmail.com
[144] => prokash811@gmail.com
[145] => yiran786@gmail.com
[146] => akashecejkkniu@gmail.com
[147] => aktermowsumi@gmail.com
[148] => rhythm55@live.com
[149] => msisohan@yahoo.com
[150] => lizan1915@yahoo.com
[151] => mfrjnp@gmail.com
[152] => mithun.r0503@gmail.com
[153] => estiaqhasanthe@gmail.com
[154] => Mohinuddin817@gmail.com
[155] => meghlashokal25@gmail.com
[156] => mithun.r0503@hotmail.com
[157] => Sudipto004.ruet@gmail.Com
[158] => tetys.sourov@gmail.com
[159] => arefindipu464@gmail.com
[160] => zahirulislam425@gmail.com
[161] => ibrahimshaikhibu@gmail.com
[162] => www.zeromsi2@gmail.com
[163] => sabuj26@gmail.com
[164] => prince.munem.maruf@gmail.com
[165] => crossbonesdipu@gmail.com
[166] => iconfaysal2013@gmail.com
[167] => mosharof34@diit.info
[168] => drnira007@ymail.com
[169] => yeasinmina90@gmail.com
[170] => masudurism@gmail.com
[171] => shafiqklislamdch@gmail.com
[172] => wdxshohag@gmail.com
[173] => mostafij.hemal@gmail.com
[174] => miron.miron15@gmail.com
[175] => tanvir.hossain53@gmail.com
[176] => razuahammad@outlook.com
[177] => mohsin.akanda@gmail.com
[178] => iraz12729@gmail.com
[179] => mostainbillah96@gmail.com
[180] => munnarahman1994@gmail.com
[181] => olosut@yahoo.com
[182] => tope_olosu@yahoo.com
[183] => hamimulislam@gmail.com
[184] => Lipikhatun446@gmail.com
[185] => cse0607007@gmail.com
[186] => saim.shohag@gmail.com
[187] => rubiatrafi@gmail.com
[188] => jonalex628@gmail.com
[189] => mirashikul.haque14@gmail.com
[190] => rizvyr@gmail.com
[191] => mafuz619 Gmail . com
[192] => jahedul005@gmail.com
[193] => masuq2014@gmail.com
[194] => amrobi15@yahoo.com
[195] => asma@systechunimax.com
[196] => farzanaislam12@gmail.com
[197] =>
[198] =>
[199] =>
[200] =>
[201] =>
[202] =>
[203] =>
[204] =>
[205] =>
[206] =>
[207] =>
[208] =>
[209] =>
[210] =>
[211] =>
[212] =>
[213] =>
[214] =>
[215] =>
[216] =>
[217] =>
[218] =>
[219] =>
[220] =>
)
合乎逻辑的是,当没有提供电子邮件的值时,电子邮件字段不为空,但我试图过滤此空值,告知为NOT NULL。有什么方法可以解决这个问题吗?
答案 0 :(得分:4)
请添加条件
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:descendantFocusability="blocksDescendants">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="12dp"
android:paddingLeft="10dp">
<ImageView
android:layout_width="46dp"
android:layout_height="35.3dp"
android:textColor="#000000"
android:id="@+id/payment_item_name2"
android:layout_gravity="center_horizontal|start"
android:src="@drawable/payments_internet"
android:textSize="20sp"
android:text="Test"
android:textStyle="bold"
android:capitalize="words" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#8c8c8c"
android:id="@+id/payment_item_name"
android:layout_gravity="center_horizontal|center"
android:textSize="20sp"
android:layout_marginLeft="10dp"
android:text="Test"
android:textStyle="bold"
android:capitalize="words" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:layout_marginTop="12dp"
android:paddingRight="10dp">
<ImageView
android:layout_width="15.3dp"
android:layout_height="20.1dp"
android:src="@drawable/arrow_right_red"
android:layout_gravity="center_vertical|right"
android:id="@+id/backButton"
android:textAllCaps = "true"
/>
</LinearLayout>