2018-05-07 00:42
浏览 142


I've just achieved a code where I make an array with foreach and in the same code I already have an existing array. What I want to do is to make only one array with those two results. Here is my code for the first array :

$sql = "SELECT photoprofile,username from photo WHERE username IN ('somearray')";

$resol = array();
$resulol = mysqli_query($con,$sql);

$photos = mysqli_fetch_all($resulol, MYSQLI_ASSOC);
$photos = array_column($photos, "photoprofile", "username");
foreach ( $restest as $user ) {
  if ( isset($photos[$user])) {
     $res[] = $photos[$user];
 else    {
     $res[] = '';

And here is my second array :

while($row = mysqli_fetch_array($result)){    
  array_push($res2, array(

If you have any tips, any comment or even a question (if I wasn't clear enough for you), just ask me ! Thanks !

Edit : What I want to make is an array of this type :


2条回答 默认 最新

相关推荐 更多相似问题