OriginalBoy Posted April 19, 2008 Share Posted April 19, 2008 Ok so I have this code but it does not show anything? www.whitepixeldesign.com/viewcomment.php *Password is * because i dnt want u to see it * <?php //mysql details $host="localhost"; // Host name $username="****"; // Mysql username $password="****"; // Mysql password $db_name="****"; // Database name $tbl_name="comment"; // Table name //connect to mysql mysql_connect("$host", "$username", "$password")or die("cannot connect server "); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT*FROM $tbl_name $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){" ?> <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <td><table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <td>ID</td> <td>:</td> <td><?php echo $rows['id']; ?></td> </tr> <tr> <td width="117">Name</td> <td width="14">:</td> <td width="357"><?php echo $rows['name']; ?></td> </tr> <tr> <td>Email</td> <td>:</td> <td><? echo $rows['email']; ?></td> </tr> <tr> <td valign="top">Comment</td> <td valign="top">:</td> <td><?php echo $rows['comment']; ?></td> </tr> <tr> <td valign="top">Date/Time </td> <td valign="top">:</td> <td><?php echo $rows['datetime']; ?></td> </tr> </table></td> </tr> </table> <BR> <?php mysql_close(); //close database ?> Quote Link to comment https://forums.phpfreaks.com/topic/101910-help/ Share on other sites More sharing options...
jonsjava Posted April 19, 2008 Share Posted April 19, 2008 <?php //mysql details $host="localhost"; // Host name $username="****"; // Mysql username $password="****"; // Mysql password $db_name="****"; // Database name $tbl_name="comment"; // Table name //connect to mysql mysql_connect("$host", "$username", "$password")or die("cannot connect server "); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT*FROM $tbl_name;" $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){" ?> <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <td><table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <td>ID</td> <td>:</td> <td><?php echo $rows['id']; ?></td> </tr> <tr> <td width="117">Name</td> <td width="14">:</td> <td width="357"><?php echo $rows['name']; ?></td> </tr> <tr> <td>Email</td> <td>:</td> <td><? echo $rows['email']; ?></td> </tr> <tr> <td valign="top">Comment</td> <td valign="top">:</td> <td><?php echo $rows['comment']; ?></td> </tr> <tr> <td valign="top">Date/Time </td> <td valign="top">:</td> <td><?php echo $rows['datetime']; ?></td> </tr> </table></td> </tr> </table> <BR> <?php mysql_close(); //close database ?> Quote Link to comment https://forums.phpfreaks.com/topic/101910-help/#findComment-521555 Share on other sites More sharing options...
Barand Posted April 19, 2008 Share Posted April 19, 2008 *Password is * because i dnt want u to see it * Oh no it isn't! Quote Link to comment https://forums.phpfreaks.com/topic/101910-help/#findComment-521556 Share on other sites More sharing options...
OriginalBoy Posted April 19, 2008 Author Share Posted April 19, 2008 oh well i forgot...can anyone tell me why it dnt work? Quote Link to comment https://forums.phpfreaks.com/topic/101910-help/#findComment-521563 Share on other sites More sharing options...
jonsjava Posted April 19, 2008 Share Posted April 19, 2008 you forgot to add the closing quote in your sql query. Quote Link to comment https://forums.phpfreaks.com/topic/101910-help/#findComment-521564 Share on other sites More sharing options...
OriginalBoy Posted April 19, 2008 Author Share Posted April 19, 2008 Parse error: syntax error, unexpected $end in /home/stevehyd/public_html/viewcomment.php on line 70 I am now recieving that? Quote Link to comment https://forums.phpfreaks.com/topic/101910-help/#findComment-521572 Share on other sites More sharing options...
jonsjava Posted April 19, 2008 Share Posted April 19, 2008 forgot to analyze the code had a couple errors. fixed them: <?php //mysql details $host="localhost"; // Host name $username="****"; // Mysql username $password="****"; // Mysql password $db_name="****"; // Database name $tbl_name="comment"; // Table name //connect to mysql mysql_connect("$host", "$username", "$password")or die("cannot connect server "); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT*FROM $tbl_name;"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ ?> <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <td><table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <td>ID</td> <td>:</td> <td><?php echo $rows['id']; ?></td> </tr> <tr> <td width="117">Name</td> <td width="14">:</td> <td width="357"><?php echo $rows['name']; ?></td> </tr> <tr> <td>Email</td> <td>:</td> <td><? echo $rows['email']; ?></td> </tr> <tr> <td valign="top">Comment</td> <td valign="top">:</td> <td><?php echo $rows['comment']; ?></td> </tr> <tr> <td valign="top">Date/Time </td> <td valign="top">:</td> <td><?php echo $rows['datetime']; ?></td> </tr> </table></td> </tr> </table> <BR> <?php } mysql_close(); //close database ?> Quote Link to comment https://forums.phpfreaks.com/topic/101910-help/#findComment-521576 Share on other sites More sharing options...
OriginalBoy Posted April 19, 2008 Author Share Posted April 19, 2008 great thanks! I need a lil more help with another project which is basically finishing off for me. If your interested as u seem like a competent programmer please add me on msn @ steve@whitepixeldesign.com Quote Link to comment https://forums.phpfreaks.com/topic/101910-help/#findComment-521579 Share on other sites More sharing options...
AndyB Posted April 19, 2008 Share Posted April 19, 2008 I removed your database details. Don't blame me if someone copied them earlier and your database evaporates. You need to be more careful in the real world. Quote Link to comment https://forums.phpfreaks.com/topic/101910-help/#findComment-521623 Share on other sites More sharing options...
dezkit Posted April 20, 2008 Share Posted April 20, 2008 original boy, change your mysql password AS SOON AS POSSIBLE. Quote Link to comment https://forums.phpfreaks.com/topic/101910-help/#findComment-521633 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.