Your variable with some checks ...
<?php
$phpstring = $wpdb->get_row("SELECT value FROM user_data WHERE user_id = 5");
?>
var state_phpstring = <?php echo (is_array($phpstring)) ? implode(',',$phpstring):'null'; ?>;
Edit : You can use this variable in your sample code at line
var <?php echo $phpstring ?> = 'user1';
But each record you get from db will be assigned to the same properties which doesn't make a sense you 'd better store all property datas in mysql and fetch them too and assign them later... and btw, now, after you tell me the main goal you'd like to achieve i would like to tell you these ;
To store different properties of a main variable (an individual here in your sample) you'd better use arrays. Like this;
user1 = new Array();
user1["state"] = "CA";
user1["country"] = "USA";
//and so on...
To use sample php above for this usage you can try something like this;
<?php
$phpstring = $wpdb->get_row("SELECT username,user_state,property2,property3 FROM user_data WHERE user_id = 5");
// make sure $phpstring is an array and has item in it here
// you can also assign more than one person data with foreach usage
foreach($phpstring as $individuals){
echo $individuals["username"]." = new Array();";
echo $individuals["username"].'["state"] = "'.$individuals["user_state"].'";';
echo $individuals["username"].'["property2"] = "'.$individuals["property2"].'";';
echo $individuals["property2"].'["property3"] = "'.$individuals["property2"].'";';
}
?>
Note that this is just a sample and i don't know how your phpstring returns (associative or not etc)
As a last note ; Indeed using object oriented programming which treats variables as a realworld object (for instance a person) is the best approach but this requires understanding OOP logic and usage so in short term arrays will do what you want simpler.