Clinton Posted June 6, 2008 Share Posted June 6, 2008 if I echo $type I get 'MS NONEL' (which is correct) however when I do as done below it cuts it off: <? $result2 = mysql_query("SELECT * FROM $choice$type ORDER BY transactiondate") or die ('Error: '.mysql_error ()); ?> The result is then '5555MS' when it should be '5555MS NONEL'. But it's echoing correctly above so why would it not here? Link to comment https://forums.phpfreaks.com/topic/109052-solved-table-doesnt-exist-pretty-sure-it-does/ Share on other sites More sharing options...
Clinton Posted June 6, 2008 Author Share Posted June 6, 2008 I know it probably has something to do with the space in between MS NONEL but I'm not sure what to do. :-| Link to comment https://forums.phpfreaks.com/topic/109052-solved-table-doesnt-exist-pretty-sure-it-does/#findComment-559469 Share on other sites More sharing options...
DarkWater Posted June 6, 2008 Share Posted June 6, 2008 Put the table in ' '. Link to comment https://forums.phpfreaks.com/topic/109052-solved-table-doesnt-exist-pretty-sure-it-does/#findComment-559473 Share on other sites More sharing options...
discomatt Posted June 6, 2008 Share Posted June 6, 2008 No, you want to put the table in back-ticks '`' "SELECT * FROM `$choice$type` ORDER BY `transactiondate`" Link to comment https://forums.phpfreaks.com/topic/109052-solved-table-doesnt-exist-pretty-sure-it-does/#findComment-559475 Share on other sites More sharing options...
Clinton Posted June 6, 2008 Author Share Posted June 6, 2008 Yea, the ' didn't do it. The backticks, however did. Howcome? Link to comment https://forums.phpfreaks.com/topic/109052-solved-table-doesnt-exist-pretty-sure-it-does/#findComment-559477 Share on other sites More sharing options...
discomatt Posted June 6, 2008 Share Posted June 6, 2008 MySQL encloses strings in quotes, and columns/tables in back ticks. Consider it a 'special' type of quote for cols/tables only. Link to comment https://forums.phpfreaks.com/topic/109052-solved-table-doesnt-exist-pretty-sure-it-does/#findComment-559479 Share on other sites More sharing options...
Clinton Posted June 6, 2008 Author Share Posted June 6, 2008 Ok. Thank you. Link to comment https://forums.phpfreaks.com/topic/109052-solved-table-doesnt-exist-pretty-sure-it-does/#findComment-559483 Share on other sites More sharing options...
DarkWater Posted June 6, 2008 Share Posted June 6, 2008 Yeah, I meant backticks. *Facepalm* Link to comment https://forums.phpfreaks.com/topic/109052-solved-table-doesnt-exist-pretty-sure-it-does/#findComment-559495 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.