WordPress.org

Ready to get started?Download WordPress

Forums

parse error (1 post)

  1. santy143all
    Member
    Posted 1 year ago #

    Hi all

    I have been working on dynamic pages that will fetch content from datbase and show it up in databas eusing id from querystring.

    i have implemented below two file in wordpres but it is showing parse error as below,

    test.php
    
    <?php
    include 'test2.php';
    
    $val = $_GET['id'];
    
    $lenght_of_querystring=strlen($val);
    
    $parts = str_split($val, $split_length = 1);
    
    for($i=0;$i<$lenght_of_querystring;$i++)
    {
    
    $query="SELECT * FROM data WHERE <code>id</code> = $parts[$i]" ;
    
    $result=mysql_query($query) or trigger_error(mysql_error().$query);;
    if (!$result) { // add this check.
        die('Invalid query: ' . mysql_error());
    }
    
    $data = mysql_fetch_array($result);
    
    	echo '<div><h1 style="font-family: myriad pro light;color:#EE3D96;font-size: 45px;font-weight: bolder;" align="">' . $data["name"] . '</h3></div>';
    	echo '<div><p style="font-size: 19px;line-height: 18px;color: #827B72;width: 193px;">' . $data["text"] . '</p><div>';
    	echo '<div style="width: 580px;margin-left: 202px;margin-top: -182px;"><img src="images/'.$data["image"].'" /></div>';
    
    }
    ?>
    test2.php
    <?php
    
    $dbhost='localhost';
    $dbuser='root';
    $dbpass='';
    $db='wordpress';
    
    $con = mysql_connect("localhost","elemental","");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    
    mysql_selectdb($db);
    
    ?>

    Parse error: syntax error, unexpected ‘<’ in C:\wamp\www\wordpress\wp-content\plugins\exec-php\includes\runtime.php(42) : eval()’d code on line 32

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.