New problem... and was rather pleased that I didn't have any errors...
As you know from the messages above, I want a user to make sure his or her URL is not in the database before adding. So he or she enters the url and if it is in the database, it exhibits the link...
They then have the choice to modify it, if it's not correct.
I thought everything was alright, because the script spits back their modifications, but does not actually correct the info in the database...
Where am I going wrong here? I've checked the script repeatedly against the example in the book, and it looks correct.
Codes below (this goes from link_validation.php [above] to modify.php below then to modify_action.php below.
modify.php
<?
$db_name = "ohrats_net";
$table_name = "links";
$connection = @mysql_connect("localhost", "username", "password")
or die("Couldn't connect.");
$db = @mysql_select_db($db_name, $connection)
or die("Couldn't select database.");
$sql = "SELECT *
FROM $table_name Where site_title = \"$site_title\" ";
$result = @($sql,$connection)
or die("Couldn't execute query.");
while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
$site_title = $row['site_title'];
$url = $row['url'];
$description = $row['description'];
$category = $row['category'];
$subcategory = $row['subcategory'];
$modify_block = "
<form method= \"post\" action=\"modify_action.php\">
<input type =\"hidden\" name=\"id\" value=\"$id\">
<table>
<tr>
<td>Site Title</td>
<td><input type=\"text\" name=\"site_title\" value=\"$site_title\"></td>
</tr>
<tr>
<td>URL</td>
<td><input type=\"text\" name=\"url\" value=\"$url\"></td>
</tr>
<tr>
<td>Description</td>
<td><input type=\"text\" name=\"description\" value=\"$description\"></td>
</tr>
<tr>
<td>Category</td>
<td><input type=\"text\" name=\"category\" value=\"$category\"></td>
</tr>
<tr>
<td>SubCategory</td>
<td><input type=\"text\" name=\"subcategory\" value=\"$subcategory\"></td>
</tr>
<tr>
<td></td>
<td align=\"right\"><input type=\"submit\"></td>
</tr>
</table>
</form>
";
}
?>
<HEAD>
<TITLE>Modify Link Existance</TITLE>
</HEAD>
<BODY>
<?
print("$modify_block");
?>
</BODY>
modify_action.php
<?
$db_name = "ohrats_net";
$table_name = "links";
$connection = @mysql_connect("localhost", "username", "password")
or die("Couldn't connect.");
$db = @mysql_select_db($db_name, $connection)
or die("Couldn't select database.");
$sql = "UPDATE $table_name
SET
site_title = \"$site_title\",
url = \"$url\",
description = \"$description\",
category = \"$category\",
subcategory = \"$subcategory\",
WHERE id = \"$id\"
";
$result = @($sql,$connection)
;
$modify_complete = "
<font face=arial size=2>Your Link has been modified:</font><br> <br><br>
<font face=arial size=2><strong><a href=\"$url\" Target=\"blank\">$site_title</a></strong><br>$description <br>Category: $category/$subcategory<br><br></font>
";
?>
<HEAD>
<TITLE>Modified Link Existance</TITLE>
</HEAD>
<BODY>
<?php
print("$modify_complete");
?>
</BODY>