Jump to content

what is causing this sql string to evaluate to 0 instead of becoming part of the string?


Greywacke

Recommended Posts

hi,i am rather rattled at this. can't seem to get any results on the web though...

<?php/*Quicktext Pro AJAX XML RESPONSEVersion 2.2.3*///set_time_limit(0);//return consumer name and product description by emailinclude("../includes/content/dwtphovu_f3rr37y.php");$eml = $_GET["q"];if ($eml == "") {	$eml = "@";	}header("Content-type: text/xml; charset=utf-8");echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";echo "<root>\n";$tsql = "SELECT 		SUBSTRING_INDEX(			text_Consumer, 			\";\", 			1		) AS text_ConsumerName, 		IF(			LOCATE(				\"products_description\", 				text_LeadAttributes			) = 0			, 			CONCAT_WS(				" - ", 				SUBSTRING_INDEX(					SUBSTRING_INDEX(						SUBSTRING_INDEX(							text_LeadAttributes, 							\"<br />\", 							6						), 						\";\", 						-1					), 					\" = \", 					-1				), 				SUBSTRING_INDEX(					SUBSTRING_INDEX(						SUBSTRING_INDEX(							text_LeadAttributes, 							\"<br />\", 							2						), 						\";\", 						-1					), 					\" = \", 					-1				)			) 			, 			SUBSTRING_INDEX(				SUBSTRING_INDEX(					text_LeadAttributes, 					\"<br />\", 					1				), 				\" = \", 				-1			)		) AS text_ProductDescription	FROM 		6_serviceleads 	WHERE 		text_Consumer LIKE \"%".$eml."%\" 	ORDER BY timestamp_LeadCreated DESC 	LIMIT 1;";	echo "	".$tsql."\n";$result = mysql_query_errors($tsql , $conn , __FILE__ , __LINE__ , true);if ($result) {	while ($row = mysql_fetch_array($result)) {		echo "	<lead consumername=\"".			xmlentities($row["text_ConsumerName"]).			"\" productdescription=\"".			xmlentities($row["text_ProductDescription"]).			"\" />\n";	}	mysql_free_result($result);}echo "	<sql>".join("\n",$sql)."</sql>\n";echo "</root>";mysql_close($conn);?>

that's the code, what is going on here that i do not see? :) at the moment it returns the following xml.

<?xml version="1.0" encoding="utf-8" ?><root>	0gcm.nationsu@gmail.com%" 	ORDER BY timestamp_LeadCreated DESC 	LIMIT 1;	<sql></sql></root>

that email address after the 0 was sent as the q value in the querystring - here is the page:QuickText Pro Variable Retrieval

Link to comment
Share on other sites

hmmm forgot all about the MOD operator... :)and amazingly, there is something that i still do not see (the % shows as part of the string in php - escaping them doesn't help either, that the first bit of the composed string evaluates to 0. :)could somebody please tell me what i do not see!sighs...

Link to comment
Share on other sites

ah not sure exactly what was done wrong, but it was most probably an unescaped quote, if not an overescaped quote.it's working now :) issue RESOLVED :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...