0

PHP.....
I have a mysql table which has two columns: NAME, ADDRESS. i want to assign the both column names into variable.

if i give one column name and it works as below.
$yourfield = "NAME"; //it prints value of NAME column

I want to retrive values of both column. how can i assign both column names to variable $yourfield ????
try1: $yourfield = "NAME, ADDRESS"; //NOT WORKING???
try2: $yourfield = "NAME" , "ADDRESS"; //NOT WORKING???

Thx.

4
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by pbcomput
0

You can use array , like this

$yourfield = array("NAME", "ADDRESS");

Where,

$yourfield[0] => NAME
$yourfield[1] => ADDRESS
0

Hi,

you can try like this

$yourfield = "NAME"."ADDRESS";

or if you want to separate the fields with comma then you should try this

$yourfield = "NAME".","."ADDRESS";

hope this will help you out. :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.