GetSimple Support Forum

Full Version: beginners trouble with php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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/t...or-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
                            "
;
                        
$sponsorsqlmysql_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"
;
                                
$sponsorsocialsqlmysql_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">&nbsp;</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;
?>
I found the debug mode in the script, I then saw that is did nog specify $lang.

I fixed this and now the script works.
J.S. Coolen,

you are welcome here at the GetSimple Forum, but as GS does not use databases, this seems not the right forum for mysql questions, there are more specified forums available, I think

however, it is no good idea to publish your SQL code here, I remember situations where these informations were helpful to hackers ;=(
I don't think that hackers are really interested in hacking my website, but thanks for the warning.

The problem is solved for now.