Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\job_detail.php on lin

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aquilina
    New Member
    • Dec 2011
    • 6

    Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\job_detail.php on lin

    This is my code..unexpecte d T_VARIABLE in C:\wamp\www\job _detail.php on line 15
    Code:
    <div class="h3">Features</div>
    <div class="mainbox">
    <ul id="features">
    
    <?php
    $con = mysql_connect("localhost","root","");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    
    mysql_select_db("job_seeks", $con);
    
    $result = mysql_query("SELECT * FROM employer_user");
    $row = mysql_fetch_array($result);
    		?>
    <center>
    <table cellspacing=1 cellpadding=5>
    		<tr><td class=listtitle colspan=2><center><span class='title2'></span></center></td></tr>
    		<?php
    		echo "
    		<form method=\"POST\">
    		<tr><td class=list align=left>Username</td><td class=list> ".$row['username']."<br></td></tr>
    		<tr><td class=list align=left>Business Name</td><td class=list> ".$row['business_name']."<br></td></tr></center>";
    		echo "</td></tr></table>";
    ?>
    </div>
    </div>
  • omerbutt
    Contributor
    • Nov 2006
    • 638

    #2
    hi aquilina,
    what is on line number 15 , please paste the whole page job_detail.php here or copy paste the relevant code on that line.A wild guess is that above line number 15 , on line number 14 you are missing the semi-colon at the end of the php statement.
    regards,
    Omer Aslam

    Comment

    • AutumnsDecay
      New Member
      • Mar 2008
      • 170

      #3
      I believe the issue is that you're using "mysql_fetch_ar ray". I could be wrong, but it's worth a shot.

      Try using "mysql_fetch_as soc($result)". I see that you're using name keys ($row['username'], etc), which I believe is what an associative array (mysql_fetch_as soc) would return, whereas a standard 'fetch_array' returns a numerical key array.

      Give it a shot and let me know.

      Comment

      • omerbutt
        Contributor
        • Nov 2006
        • 638

        #4
        hi AutmnsDecay ,
        as far the definition of a mysql_fetch_arr ay is concerned mysql_fetch_arr ay — Fetch a result row as an associative array, a numeric array, or both so it wont make any difference until unless you specify as a parameter
        Code:
        mysql_fetch_array($result,MYSQL_NUM)
        or
        Code:
        mysql_fetch_array($results,MYSQL_ASSOC)
        regards,
        Omer Aslam

        Comment

        • AutumnsDecay
          New Member
          • Mar 2008
          • 170

          #5
          Thanks for that, Omer.

          Been a while since I've used PHP. Been enjoying Java & C++ for long enough to lose any potential knowledge, haha.

          Comment

          • omerbutt
            Contributor
            • Nov 2006
            • 638

            #6
            thats ok, java and c++ are the most interesting and HIGHLY PAYED tooo :D ;) , goodluck with that .
            regards,
            Omer Aslam

            Comment

            • Dormilich
              Recognized Expert Expert
              • Aug 2008
              • 8694

              #7
              and another cross-forum post …

              Comment

              • Ammu
                New Member
                • Aug 2011
                • 78

                #8
                Code:
                <div class="h3">Features</div>
                <div class="mainbox">
                <ul id="features">
                
                <?php
                $con = mysql_connect("localhost","root","password");
                if (!$con)
                {
                die('Could not connect: ' . mysql_error());
                }
                
                mysql_select_db("job_seeks", $con);
                
                $result = mysql_query("SELECT * FROM employer_user");
                while($row = mysql_fetch_array($result))
                {
                ?>
                <center>
                <table cellspacing=1 cellpadding=5>
                <tr><td class=listtitle colspan=2><center><span class='title2'></span></center></td></tr>
                <?php
                echo "
                <form method=\"POST\">
                <tr><td class=list align=left>Username</td><td class=list> ".$row['username']."<br></td></tr>
                <tr><td class=list align=left>Business Name</td><td class=list> ".$row['business_name']."<br></td></tr></center>";
                echo "</td></tr></table>";
                }
                ?>
                </div>
                </div>
                Last edited by Niheel; Dec 11 '11, 06:54 PM. Reason: Please include an explanation of the fix.

                Comment

                Working...