php file works fine but not when it's run from a link, why?
Posted: Sun Jan 04, 2004 11:00 am
i have this very simple html code stored in show.html file.
the showdata.php looks like this:
When i click "Show All Entries" link from show.html file it gives me following output:
I just do not understand how come the same showdata.php file gives me the desired output when i run it from http://localhost/showdata.php??!!!
Any clue?
[Edit: Added PHP and CODE tags for eyecandy. --JAM]
Code: Select all
a href="G:\Apache\htdocs/showdata.php">Show All Entries</a>Code: Select all
<html>
<head><title>Show Book List in Library Stock</title></head>
<body>
<h3>List Of Available Books</h1>
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("library",$db);
$result = mysql_query("SELECT * FROM book",$db);
echo "<table border=2>\n";
echo "<tr><td>call_no</td><td>title</td><td>author1</td><td>author2</td><td>publisher</td><td>isbn</td><td>price</td><td>no_of_page</td><td>edition</td><td>category</td></tr>\n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
$myrow[0], $myrow[1], $myrow[2],$myrow[3],$myrow[4],$myrow[5], $myrow[6],$myrow[7],$myrow[8],$myrow[9]);
}
echo "</table>\n";
?>
</body>
</html>When i click "Show All Entries" link from show.html file it gives me following output:
Code: Select all
List Of Available Books
%s%s%s%s%s%s%s%s%s%s\n", $myrowї0], $myrowї1], $myrowї2],$myrowї3],$myrowї4],$myrowї5], $myrowї6],$myrowї7],$myrowї8],$myrowї9]); } echo "\n"; ?>Any clue?
[Edit: Added PHP and CODE tags for eyecandy. --JAM]
