I am just starting to learn php. I am an ex-CompuSci major, and went far enough to have a decent understaning of programming theory. However, I really haven't written a real program an a while, so my programming understanding has decayed from un-use... :-}
Anyway, I find the fastest way for me to learn a new language is to rip apart other peoples. that said, I am trying to understand the following program from evilwalrus.com.
I tried to visit the website listed in the comment header, but it no longer functions...
anyway, if someone can give me a basic rundown of how this script works, I'd *very* much appreciate it...
I get it that I create a table looking like this:
1 2 3 ... n
title1 title2 title3 ... title n
cnt1 cnt2 cnt3 ... cnt n
hd1 hd2 hd3 ... hd n
but what to I put in the title, content, or header cells?
should I put (x)html code, or links to html code?
is there a character limit in each cell?
if I put in the line:
Code: Select all
echo "$title";
echo "$content";
echo "$heading";Code: Select all
<html>
<head>
<title> ... </title>
</head>Code: Select all
<body>
...Code: Select all
...
</body>
</html>thanks in advance for your help,
J.
Code: Select all
<?
// Copyright 2003 Liam Getreu
// Make a MySQL Database called "db" with a table named "variables" with
three rows ("id", "title", "heading", and "content"). Insert your data.
Then call the page by going variables.php?id=1 etc.
// ENJOY! Need help? Visit http://www.nr1webresource.com.au/
$id = $_GET['id'];
$db = mysql_connect("localhost", "username", "password");
mysql_select_db("db",$db);
$sql="SELECT * FROM variables WHERE id=" . $id;
$result=mysql_query($sql,$db);
$num = mysql_num_rows($result);
$cur = 1;
while ($num >= $cur) {
$row = mysql_fetch_array($result);
$id = $row["id"];
$title = $row["title"];
$content = $row["content"];
$heading = $row["heading"];
echo "What ever vars you want to be outputted";
$cur++;
}
?>