Hy I have some problems with php and mysql -> I can't find a good solution for it.
This is my DB:
user_id | meta_key | meta_value
1 | name | Freddy
1 | phone | 123
1 | adress | Elm Street 1428
1 | city | Springwood
I'm getting datas this way:
$userdata = array (userdata);
$get_user_data = mysql_query("SELECT `meta_value` FROM `table` WHERE `user_id` = $user_id", $link);
while($row=mysql_fetch_array($get_user_data)){
array_push($userdata, $row["meta_value"]);}
What i don't like is:
I can only get data this way -> $userdata[1];
How can i get my data that there is a connection between the two rows?
$userdata['name']; (Freddy)
mysql_*functions are deprecated, they will be removed from PHP in future versions and your code will stop working then. You should not write new code using them, usemysqli_*or PDO instead.