- Readme First! - Read and follow the rules, otherwise your posts will be closed
There are currently, 68 guest(s) and 1 member(s) that are online. You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - Write to Table Field [ ]
Author
Message
Odolan_
Nuke Cadet
Joined: Jul 07, 2003
Posts: 9
Posted:
Mon Jul 07, 2003 2:20 am
Sup.
I'd like to add an extra input field in my admin downloads which would write to specific table field. There for i created another table field in .$prefix."_downloads_downloads and added extra input named "stream" in admin/modules/downloads.php
I added this new field in function DownloadsAddDownload and modified case "DownloadsAddDownload".
But now iam not able to add anything after creating this new table field.
Am I missing something?
Tnx in advance.
MisterWORK
Support Mod
Joined: Jun 11, 2003
Posts: 245
Posted:
Mon Jul 07, 2003 3:57 am
Paste the modified code here im sure that there is just a ' missing somewhere
Odolan_
Nuke Cadet
Joined: Jul 07, 2003
Posts: 9
Posted:
Mon Jul 07, 2003 4:22 am
k, tnx for a fast response
Here is my form echo:
Code:
.""._STREAM.": <input type=\"text\" name=\"stream\" size=\"50\" maxlength=\"100\"><br>"
Here is modification i made in function DownloadsAddDownload:
Code:
function DownloadsAddDownload($new, $lid, $title, $url, $cat, $description, $stream, $name, $email, $submitter, $filesize, $version, $homepage, $hits) {
global $prefix, $dbi;
$result = sql_query("select url from ".$prefix."_downloads_downloads where url='$url'", $dbi);
$numrows = sql_num_rows($result, $dbi);
if ($numrows>0) {
include("header.php");
And the case:
Code:
case "DownloadsAddDownload":
DownloadsAddDownload($new, $lid, $title, $url, $cat, $description, $stream, $name, $email, $submitter, $filesize, $version, $homepage, $hits);
break;
"stream" is the table field name.
So, what could be missing here?
MisterWORK
Support Mod
Joined: Jun 11, 2003
Posts: 245
Posted:
Mon Jul 07, 2003 4:38 am
I only see the " sql_query("select ...."
if you want to add a value must I see the insert code
like sql_query("instert into .....
Odolan_
Nuke Cadet
Joined: Jul 07, 2003
Posts: 9
Posted:
Mon Jul 07, 2003 5:50 am
oh, i totally overlooked that
inserted the value into INSERT query and its working!!!
And how could i check it?
i mean if i have several extra fields (5 or 6) should i write each script for each field to check?
Like :
Code:
/* Check if URL exist */
if ($url=="") {
include("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>"._WEBDOWNLOADSADMIN."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<br><center>"
."<font class=\"content\">"
."<b>"._ERRORNOURL."</b><br><br>"
.""._GOBACK."<br><br>";
CloseTable();
include("footer.php");
}
or can i do it with several if statements under each other?
MisterWORK
Support Mod
Joined: Jun 11, 2003
Posts: 245
Posted:
Mon Jul 07, 2003 6:45 am
Quote:
or can i do it with several if statements under each other?
Yes if you want every field to be "required" before a download can be added.
ie:
[php:1:e62c2b44b9]
/* Check if URL exist */
if ($url=="") {
include("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>"._WEBDOWNLOADSADMIN."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<br><center>"
."<font class=\"content\">"
."<b>"._ERRORNOURL."</b><br><br>"
.""._GOBACK."<br><br>";
CloseTable();
include("footer.php");
}
/* Check if stream exist */
if ($stream=="") {
include("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>"._WEBDOWNLOADSADMIN."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<br><center>"
."<font class=\"content\">"
."<b>"._ERRORNOURL."</b><br><br>"
.""._GOBACK."<br><br>";
CloseTable();
include("footer.php");
}
[/php:1:e62c2b44b9]
The code above
[php:1:e62c2b44b9]
"._ERRORNOURL."
[/php:1:e62c2b44b9]
Must be replased whit ie:
[php:1:e62c2b44b9]
"._ERRORNOSTREAM."
[/php:1:e62c2b44b9]
And then in the language file located in your /admin/language/ dir add a row like
[php:1:e62c2b44b9]
define("_ERRORNOSTREAM","ERROR: You need to type a STREAM!");
[/php:1:e62c2b44b9]
and so on for each if() statement you are adding...
Odolan_
Nuke Cadet
Joined: Jul 07, 2003
Posts: 9
Posted:
Mon Jul 07, 2003 10:08 am
this way wouldnt work, ive tried it, "stream" value wont be checked.
Its logical, because
will only check if input form is not null (not empty).
Its somewhere else.
/* Check if URL exist */ doesnt make sence in this case!
MisterWORK
Support Mod
Joined: Jun 11, 2003
Posts: 245
Posted:
Tue Jul 08, 2003 10:30 pm
I will check in the file hows it's build and then ill be back...
But im at work atm so later on today my time....
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum