You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 66 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 [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
Odolan_
Nuke Cadet
Nuke Cadet


Joined: Jul 07, 2003
Posts: 9


PostPosted: Mon Jul 07, 2003 2:20 am Reply with quoteBack to top

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.
Find all posts by Odolan_View user's profileSend private message
MisterWORK
Support Mod
Support Mod


Joined: Jun 11, 2003
Posts: 245


PostPosted: Mon Jul 07, 2003 3:57 am Reply with quoteBack to top

Paste the modified code here im sure that there is just a ' missing somewhere Very Happy
Find all posts by MisterWORKView user's profileSend private messageSend e-mailVisit poster's website
Odolan_
Nuke Cadet
Nuke Cadet


Joined: Jul 07, 2003
Posts: 9


PostPosted: Mon Jul 07, 2003 4:22 am Reply with quoteBack to top

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? Question
Find all posts by Odolan_View user's profileSend private message
MisterWORK
Support Mod
Support Mod


Joined: Jun 11, 2003
Posts: 245


PostPosted: Mon Jul 07, 2003 4:38 am Reply with quoteBack to top

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 .....
Find all posts by MisterWORKView user's profileSend private messageSend e-mailVisit poster's website
Odolan_
Nuke Cadet
Nuke Cadet


Joined: Jul 07, 2003
Posts: 9


PostPosted: Mon Jul 07, 2003 5:50 am Reply with quoteBack to top

oh, i totally overlooked that Embarassed
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?
Find all posts by Odolan_View user's profileSend private message
MisterWORK
Support Mod
Support Mod


Joined: Jun 11, 2003
Posts: 245


PostPosted: Mon Jul 07, 2003 6:45 am Reply with quoteBack to top

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...
Find all posts by MisterWORKView user's profileSend private messageSend e-mailVisit poster's website
Odolan_
Nuke Cadet
Nuke Cadet


Joined: Jul 07, 2003
Posts: 9


PostPosted: Mon Jul 07, 2003 10:08 am Reply with quoteBack to top

this way wouldnt work, ive tried it, "stream" value wont be checked.

Its logical, because

Code:
if ($url=="") {


will only check if input form is not null (not empty).

Its somewhere else.

/* Check if URL exist */ doesnt make sence in this case!
Find all posts by Odolan_View user's profileSend private message
MisterWORK
Support Mod
Support Mod


Joined: Jun 11, 2003
Posts: 245


PostPosted: Tue Jul 08, 2003 10:30 pm Reply with quoteBack to top

I will check in the file hows it's build and then ill be back... Very Happy

But im at work atm so later on today my time....
Find all posts by MisterWORKView user's profileSend private messageSend e-mailVisit poster's website
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
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



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by · TOGETHER TEAM srl ITALY http://www.togetherteam.it · DONDELEO E-COMMERCE http://www.DonDeLeo.com
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.216 Seconds - 282 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::