Jump to content

[SOLVED] Newbie need help :: stuck in coding


krepepet

Recommended Posts

<?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

<?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..

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..

<!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 :D

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.