2013-06-14, 23:49:06
(This post was last modified: 2013-06-15, 00:01:11 by J.S. Coolen.)
Hi,
I'm new to cms systems, so i'm trying to figure out how everything works.
On my website I have a php script.
http://www.festivalstegendierenleed.nl/test/sponsor-pagina/
But somehow when I echo the output from the following script, it only shows what you see on the link above.
The script should show a few companies who help our organisation.
So somehow the script does not echo the variables. But the system is reading the script, if I make an error in the Query he will report that.[/php]
When I use the script on a normal website it works fine.
I'm new to cms systems, so i'm trying to figure out how everything works.
On my website I have a php script.
http://www.festivalstegendierenleed.nl/test/sponsor-pagina/
But somehow when I echo the output from the following script, it only shows what you see on the link above.
The script should show a few companies who help our organisation.
So somehow the script does not echo the variables. But the system is reading the script, if I make an error in the Query he will report that.[/php]
When I use the script on a normal website it works fine.
PHP Code:
<?php
$connection = mysql_connect("localhost", "***", "***", true) or die(mysql_error());
$db =mysql_select_db('***', $connection) or die(mysql_error());
$goldsponsors ='';
$silversponsors ='';
$bronssponsors ='';
$sponsorqry = "
SELECT
sponsors.logo,
sponsors.waarde,
bedrijven.naam,
sponsors.linknaam,
bedrijven.website,
bedrijven.bedrijfsnummer
FROM
sponsors
INNER JOIN
bedrijven
ON
sponsors.bedrijf=bedrijven.bedrijfsnummer
WHERE
bedrijven.taal='".$lang."'
ORDER BY
sponsors.waarde DESC
";
$sponsorsql= mysql_query($sponsorqry);
if($sponsorsql === false)
{
echo("Er ging iets fout met de query: ".mysql_error($connection)." (".$sponsorqry.")");
}
else
{
WHILE ($sponsor = mysql_fetch_array($sponsorsql))
{
$sponsorlogo ='<div id="sponsorslogo"><a href="http://'.$sponsor['website'].'"rel="external" title="'.$sponsor['naam'].'"><img src="/logos/'.$sponsor['logo'].'.jpg" height="80" width="80" alt="'.$sponsor['naam'].'" /></a></div>';
$sponsornaam ='.<div id="sponsorsnaam"><a href="http://'.$sponsor['website'].'"rel="external" title="'.$sponsor['naam'].'">'.$sponsor['naam'].'</a></div>';
if($sponsor['waarde']>=10)
{
$goldsponsors.=
$sponsorlogo
.$sponsornaam;
$sponsorsocialqry = "
Select
link,
soort_social
FROM
bedrijvensocial
WHERE
bedrijfsnummer = '".$sponsor['bedrijfsnummer']."'
ORDER BY
soort_social";
$sponsorsocialsql= mysql_query($sponsorsocialqry, $connection);
if($sponsorsocialsql === false)
{
echo("Er ging iets fout met de query: ".mysql_error($connection)." (".$sponsorsocialqry.")");
}
elseif(mysql_num_rows($sponsorsocialsql) == 0)
{
$goldsponsors.='
<div id="sponsorsocial"> </div>';
}
else
{
WHILE ($sponsorsocial = mysql_fetch_array($sponsorsocialsql))
{
$goldsponsors.='
<div id="sponsorsocial">';
if($sponsorsocial['soort_social'] == 1)
{
$goldsponsors.='
<a href="https://www.facebook.com/'.$sponsorsocial['link'].'" alt="'.$sponsor['naam'].'">facebook</a>';
}
elseif($sponsorsocial['soort_social'] == 2)
{
$goldsponsors.='
<a href="https://www.twitter.com/'.$sponsorsocial['link'].'" alt="'.$sponsor['naam'].'">twitter</a>';
}
}
$goldsponsors.='
</div>';
}
}
elseif($sponsor['waarde']>=5)
{
$silversponsors.=
$sponsorlogo
.$sponsornaam;
}
elseif($sponsor['waarde']>=1)
{
$bronssponsors.=
$sponsornaam;
}
}
}
echo
'Gold sponsors
'.$goldsponsors.'
Silver sponsors
'.$silversponsors.'
Brons sponsors
'.$bronssponsors;
?>