File: book.php3.txt

package info (click to toggle)
lg-issue50 2-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,880 kB
  • ctags: 157
  • sloc: sh: 47; makefile: 34; perl: 23
file content (37 lines) | stat: -rw-r--r-- 1,327 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?     echo "<HTML>";
       echo "<HEAD><TITLE>Afsilva's Bookmark</title></head>";
       echo "<body bgcolor=white>";
       echo "<IMG SRC=bookmark.jpg><br><br>";

        //Connect to DB server
        mysql_connect(myserver, myusername, mypasword);
        //Connect to Database
        mysql_select_db("mydatabase");
        //Query the database for everything(*) that is on it.
        $result = mysql_query("SELECT * FROM bookmark");

        //mysql_num_rows() returns the number of bookmarks found.
        $rows = mysql_num_rows($result);
        echo "Number of bookmarks:";
        //outputs the number of records (rows)
        echo $rows;
        echo "<br><br>";
        $i=0;
        echo "<a href=sendbook.html>Insert More BookMarks</a>\n<br><br>";
        echo "<table border=1>";

        //This allows you to access the query in a form of an array.
        //The array index is the name of the field of the database.
        while ($row = mysql_fetch_array($result))
        {
             echo "<tr><td>\n";
             // The . operator adds string together.
             echo "<a href=".$row["URL"].">".$row["description"]."</a>\n";
             echo "</td></tr>";
        }
          
	echo"</table>";
        mysql_close();
        echo"<a href=../index.html target=_top>";
        echo "</HTML>";
?>