Jump to content

Recommended Posts

For some reason the if statement keeps coming up as true. This is even if "Call+Out+Fee+for+" isn't in the string being tested.

 

Could someone help me correct this please

 

if (preg_match("Call+Out+Fee+for+", $req)) {
	preg_match('/item_name1[^&]+/', $req, $out);
		$vowels = array("item_name1=", "Call+Out+Fee+for+", "%3A00", "%23");
		$a = str_replace($vowels, "", $out[0]);
		$b = str_replace("%23", "*", $a);
		$c = str_replace("+on+", "*", $b);
		$d = str_replace("+", "*", $c);
		$pieces = explode("*", $d);
	preg_match('/payer_email[^&]+/', $req, $out2);
		$a = str_replace("payer_email=", "", $out2[0]);
		$email = str_replace("%40", "@", $a);
	include 'RCMConnect.php';
	echo $sql;
	$sql = "UPDATE bookings SET confirm='1' WHERE bookingtime='".$pieces[1]."' AND bookingdate='".$pieces[2]."' AND conf='".$pieces[0]."'";
	$result = mysql_query($sql);
} else {
	preg_match('/item_name1[^&]+/', $req, $out);
	$a = str_replace("+for+", "*", $out[0]);
	$b = str_replace("+", " ", $a);
	$pieces = explode("*", $b);
	include 'RCMConnect.php';
	$sql = "UPDATE bookings SET confirm='1' WHERE user='".$pieces[1]."' AND type='".$pieces[0]."'";
	$result = mysql_query($sql);		
}

Link to comment
https://forums.phpfreaks.com/topic/69752-if-substring-exists-not-working/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.