Eg a price field, format (paper, canvas) field, original avaliable field etc
Is it simply a case of adding additional fields after the "descr" row?
// check for table and descriptions
$pics_tbl = $etomite->db.$gtable;
// If gallery table has not been created yet, create it now:
$descvalid = 0; // assume descriptions not supported
$query=mysql_query("DESC $pics_tbl");
if(!$query) {
$sql="CREATE TABLE $pics_tbl (
`id` int(10) unsigned NOT NULL auto_increment,
`gal_id` int(10) unsigned NOT NULL,
`filename` varchar(50) NOT NULL,
`title` text NOT NULL,
`date` datetime NOT NULL,
`descr` text default NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;";
$query1=$etomite->dbQuery($sql);
$descvalid = 1; // they are with this table
}
else {
If so, If I was to check for the existance of additional fields like the //"$descvalid" check would the correct sequencing for checking for these fields be if field a exists (if false, then create a), true, then check field b, if field b exists (false, then create
When calling it, I'm thinking to simply add to the //edit gallery and its pictures, the additional fields in the middle of this...
if($_REQUEST['action']=="edit_pics") { // If "Edit Gallery and its pictures" has been used
for($i=0;$i<$_REQUEST['number'];$i++) {
if($_REQUEST['delete'.$i]=="yes") {
$rs0=$etomite->dbQuery("SELECT id,filename,
[b]***new field here, new field here, new field here,*** [/b]
FROM $pics_tbl WHERE id='" . $_REQUEST['pic_id'.$i] . "'");
$deletepic=$etomite->fetchRow($rs0);
if(file_exists($path_to_gal.$deletepic['filename'])) unlink($path_to_gal.$deletepic['filename']);
if(file_exists($path_to_gal."tn_".$deletepic['filename'])) unlink($path_to_gal . "tn_" . $deletepic['filename']);
$rs1=$etomite->dbQuery("DELETE FROM $pics_tbl WHERE id='" . $_REQUEST['pic_id'.$i] . "'");
}
if($_REQUEST['modified'.$i]=="yes") {
// restructured for clarity and extended MF oct2005
$updateQueryString= "UPDATE ".$pics_tbl." SET ";
$updateQueryString.= "title='".addslashes($_REQUEST['title'.$i])."'"; //add title content
if($keep_date!="yes") $updateQueryString.=",date=NOW()";
if($descvalid==1) $updateQueryString.=", descr='".addslashes($_REQUEST['descr'.$i])."'"; //MF add descr content
[b]****add new fields here to update something like this*****[/b]
if($newfield1==1) $updateQueryString.=", newfield1='".addslashes($_REQUEST['newfield1'.$i])."'"; //Add newfield content
if($newfield2==1) $updateQueryString.=", newfield2='".addslashes($_REQUEST['newfield2'.$i])."'"; //Add newfield content
//etc
$updateQueryString.=" WHERE id='" .$_REQUEST['pic_id'.$i]."'";
$rs2=$etomite->dbQuery( $updateQueryString );
}
}
Then create the additional forms required to enter and post the info in the forms section.
Also, if my understanding is correct, this can be written as a snippet and called in the EtoGal snippet (with a few changes to the original).
I just want to know if I am on the right track. If this question is beyond the scope of this forum, just reply: "too hard"- go and get paid help!
Edited by Cris D., 25 March 2007 - 11:59 AM.












