PHP and MYSQLI with LIKE array: does not echo all content correctly -
i have come far , seem stuck on trivial output issue, apologies in advance.
the $getexhibitions array , works when aspect of code running. have added $results based on keyword link intended array within array.
my problem output supposed show $getexhibitions->title list of each $results->sponsor underneath. java creates drop down specific sponsor information. repeat preceeding 8 years so.
as can see code getting stuck , feel though may div or { problem or may more array code. in advance.
http://tenmoregirls.com/tenmoregirls/sponsors.php
<?php $current_url = base64_encode($url="http://".$_server['http_host'].$_server['request_uri']); $query_getexhibitions = $mysqli->query("select * exhibitions order year desc"); if ($query_getexhibitions) { while($getexhibitions = $query_getexhibitions->fetch_object()) { echo "<a>$getexhibitions->year | $getexhibitions->title</a>", "<br />"; $sponsorlink = $getexhibitions->year; $result = $mysqli->query("select * sponsors (`year` '%".$sponsorlink."%')"); if ($result) { while($results = $result->fetch_object()) { echo "<a href = \"javascript:void(0)\" class=\"subheading\" onclick = \"document.getelementbyid($results->id).style.display='block'\" >$results->sponsor</a>", "<br />"; echo "<div id=\"$results->id\" style=\"display: none;\"> <a href = \"javascript:void(0)\" onclick = \"document.getelementbyid($results->id).style.display='none'\"><img src=\"exhibitstyles/links/close.png\" alt=\"close\" width=\"20\"/></a><br />"; echo '<img src="sponsorimages/'.$results->logo.'">'; echo $results->summary, "<br />"; echo "<a href=\"http://$results->website\" target=\"_blank\">$results->website</a>", "<br /><br /><br />"; } "</div>"; } "</div>"; }} exit(); ?>
it's not problem php , mysqli, wrong closing div tag, outside loop. there 1 additional closing tag don't seem refer anything. try move </div>
tag inside loop , delete other one.
edit: missing echo
command before "</div>";
tag, because used ;
on end of previous line. you can't use whereas ,
between multiple echo parameters. .
concatenation operator strings in php..
concatenation operator strings, echo construction allows usage of ,
between arguments. bad.
try this:
while($getexhibitions = $query_getexhibitions->fetch_object()) { echo "<a>$getexhibitions->year | $getexhibitions->title</a><br />"; $sponsorlink = $getexhibitions->year; $result = $mysqli->query("select * sponsors (`year` '%".$sponsorlink."%')"); if ($result) { while($results = $result->fetch_object()) { echo "<a href = \"javascript:void(0)\" class=\"subheading\" onclick = \"document.getelementbyid($results->id).style.display='block'\" >$results->sponsor</a><br />"; echo "<div id=\"$results->id\" style=\"display: none;\"> <a href = \"javascript:void(0)\" onclick = \"document.getelementbyid($results->id).style.display='none'\"><img src=\"exhibitstyles/links/close.png\" alt=\"close\" width=\"20\"/></a><br />"; echo '<img src="sponsorimages/'.$results->logo.'">'; echo $results->summary . "<br />"; echo "<a href=\"http://$results->website\" target=\"_blank\">$results->website</a><br /><br /><br />"; echo "</div>"; } } }
Comments
Post a Comment