It does give me the following message:
QUOTE
Parse error: syntax error, unexpected $end in /home/alex1985/public_html/mulhim/library_project/test_dir/newjoke.php on line 68
CODE
<?php
$dbcnx = @mysql_connect('localhost', 'root', 'mypasswd');
if (!$dbcnx) {
exit('<p>Unable to connect to the ' .
'database server at this time.</p>');
}
if (!@mysql_select_db('ijdb')) {
exit('<p>Unable to locate the joke ' .
'database at this time.</p>');
}
if (isset($_POST['joketext'])):
// A new joke has been entered
// using the form.
$aid = $_POST['aid'];
$joketext = $_POST['joketext'];
if ($aid == '') {
exit('<p>You must choose an author for this joke. Click ' .
'"Back" and try again.</p>');
}
$sql = "INSERT INTO joke SET
joketext='$joketext',
jokedate=CURDATE(),
authorid='$aid'";
if (@mysql_query($sql)) {
echo '<p>New joke added</p>';
} else {
exit('<p>Error adding new joke: ' . mysql_error() . '</p>');
}
$jid = mysql_insert_id();
if (isset($_POST['cats'])) {
$cats = $_POST['cats'];
} else {
$cats = array();
}
$i = 0; // First index
while ($i < count($cats)) { // While we're not at the end
// process $cats[$i]
++$i; // Increment to the next index
}
$i = 0; // First index
while (isset($cats[$i])) { // While we're not at the end
// process $cats[$i]
++$i; // Increment to the next index
}
for ($i = 0; isset($cats[$i]); ++$i) {
// process $cats[$i]
}
foreach ($cats as $catID) {
// Process $catID
}
$numCats = 0;
foreach ($cats as $catID) {
$sql = "INSERT IGNORE INTO jokecategory
SET jokeid=$jid, categoryid=$catID";
$ok = @mysql_query($sql);
if ($ok) {
$numCats = $numCats + 1;
} else {
echo "<p>Error inserting joke into category $catID: " .
mysql_error() . '</p>';
}
}
?>
<p>Joke was added to <?php echo $numCats; ?> categories.</p>
<p><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Add another
joke</a></p>
<p><a href="jokes.php">Return to joke search</a></p>
<?php
$dbcnx = @mysql_connect('localhost', 'root', 'mypasswd');
if (!$dbcnx) {
exit('<p>Unable to connect to the ' .
'database server at this time.</p>');
}
if (!@mysql_select_db('ijdb')) {
exit('<p>Unable to locate the joke ' .
'database at this time.</p>');
}
if (isset($_POST['joketext'])):
// A new joke has been entered
// using the form.
$aid = $_POST['aid'];
$joketext = $_POST['joketext'];
if ($aid == '') {
exit('<p>You must choose an author for this joke. Click ' .
'"Back" and try again.</p>');
}
$sql = "INSERT INTO joke SET
joketext='$joketext',
jokedate=CURDATE(),
authorid='$aid'";
if (@mysql_query($sql)) {
echo '<p>New joke added</p>';
} else {
exit('<p>Error adding new joke: ' . mysql_error() . '</p>');
}
$jid = mysql_insert_id();
if (isset($_POST['cats'])) {
$cats = $_POST['cats'];
} else {
$cats = array();
}
$i = 0; // First index
while ($i < count($cats)) { // While we're not at the end
// process $cats[$i]
++$i; // Increment to the next index
}
$i = 0; // First index
while (isset($cats[$i])) { // While we're not at the end
// process $cats[$i]
++$i; // Increment to the next index
}
for ($i = 0; isset($cats[$i]); ++$i) {
// process $cats[$i]
}
foreach ($cats as $catID) {
// Process $catID
}
$numCats = 0;
foreach ($cats as $catID) {
$sql = "INSERT IGNORE INTO jokecategory
SET jokeid=$jid, categoryid=$catID";
$ok = @mysql_query($sql);
if ($ok) {
$numCats = $numCats + 1;
} else {
echo "<p>Error inserting joke into category $catID: " .
mysql_error() . '</p>';
}
}
?>
<p>Joke was added to <?php echo $numCats; ?> categories.</p>
<p><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Add another
joke</a></p>
<p><a href="jokes.php">Return to joke search</a></p>
<?php


