rootKID Posted March 24, 2018 Share Posted March 24, 2018 Hello. Stupid question here. So when i write sql code inside variable, do i need to change it (the variable) everytime or will php be able to see to difference? Lile this: $sql = "select * from users" $result = execute sqk here... $row = output here.. fetch data... $sql = "select * from stars" ... And so forth? Or do i need to change the variable everytime so php can know each different sql code and fetches everytime? Thx in advance.. Ps: writing from a cellphone, sorry if i dont deliver perfect info, so hope you understand the question If not, ask and ill retype the question when home later tonight at my laptop Thanks a lot Link to comment Share on other sites More sharing options...
dsonesuk Posted March 24, 2018 Share Posted March 24, 2018 Whatever the predefined variable value is at the time php code refers to that variable is what is used. if $result refers to $sql variable the value will be and show 'select * from users', if the $result was after the last $sql, this last $sql overwrites the previous variable to show "select * from stars". If that is what you are asking? 1 Link to comment Share on other sites More sharing options...
rootKID Posted March 25, 2018 Author Share Posted March 25, 2018 Perfect.. it was the exactly answer i wanted Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now