Managing Array in PHP -


i'm new php , need managing arrays. below codes extracting data sql database. need know how extract value inside $resultarray. believe $resultarray associative array, i'm not sure how value.

i tried $result = $resultarray['imageid']; doesn't work. i'm retrieving something, printing out on xcode.

    public function getimage($imageurl)     {         $returnvalue = array();         $sql = "select imageid `imagetable` imageurl = '$imageurl'";           $result = $this->conn->query($sql);         $resultarray = array();         $temparray = array();          if ($result != null && (mysqli_num_rows($result) >= 1)) {              while ($row = $result->fetch_object()) {                 $temparray = $row;                 array_push($resultarray, $temparray);             }         }         return $resultarray;     } 

i'm not quite sure if you're using mysqli, if here's answer you:

$conn = new mysqli(...); // connection database $result = $conn->query("select * `imagetable` imageurl = '$imageurl'"); // query , $result while($row = $result->fetch_assoc()) // extract rows (even if 1 returned) {      echo $row["imageid"]; // echoes "imageid"-value of row.      // ... } 

hope helped.


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -