psychowolvesbane Posted January 4, 2008 Share Posted January 4, 2008 I have a line and I want to get it so that the value of CampusID is "Campus & value of NumberOfRecords+1". But I'm not sure on the correct concatenate method. $CampusID = "Campus" '.' $NumberOfRecords+1'; ($NumberOfRecords is 2 btw) Quote Link to comment https://forums.phpfreaks.com/topic/84508-solved-concatenate-help/ Share on other sites More sharing options...
duclet Posted January 4, 2008 Share Posted January 4, 2008 $CampusID = "Campus".($NumberOfRecords+1); Quote Link to comment https://forums.phpfreaks.com/topic/84508-solved-concatenate-help/#findComment-430566 Share on other sites More sharing options...
Wuhtzu Posted January 4, 2008 Share Posted January 4, 2008 Your syntax is wrong, this is correct: $CampusID = "Campus " . $NumberOfRecords+1; or $CampusID = "Campus" . " " . $NumberOfRecords+1; . (dot) is used to join strings and variables together so the correct syntax is like: $new string = "string" . "anotherstring" . $variable . "yet another string" . $andavariable; Quote Link to comment https://forums.phpfreaks.com/topic/84508-solved-concatenate-help/#findComment-430567 Share on other sites More sharing options...
psychowolvesbane Posted January 4, 2008 Author Share Posted January 4, 2008 No it hasn't worked, I have $NumberOfRecords as 1 and I used both $CampusID = "Campus " . $NumberOfRecords+1; or $CampusID = "Campus" . " " . $NumberOfRecords+1; and the value for $CampusID I am getting is just "1". Quote Link to comment https://forums.phpfreaks.com/topic/84508-solved-concatenate-help/#findComment-430578 Share on other sites More sharing options...
duclet Posted January 4, 2008 Share Posted January 4, 2008 What, you didn't try mine? Quote Link to comment https://forums.phpfreaks.com/topic/84508-solved-concatenate-help/#findComment-430579 Share on other sites More sharing options...
psychowolvesbane Posted January 4, 2008 Author Share Posted January 4, 2008 Ah sorry but duclet's method has worked and it is problem solved! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/84508-solved-concatenate-help/#findComment-430580 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.