PHP Web Host - Quality Web Hosting For All PHP Applications Free RavenNuke(tm) Add Ons
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
Tazz
New Member
New Member


Joined: Mar 18, 2004
Posts: 10

PostPosted: Thu Mar 18, 2004 2:12 pm Reply with quote Back to top

Hello, I am new to phpNuke coding, currently trying to pull the info from one table and insert it into another table. Is this possible?

Code:
sql_query("select name, url, description, image, hits, type from ".$prefix."_affiliates_validate where afid='$afid'", $dbi);
   
sql_query("insert into ".$prefix."_affiliates values(NULL, '$name', '$url', '$description', '$image', '$hits', '$type')", $dbi);


Is one of the various codes that I have tried, it pulls in part of it but not all of it, can anyone help me with this?
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Fri Mar 19, 2004 12:06 pm Reply with quote Back to top

When you say it pulls in parts and not all, can you be more descriptive?
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Tazz
New Member
New Member


Joined: Mar 18, 2004
Posts: 10

PostPosted: Fri Mar 19, 2004 2:45 pm Reply with quote Back to top

With that code, the first time I clicked the approve link it actually pulled it all, every time after that it would only pull the $type value.

I mess around with it some more, looking over vairous pages of code and threw together this and so far its working, although I am not sure that it is correctly written.

Code:


function SAffiliatesAprove($afid, $name, $url, $description, $image, $hits, $type, $email) {
   global $prefix, $dbi;
   $result = sql_query("select name, url, description, image, hits, type from ".$prefix."_affiliates_validate", $dbi);
   while(list($name, $url, $description, $image, $hits, $type) = sql_fetch_row($result, $dbi))
   sql_query("insert into ".$prefix."_affiliates values(NULL, '$name', '$url', '$description', '$image', '$hits', '$type')", $dbi);
   sql_query("delete from ".$prefix."_affiliates_validate where afid='$afid'", $dbi);
   Header("Location: admin.php?op=AffiliatesAdmin");
   }



So to sum it up, I have a link set to "Approve" and when called on it reads the values in the affiliates_validate table, and then writes them to the affiliates table, and then drops the original line in the affiliates_validate table. Does this look proper to you?
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Fri Mar 19, 2004 4:08 pm Reply with quote Back to top

Well, I would offer up 2 suggestions. First of all I would not delete w/o checking for a successful insert and secondly, add an exit(); statement after the header statement.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous 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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum