vanderlay Posted November 8, 2006 Share Posted November 8, 2006 Hi All,Firstly I can't even think how to word the title for this question correctly so I hope some of you can help explain the answer to this problem.I am doing a straight foward $a = SELECT * FROM table WHERE id = $idnum$b = MYSQL_NUM_ROWS($a)$idnum comes from var passed in url from prev page.the above statment returns a +ve result under the following, ie $idnum = 100 & id 100 exists is in dbsearch for 100$b = 1 (expected)search for 100abcd$b = 1 (unexpected)search for abcd100$b = 0 (expected)so the basic Q is why does the MYSQL_NUM_ROWS rtn a +ve match for a search with letters &/or numbers added to the end of a seach string? FYI i noted it only happens with numbers as the first part of the string not letters?ThxArt Link to comment https://forums.phpfreaks.com/topic/26536-php-mysql-where-statment-partial-match-numbers-only/ Share on other sites More sharing options...
btherl Posted November 8, 2006 Share Posted November 8, 2006 A string starting with numbers will be converted into a real (float) matching those numbers. A string starting with letters will be converted into the real 0. Then the comparison proceeds as usual.See http://dev.mysql.com/doc/refman/4.1/en/type-conversion.html Link to comment https://forums.phpfreaks.com/topic/26536-php-mysql-where-statment-partial-match-numbers-only/#findComment-121409 Share on other sites More sharing options...
vanderlay Posted November 8, 2006 Author Share Posted November 8, 2006 thx btherl for the link and a speedy answer!peaceart Link to comment https://forums.phpfreaks.com/topic/26536-php-mysql-where-statment-partial-match-numbers-only/#findComment-121454 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.