Ik heb een loopje met daarin wat data uit de database. Alles wordt netjes uitgelezen alleen komt er een leeg veld bij aan het einde van de uitgelezen velden.
Zoals hier: https://i.gyazo.com/3da3e92fb55a5b80233576bf490dd71d.png
Er staat geen leeg veld in de database dus het ligt ergens aan mn code.
Dit is mn query en foreach loopje:
<?
// content
$content = "SELECT * FROM `lb_content` WHERE catid = 13";
$contentcon = $conn->query($content);
$contentcr = array();
while ($contentcr[] = $contentcon->fetch_array());
foreach($contentcr as $content)
{
$article_images = $content['images']; // Get image parameters of the article
$pictures = json_decode($article_images); // Split the parameters apart
$contentje .= '<li class="job_listing">
<a href="http://www.website.nl/_extern/website/content.php?alias='.$content['alias'].'">
<div class="location job_img">
<img name="images" src="/_extern/website/cms/'.$pictures->{'image_intro'}.'" alt="" class="company_logo">
</div>
<div class="location boldfont">
'.$content['title'].'
</div>
<div class="location specificaties">
'.$content['introtext'].'
</div>
<div class="rating location">
<div class="rating-stars">
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
</div>
</div>
<div class="location prijs">
'.$content['metakey'].'
<br>
<div class="cursief">Vanaf 2 weken</div>
</div>
<div class="location">
<button type="submit" class="btn btn-primary buttonblock" onClick="location.href="http://www.website.nl/_extern/website/content.php?page="'.$content['alias'].'">Nu huren</button>
</div>
</a>
</li>'; // Here
}
echo $contentje;
?>
Dit is de array als ik hem uitlees:
<?
[5] => Array
(
[0] => 16
[id] => 16
[1] => 84
[asset_id] => 84
[2] => Aelia 55 (AL-55)
[title] => Aelia 55 (AL-55)
[3] => aelia-55-al-55
[alias] => aelia-55-al-55
[4] =>
Type
: AL-55
Koelvermogen
: 18,0 Kw
Afvoervermogen
: Zuilkoeling staand model
Ruimtes tot
: 520m3
[introtext] =>
Type
: AL-55
Koelvermogen
: 18,0 Kw
Afvoervermogen
: Zuilkoeling staand model
Ruimtes tot
: 520m3
[5] =>
[fulltext] =>
[6] => 1
[state] => 1
[7] => 13
[catid] => 13
[8] => 2015-11-30 10:38:11
[created] => 2015-11-30 10:38:11
[9] => 361
[created_by] => 361
[10] =>
[created_by_alias] =>
[11] => 2015-12-09 14:07:30
[modified] => 2015-12-09 14:07:30
[12] => 361
[modified_by] => 361
[13] => 361
[checked_out] => 361
[14] => 2015-12-09 14:07:30
[checked_out_time] => 2015-12-09 14:07:30
[15] => 2015-11-30 10:38:11
[publish_up] => 2015-11-30 10:38:11
[16] => 0000-00-00 00:00:00
[publish_down] => 0000-00-00 00:00:00
[17] => {"image_intro":"images\/website\/AELIA_55.jpg","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}
[images] => {"image_intro":"images\/website\/AELIA_55.jpg","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}
[18] => {"urla":false,"urlatext":"","targeta":"","urlb":false,"urlbtext":"","targetb":"","urlc":false,"urlctext":"","targetc":""}
[urls] => {"urla":false,"urlatext":"","targeta":"","urlb":false,"urlbtext":"","targetb":"","urlc":false,"urlctext":"","targetc":""}
[19] => {"show_title":"","link_titles":"","show_tags":"","show_intro":"","info_block_position":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","link_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_item_navigation":"","show_icons":"","show_print_icon":"","show_email_icon":"","show_vote":"","show_hits":"","show_noauth":"","urls_position":"","alternative_readmore":"","article_layout":"","show_publishing_options":"","show_article_options":"","show_urls_images_backend":"","show_urls_images_frontend":""}
[attribs] => {"show_title":"","link_titles":"","show_tags":"","show_intro":"","info_block_position":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","link_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_item_navigation":"","show_icons":"","show_print_icon":"","show_email_icon":"","show_vote":"","show_hits":"","show_noauth":"","urls_position":"","alternative_readmore":"","article_layout":"","show_publishing_options":"","show_article_options":"","show_urls_images_backend":"","show_urls_images_frontend":""}
[20] => 8
[version] => 8
[21] => 0
[ordering] => 0
[22] => € 235
[metakey] => € 235
[23] =>
[metadesc] =>
[24] => 1
[access] => 1
[25] => 0
[hits] => 0
[26] => {"robots":"","author":"","rights":"","xreference":""}
[metadata] => {"robots":"","author":"","rights":"","xreference":""}
[27] => 0
[featured] => 0
[28] => *
[language] => *
[29] =>
[xreference] =>
)
[6] =>
)
?>
De laatste is leeg (6). Maar er staat geen lege waarde in de database.
2.990 views