sayedsohail Posted January 27, 2007 Share Posted January 27, 2007 HiI just wish to know how could i select a particular field in an array i.e, only one field from my sql statement below and refer those values in javascript.ie., select lname, fname, company, from table1lname should be in an array.Please help. Link to comment https://forums.phpfreaks.com/topic/35940-select-field-in-array-and-refer-the-value-in-javascript/ Share on other sites More sharing options...
ted_chou12 Posted January 27, 2007 Share Posted January 27, 2007 $result = mysql_query("SELECT * FROM table1")$row = mysql_fetch_array($result);$lname = $row['lname'];thats for general columns, if you want specific ones like lname:change:$result = mysql_query("SELECT * FROM table1")to$result = mysql_query("SELECT lname FROM ")rest stays the samebut i dont understand what do you mean by array.Ted Link to comment https://forums.phpfreaks.com/topic/35940-select-field-in-array-and-refer-the-value-in-javascript/#findComment-170449 Share on other sites More sharing options...
sayedsohail Posted January 27, 2007 Author Share Posted January 27, 2007 Thanks for the help, here is the scenarioMy first table select statementselect lname, fname,member_id, id from table1;and onclick I wish to pass $member_id, $id through a javascript function i.e., onclick=checkvalues("Myform", $id,$member_id)so my next query will have a choice to select data from either of this two values ie., id or member_id, however, i don't want to display member_id in my first output, that is why i thought of storing member_id in a separate array and referring it in my onlick statement.My logic is bit strange and i apologize for that. Can you advise? Thanks Link to comment https://forums.phpfreaks.com/topic/35940-select-field-in-array-and-refer-the-value-in-javascript/#findComment-170451 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.