Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
Tazz
New Member
New Member



Joined: Mar 18, 2004
Posts: 10

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

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: 17088

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

When you say it pulls in parts and not all, can you be more descriptive?
 
View user's profile Send private message
Tazz







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

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?
 
Raven







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

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.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©