Page 1 of 1

How to combine two variables to make one?

Posted: Sat Apr 19, 2008 8:14 pm
by michlcamp
need to create one variable by combining two with an underscore between them, then post the new one to a field in the data table. Want to create ' bob_799' from the code below, but this isn't working...

Code: Select all

 
$user_id = "bob";
$license_num = "799";
$string= "$user_id"._."$license_num";
echo "$string";
 
only prints the underscore.
I don't exactly understand the proper use of quotes and periods in queries, so have been experimenting, but no luck so far..

how to write it properly?
any help appreciated in advance..
thanks,
mc

Re: How to combine two variables to make one?

Posted: Sat Apr 19, 2008 9:09 pm
by aceconcepts

Code: Select all

 
$user_id = "bob";
$license_num = "799";
$string= $user_id."_".$license_num;
echo $string;