JSHINER Posted April 15, 2008 Share Posted April 15, 2008 Have a quick question. $id = 000017 When I do the following: WHERE table.id = '$id' AND table.other = table2.other I get no results. But when I do: WHERE table.id = '000017' AND table.other = table2.other I get results. Am I missing something simple here? I'm sure I am, been a very long day. Link to comment https://forums.phpfreaks.com/topic/101136-solved-quick-query-question/ Share on other sites More sharing options...
hitman6003 Posted April 15, 2008 Share Posted April 15, 2008 if $id is being interpreted as an int in php it will remove the leading zeros. use fprint or str_pad to put the zeros back on. http://www.php.net/sprintf, example 7 Link to comment https://forums.phpfreaks.com/topic/101136-solved-quick-query-question/#findComment-517236 Share on other sites More sharing options...
JSHINER Posted April 15, 2008 Author Share Posted April 15, 2008 No go. If I do echo $id it displays 000017. Where does it get changed to 17? Link to comment https://forums.phpfreaks.com/topic/101136-solved-quick-query-question/#findComment-517238 Share on other sites More sharing options...
hitman6003 Posted April 15, 2008 Share Posted April 15, 2008 echo out your entire query and post that. Link to comment https://forums.phpfreaks.com/topic/101136-solved-quick-query-question/#findComment-517241 Share on other sites More sharing options...
JSHINER Posted April 15, 2008 Author Share Posted April 15, 2008 I knew it was something simple Had the $id = $_POST['id]; outside the function. Link to comment https://forums.phpfreaks.com/topic/101136-solved-quick-query-question/#findComment-517251 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.