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? Quote Link to comment 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. :-| Quote Link to comment Share on other sites More sharing options...
DarkWater Posted June 6, 2008 Share Posted June 6, 2008 Put the table in ' '. Quote Link to comment 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`" Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Clinton Posted June 6, 2008 Author Share Posted June 6, 2008 Ok. Thank you. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted June 6, 2008 Share Posted June 6, 2008 Yeah, I meant backticks. *Facepalm* Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.