Jump to content

pass array to mysql query


birbal

Recommended Posts

how can i pass array value directly to mysql_query(). i dont know how to do that. help me please

Link to comment
Share on other sites

What do you mean? There's only one way to access an array element, with the element's key.
no i mean something like this,,,,SELECT * FROM tablename WHERE (id="$userid")i am trying to do something like thisSELECT * FROM tablename WHERE (id="$clean['$userid']")trying to put it in mysql_querywhen i am trying to like this it is not working. is there any diffrent way to do that?
Link to comment
Share on other sites

When you reference an array element inside a double-quoted string, surround it with curly braces, like {$clean['$userid']}.For your own sanity, it might be easier to assemble your query string before you pass it to mysql_query. It's a good practice while you're debugging, anyway. Then you can always echo the query string to see what it really looks like (in case it turns out to be formatted incorrectly).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...