Add php script to wordpress

  • Unknown's avatar

    I have made a php script with a database connection and I want to add this to a page.
    But for some reason the script stops after:
    <div class=”gal”>

    Does anyone know what I am doing wrong?

    This is the script I made

    $connection2 = new wpdb( "jcsl123456", "123456", "table", "localhost" );
    
    ?>
    
    <div class="klanten_gallery">
    	<div class="container">
    		<div class="klanten_gallery_inn">
            	<div class="klanten_gallery_header">
            	<!--h2>Onze klanten</h2-->
                <h2><?php the_title(); ?></h2>
                	<div class="border_photo_klanten"></div>
                </div>
    			<div class="klanten_gallery_text">
                    <?php
                        if ( have_posts() ) : while ( have_posts() ) : the_post();
                            the_content();
                        endwhile; endif;
                    ?>
                </div>
    			<div class="gal">
                    <?php
    $main ='';
    $qry ='
    	SELECT
    		kl_logos.id,
    		kl_logos.klnr,
    		kl_logos.image,
    		kl_overzicht.kl_overzicht_naam
    	FROM
    		kl_logos
    	INNER JOIN
    		kl_overzicht
    	ON
    		kl_logos.klnr = kl_overzicht.kl_overzicht_klnr
    	ORDER BY
    		RAND()
    	LIMIT
    		18';
    if(!$result = $connection2->query($qry)) {
        echo 'Fout in query: '.$connection2->error;
    }else while($list = $result->fetch_assoc()){
    $main .='
    			<a class="fancy6" href="#" title="'.$list['kl_overzicht_naam'].'">
    				<div class="klanten_image">
    				<img src="'.$urlfoto.$list['image'].'" alt="'.$list['kl_overzicht_naam'].'"/>
    
    				</div>
    			</a>';
    		}
    		echo $main;
                ?>
    			 </div>
    
    		</div>
    	</div>
    </div>
  • Unknown's avatar
  • The topic ‘Add php script to wordpress’ is closed to new replies.