birbal Posted October 8, 2010 Share Posted October 8, 2010 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 More sharing options...
justsomeguy Posted October 9, 2010 Share Posted October 9, 2010 What do you mean? There's only one way to access an array element, with the element's key. Link to comment Share on other sites More sharing options...
birbal Posted October 9, 2010 Author Share Posted October 9, 2010 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 More sharing options...
jeffman Posted October 9, 2010 Share Posted October 9, 2010 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.