Re: Stuck on db entry from select box...
| From: | Jas | Date: | Fri, 05 Apr 2002 19:15:10 +0000 |
| Subject: | Re: Stuck on db entry from select box... | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-18260@lists.php.net to get a copy of this message | ||
Ok I made the changes you suggested and unfortunately I am getting the same
results... Could not execute query, I manually put entries into the tables
so that the update command would just overwrite the current contents. Here
is my code this far, I think my problem (correct me if I am wrong) lies in
the fact that each of select boxes does not contain a unique name, needless
to say I am stuck:
<?php
$dir_name = "/path/to/images/directory/";
$dir = opendir($dir_name);
$file_list .= "<p><FORM METHOD=\"post\"
ACTION=\"index_done.php3\">
<SELECT NAME=\"files\">";
while ($file_name = readdir($dir)) {
if (($file_name != ".") && ($file_name !="..")) {
$file_list .= "<OPTION VALUE=\"$file_name\"
NAME=\"$file_name\">$file_name</OPTION>";
}
}
$file_list .= "</SELECT><br><br><INPUT TYPE=\"submit\"
NAME=\"submit\"
VALUE=\"select\"></FORM></p>";
closedir($dir);
?>
Select boxes are filled with files from specified folder... then echoed to
screen
<? echo "$file_list"; ?>
Working fine... when user click on image using said select box it links to
this file, code is as follows:
<?php
$db_name = "db_name";
$table_name = "cm_index";
$connection = @mysql_connect("localhost", "user_name", "password") or
die
("Could not connect to database. Please try again later.");
$db = @mysql_select_db("$db_name",$connection) or die ("Could not select
database table. Please try again later.");
$sql = "UPDATE $table_name SET file_name=\"$files\"";
$result = @mysql_query($sql, $connection) or die ("Could not execute query.
Please try again later.");
?>
Still getting could not execute query... sorry about not knowing where I am
going wrong but still new to these advanced functions. Thanks in advance,
Jas