I would like SELECT * FROM tablewhere the first column is equal to a variable. He suggested that I do not know the name of the column.
I know I can do something like
SELECT * FROM table WHERE column_id = 1
But I can not compare the data.
How can i do this?
I found some solution with T-SQL, but that doesn't interest me.
To be more precise:
I am developing an admin panel on my website where the super administrator can directly modify the database. To do this, I can select a table and edit this table. But for this I use only a PHP script that shows all the tables, we can select one and the script show all the rows in the selected table. After that, you select the line and you are redirected to the page where there is a problem. This page can accept any table with only one row, so I want the SELECTdata contained in this row.
:
.
.
() 1 , .
selecto http://imageshack.us/g/135/selecto.png
:
:
: ,
$query="SELECT * FROM ".$_POST['table']."";
$result=mysql_query($query);
: ( )
while($fields=mysql_fetch_array($result))
{
$col = mysql_field_name($result,0);
$nb++;
}
-: where $col = id
$sql = "SELECT * FROM ".$_POST['table']." WHERE ".$col."=".$_GET['idRow']."";
$result1=mysql_query($sql);