saad|_d3vil Posted August 25, 2008 Share Posted August 25, 2008 my code is this <?php $con = mysql_connect("localhost","apnimusk","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("apnimusk_naat", $con); // check to see if id is set if(isset($_GET['id']) && is_numeric($_GET['id'])) { echo 'Your have requested ID #'.$_GET['id'].'<br />'; echo '<a href="sadasdas.php">Back</a>'; } // no id requested, display results else { $result = mysql_query("SELECT * FROM album"); echo "<table border='1'> <tr> <th>Firstname</th> <th>Lastname</th> </tr>"; while($row = mysql_fetch_assoc($result)) { echo "<tr>"; echo "<td>" . '<a href="?id='$row['id']'">'$row['name']'</a>' ."</td>"; echo "<td>" . $row['age'] . "</td>"; echo "<tr>"; } echo "</table>"; mysql_close($con); ?> it is giving error Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home1/apnimusk/public_html/sadasdas.php on line 30 Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted August 25, 2008 Share Posted August 25, 2008 echo "<td>" . '<a href="?id='$row['id']'">'$row['name']'[/url]' ."</td>"; should be echo "<td><a href='?id=".$row['id']."'>".$row['name']."</a></td>"; Quote Link to comment Share on other sites More sharing options...
saad|_d3vil Posted August 25, 2008 Author Share Posted August 25, 2008 it is giving this error now Parse error: syntax error, unexpected $end in /home1/apnimusk/public_html/sadasdas.php on line 37 Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted August 25, 2008 Share Posted August 25, 2008 oops, didnt read the problem. Please use tags Quote Link to comment Share on other sites More sharing options...
saad|_d3vil Posted August 25, 2008 Author Share Posted August 25, 2008 <?php $con = mysql_connect("localhost","apnimusk","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("apnimusk_naat", $con); // check to see if id is set if(isset($_GET['id']) && is_numeric($_GET['id'])) { echo 'Your have requested ID #'.$_GET['id'].'<br />'; echo '<a href="sadasdas.php">Back</a>'; } // no id requested, display results else { $result = mysql_query("SELECT * FROM album"); echo "<table border='1'> <tr> <th>Firstname</th> <th>Lastname</th> </tr>"; while($row = mysql_fetch_assoc($result)) { echo "<tr>"; echo "<td><a href='?id=".$row['id']."'>".$row['name']."[/a]</td>"; echo "<td>" . $row['age'] . "</td>"; echo "<tr>"; } echo "</table>"; mysql_close($con); ?> this is code i am using Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted August 25, 2008 Share Posted August 25, 2008 Not closing your if statement. The one that checks if id is set. What Blade meant was, use [ code ] [ / code ] tags, minus the spaces. It allows the forums to display it neater and show syntax errors. Oh and if you continue to get parse errors and what not, check out this thread, it should help you a bit. Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted August 25, 2008 Share Posted August 25, 2008 If it's solved , mark solved at the bottom. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.