By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,991 Members | 1,888 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,991 IT Pros & Developers. It's quick & easy.

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

P: 6
This is my code..unexpected T_VARIABLE in C:\wamp\www\job_detail.php on line 15
Expand|Select|Wrap|Line Numbers
  1. <div class="h3">Features</div>
  2. <div class="mainbox">
  3. <ul id="features">
  4.  
  5. <?php
  6. $con = mysql_connect("localhost","root","");
  7. if (!$con)
  8.   {
  9.   die('Could not connect: ' . mysql_error());
  10.   }
  11.  
  12. mysql_select_db("job_seeks", $con);
  13.  
  14. $result = mysql_query("SELECT * FROM employer_user");
  15. $row = mysql_fetch_array($result);
  16.         ?>
  17. <center>
  18. <table cellspacing=1 cellpadding=5>
  19.         <tr><td class=listtitle colspan=2><center><span class='title2'></span></center></td></tr>
  20.         <?php
  21.         echo "
  22.         <form method=\"POST\">
  23.         <tr><td class=list align=left>Username</td><td class=list> ".$row['username']."<br></td></tr>
  24.         <tr><td class=list align=left>Business Name</td><td class=list> ".$row['business_name']."<br></td></tr></center>";
  25.         echo "</td></tr></table>";
  26. ?>
  27. </div>
  28. </div>
  29.  
  30.  
  31.  
  32.  
Dec 6 '11 #1
Share this Question
Share on Google+
7 Replies


omerbutt
100+
P: 638
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
Dec 6 '11 #2

AutumnsDecay
100+
P: 170
I believe the issue is that you're using "mysql_fetch_array". I could be wrong, but it's worth a shot.

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

Give it a shot and let me know.
Dec 6 '11 #3

omerbutt
100+
P: 638
hi AutmnsDecay ,
as far the definition of a mysql_fetch_array is concerned mysql_fetch_array — 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
Expand|Select|Wrap|Line Numbers
  1. mysql_fetch_array($result,MYSQL_NUM)
or
Expand|Select|Wrap|Line Numbers
  1. mysql_fetch_array($results,MYSQL_ASSOC)
regards,
Omer Aslam
Dec 6 '11 #4

AutumnsDecay
100+
P: 170
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.
Dec 6 '11 #5

omerbutt
100+
P: 638
thats ok, java and c++ are the most interesting and HIGHLY PAYED tooo :D ;) , goodluck with that .
regards,
Omer Aslam
Dec 6 '11 #6

Dormilich
Expert Mod 5K+
P: 8,639
and another cross-forum post
Dec 7 '11 #7

P: 78
Expand|Select|Wrap|Line Numbers
  1. <div class="h3">Features</div>
  2. <div class="mainbox">
  3. <ul id="features">
  4.  
  5. <?php
  6. $con = mysql_connect("localhost","root","password");
  7. if (!$con)
  8. {
  9. die('Could not connect: ' . mysql_error());
  10. }
  11.  
  12. mysql_select_db("job_seeks", $con);
  13.  
  14. $result = mysql_query("SELECT * FROM employer_user");
  15. while($row = mysql_fetch_array($result))
  16. {
  17. ?>
  18. <center>
  19. <table cellspacing=1 cellpadding=5>
  20. <tr><td class=listtitle colspan=2><center><span class='title2'></span></center></td></tr>
  21. <?php
  22. echo "
  23. <form method=\"POST\">
  24. <tr><td class=list align=left>Username</td><td class=list> ".$row['username']."<br></td></tr>
  25. <tr><td class=list align=left>Business Name</td><td class=list> ".$row['business_name']."<br></td></tr></center>";
  26. echo "</td></tr></table>";
  27. }
  28. ?>
  29. </div>
  30. </div>
  31.  
Dec 11 '11 #8

Post your reply

Sign in to post your reply or Sign up for a free account.