sudhakar phad sudhakar phad - 4 months ago 11
PHP Question

If value exist (not primary key) in table, return table id (primary key)?

Element by there id (primary key) or any other alternative for doing that, I used

MySQL_num_rows()
for checking existence of value it works fine how to change the specified row values of columns without id(primary key) of row. Please provide some code if possible.

Answer

mysql_fetch_assoc returns array of results including all the columns that you got through the query. What you need to do is,

while ($row = mysql_fetch_assoc($result)) 
{
echo $row["primary_key"];
echo $row["other_value"];

if($row["other_value"]==something)
{
    //Update the table with $row["primary_key"]
}

}