Jump to content

Do i need to change variable?


rootKID

Recommended Posts

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 :P

If not, ask and ill retype the question when home later tonight at my laptop :D

Thanks a lot :D

 

Link to comment
Share on other sites

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?

  • Thanks 1
Link to comment
Share on other sites

Perfect.. it was the exactly answer i wanted :D

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...