How can i find 3 in row id#1 with 4 columns in php
id, Content_type1, Content_type2, Content_type3
1 6 3 9
How can i find 3 in row id#1 with 4 columns in php
id, Content_type1, Content_type2, Content_type3
1 6 3 9
I'll have to say:
$sql = 'SELECT Content_type2 FROM some_table';
$rs = mysql_query($sql);
$row = mysql_fetch_assoc($rs);
echo $row['Content_type2'];
This will fetch the value from Content_type2
assuming there's exactly one row in that table. If there's more than one row or if there's some other logic you want to apply in order to determine what value to use, please clarify.
You should restate your question with some context included. Not sure if you're looking for values in that column, or only if the value is 3?
$sql = "SELECT Content_type2 FROM [yourTableHere] WHERE Content_type2 = 3
mysql_query($sql);
That query will get that exact value. If you want to get that value for all records, remove the WHERE clause.
If you're looking to just return a row that has a value your looking for, then you can use something like the following for your SQL satement:
SELECT * FROM [TABLE] WHERE Content_type1 = [SEARCH] OR Content_type2 = [SEARCH] OR Content_type3 = [SEARCH]
Where [TABLE] is your table name and [SEARCH] is the value you're looking for. If you want to know which specific column had the value, you'll have to sift through the returned rows to figure that out.