krepepet Posted June 9, 2009 Share Posted June 9, 2009 <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = ''; $dbname = 'fip'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to database'); $dbselect = mysql_select_db($dbname, $conn); if (!$conn) { echo("ERROR: " . mysql_error() . "\n"); $query = "SELECT fipno, title FROM study"; $result = mysql_query($query); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Examination Alert Through SMS</title> </head> <body> <? echo "<table>"; while(list($fipno, $title)= mysql_fetch_array($result)) { echo "<tr>"; echo "<td>$fipno</td>"; echo "<td>$title</td>"; echo "</tr>"; } echo "</table>"; $dbclose = mysql_close($conn); ?> </body> </html> hi guys, im new with php.. can someone tell me whats the problem with my coding? it tells .. Parse error: parse error in C:\wamp\www\extract.php on line 46 which is at the closing of html </html> thanks.. Link to comment https://forums.phpfreaks.com/topic/161454-solved-newbie-need-help-stuck-in-coding/ Share on other sites More sharing options...
gevans Posted June 9, 2009 Share Posted June 9, 2009 if (!$conn) { echo("ERROR: " . mysql_error() . "\n"); should be if (!$conn) { echo("ERROR: " . mysql_error() . "\n"); } Link to comment https://forums.phpfreaks.com/topic/161454-solved-newbie-need-help-stuck-in-coding/#findComment-852018 Share on other sites More sharing options...
krepepet Posted June 9, 2009 Author Share Posted June 9, 2009 <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = ''; $dbname = 'fip'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to database'); $dbselect = mysql_select_db($dbname, $conn); $query = "SELECT fipno, title FROM study"; $result = mysql_query($query); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Examination Alert Through SMS</title> </head> <body> <? echo "<table>"; while(list($fipno, $title)= mysql_fetch_array($result)) { echo "<tr>"; echo "<td>$fipno</td>"; echo "<td>$title</td>"; echo "</tr>"; } echo "</table>"; $dbclose = mysql_close($conn); ?> </body> </html> hi guys, im new with php.. can someone tell me whats the problem with my coding? it tells .. Parse error: parse error in C:\wamp\www\extract.php on line 46 which is at the closing of html </html> thanks.. ok already delete that part, no more error but it shows nothing..just a blank page.. Link to comment https://forums.phpfreaks.com/topic/161454-solved-newbie-need-help-stuck-in-coding/#findComment-852019 Share on other sites More sharing options...
gevans Posted June 9, 2009 Share Posted June 9, 2009 ini_set('display_errors', 1); ini_set('error_reporting', E_ALL | E_STRICT); put those two lines on the second line of the page, straight after <?php see what errors you get. and check if you;re getting any results from your query Link to comment https://forums.phpfreaks.com/topic/161454-solved-newbie-need-help-stuck-in-coding/#findComment-852029 Share on other sites More sharing options...
krepepet Posted June 9, 2009 Author Share Posted June 9, 2009 ini_set('display_errors', 1); ini_set('error_reporting', E_ALL | E_STRICT); put those two lines on the second line of the page, straight after <?php see what errors you get. and check if you;re getting any results from your query no error.. my query is fine..it produced the desired result.. Link to comment https://forums.phpfreaks.com/topic/161454-solved-newbie-need-help-stuck-in-coding/#findComment-852031 Share on other sites More sharing options...
krepepet Posted June 9, 2009 Author Share Posted June 9, 2009 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Examination Alert Through SMS</title> </head> <body> <?php ini_set('display_errors', 1); ini_set('error_reporting', E_ALL | E_STRICT); $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = ''; $dbname = 'fip'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to database'); $dbselect = mysql_select_db($dbname, $conn); //if (!$conn) { echo("ERROR: " . mysql_error() . "\n"); echo "<table border = '1'>"; $query = "SELECT fipno, title FROM study"; $result = mysql_query($query); while(list($fipno, $title)= mysql_fetch_array($result)){ echo "<tr>"; echo "<td><a href='$fipno.php'>$fipno</td>"; echo "<td><a href='$fipno.php'>$title</td>"; echo "</tr>"; } echo "</table>"; ?> <? $dbclose = mysql_close($conn); ?> </body> </html> solved!. thx gevans Link to comment https://forums.phpfreaks.com/topic/161454-solved-newbie-need-help-stuck-in-coding/#findComment-852044 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.