Table is profile_values STRUCTURE FID UID VALUE FID value of 3 contains some HTML data that I need FID value of 2 contains the url to their image FID value of 1 contains either a 1 or a 0 if its a 1 then I want the HTML value and the image value but if its a 0 I dont want anything from it How can I create a query to display all values and uid's only where that uid's fid1 value is equal to 1
//this gets all values and uids. $query only holds resources id#'s //so you need a mysql_result or other function to extract the actual data. $query = mysql_query("select UID, VALUE from profile_values where FID=1"); //this is to get ONE value fom the table, not sure how to get more? $result = mysql_result($query, #); Code (markup): you may need a for loop of sorts. not sure if this helped :/
You shouldn't store data like this. It is irrational and undermines the point of using a relational database. You should do something more like: UID, FID, HTML_DATA, PATH_TO_IMAGE Theis way, you only need a single query to access everything you need. Not sure about the UID, FID relationship, but something like this.