将两个值与CodeIgniter中的空格进行比较

时间:2017-10-04 07:08:58

标签: php mysql codeigniter mysqli

我有两个表,我想比较模型中的值,一个来自product_category表,另一个来自产品表。

enter image description here

enter image description here

public function selectcategory($cat)  
{  
    $this->db->where('product_cat',$cat);
    $query = $this->db->get('product_category');  
    return $query;  
}   

$cat="Health Care";  

健康%20关于如何删除%20并比较这些值?

2 个答案:

答案 0 :(得分:2)

尝试此操作从字符串

中删除%20或%27
initial = 0
final = 10000
guess = (initial + final)//2

num = int(input("Enter Number"))

while True:
    if guess == num:
        print(guess, "is in our list. Congratulation!")
        break
    elif guess > num:
        final = guess
    else:
        initial = guess

答案 1 :(得分:0)

它是url编码的值。你必须解码vaue然后比较它。这会将 private void showPushNotification(String title, String message, Intent tapIntent, int notificationID) { android.support.v7.app.NotificationCompat.Builder builder = new android.support.v7.app.NotificationCompat.Builder(this); builder.setSmallIcon(R.drawable.swiftee_white_logo_notification); //Intent tapIntent = new Intent(this, HomeScreenActivity.class); //tapIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); //tapIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); //tapIntent.putExtra(AppConstants.PUSH_MESSAGE, true); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, tapIntent, PendingIntent.FLAG_ONE_SHOT); builder.setContentIntent(pendingIntent); builder.setAutoCancel(true); builder.setContentTitle(title); builder.setContentText(message); NotificationManager notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(notificationID, builder.build()); } 再次转换为%20

space