Hai,

I had a mysql database and it contain columns like "id" and "name".

I am using the following query for selecting a name with an id .

My code is

$row=mysql_select("SELECT * FROM table where id='1'") or die(mysql_error());
$result=mysql_fetch_array($ROW);

$name=$result['name'];

It works and my problem is please let me know whether it is the easy way ? Or there is any other way to do this ?


Thanks in advance
Rajeesh

This is the way to do. If you need only name from the db, then simply use name in the SELECT statement instead of *.

$row=mysql_select("SELECT name FROM table where id='1'") or die(mysql_error());
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.