Note that there are some explanatory texts on larger screens.

plurals
  1. POFetch specific field from a MySQL result array
    primarykey
    data
    text
    <p>I’m trying to retrive the field <em>media_file</em> from the first line of the query. I don’t figure how to do that. I’ve tried several times to get it by calling the multidimensional array <code>$pages[0]['media_file']</code> with no success.</p> <p>I’m trying to have the first image of a series bigger and then append the other thumbs. Here the page that we are talking about: <em><a href="http://www.svarnet.it/index.php?/works/svarnet-dream/" rel="nofollow noreferrer">http://www.svarnet.it/index.php?/works/svarnet-dream/</a></em></p> <p><strong>this is the code:</strong></p> <pre><code>function createExhibit() { $OBJ =&amp; get_instance(); global $rs; $pages = $OBJ-&gt;db-&gt;fetchArray("SELECT * FROM ".PX."media, ".PX."objects_prefs WHERE media_ref_id = '$rs[id]' AND obj_ref_type = 'exhibit' AND obj_ref_type = media_obj_type ORDER BY media_order ASC, media_id ASC"); $s = "&lt;div id='text-container'&gt;\n"; $s .= $rs['content']; $s .= "&lt;/div&gt;\n"; $s .= "\n&lt;div class='cl'&gt;&lt;!-- --&gt;&lt;/div&gt;\n"; if (!$pages) return $s; foreach ($pages as $height) { $height = getimagesize(DIRNAME . GIMGS . "/th-$height[media_file]"); $find_smallest_height[] = $height[1]; } sort($find_smallest_height, SORT_NUMERIC); rsort($find_smallest_height); $lowest = array_pop($find_smallest_height); $i = 1; $a = ''; foreach ($pages as $go) { $a .= "\n&lt;a class='group' rel='group' href='" . BASEURL . GIMGS . "/$go[media_file]' title='$go[media_title]'&gt;&lt;imgXXX src='" . BASEURL . GIMGS . "/th-$go[media_file]' alt='$go[media_caption]' height='80px' /&gt;&lt;/a&gt;\n"; $i++; } // images $s .= "&lt;div id='img-container'&gt;\n"; // //////////////// HERE I WANT TO INSERT THE FIRST IMAGE OF THE QUERY $s .= "&lt;imgXXX src='" . BASEURL . GIMGS . $pages['media_file'] . "' alt='$pages[media_title]' /&gt;"; // THEN APPEND THE OTHERS IN THUMB FORMAT $s .= $a; $s .= "&lt;/div&gt;\n"; return $s; } </code></pre> <p>Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload