Marcel1993 Posted December 23, 2010 Share Posted December 23, 2010 Hey, $upgrade_next_sql = "SELECT * FROM todo_upgrades WHERE profile_id = ".$profile_id." AND level = ".$profile_data['level_'.$show.'']+1." AND type = '$show'"; doesn't work because there is "+1". How can I add this value to the variable without forming a extra variable before? Link to comment https://forums.phpfreaks.com/topic/222444-add-value-to-a-variable-without-forming-it-before/ Share on other sites More sharing options...
trq Posted December 23, 2010 Share Posted December 23, 2010 That will work fine. Do you see what is expected when you echo $upgrade_next_sql ? Also, you have some extra crap within your array index (it won't effect it, it's just not needed). $profile_data['level_'.$show] Link to comment https://forums.phpfreaks.com/topic/222444-add-value-to-a-variable-without-forming-it-before/#findComment-1150568 Share on other sites More sharing options...
gergy008 Posted December 23, 2010 Share Posted December 23, 2010 Also because you are using double quotes theres no need to append the string to insert a variable. You have: "...file_id = ".$profile_id." AND le..." You can made it: "...file_id = $profile_id AND le..." and it will work, However '...file_id = $profile_id AND le...' would not as it's single quotes. Link to comment https://forums.phpfreaks.com/topic/222444-add-value-to-a-variable-without-forming-it-before/#findComment-1150592 Share on other sites More sharing options...
sasa Posted December 23, 2010 Share Posted December 23, 2010 add space after +1 change +1. to +1 . Link to comment https://forums.phpfreaks.com/topic/222444-add-value-to-a-variable-without-forming-it-before/#findComment-1150606 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.