Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> MySQL
Author Message
nuken
RavenNuke(tm) Development Team



Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Mon Sep 21, 2009 4:19 pm Reply with quote

I'm have a problem getting this function to send the info to the database. When it's submitted, It just returns a blank page. Not errors in the error log. If I manually add the info into the database, it works fine. Any Ideas?


Code:
function NukeCCustomContentSubmit($cptitle,$cpcontent,$cpstatus,$cplanguage) {

   global $nukecprefix,$db;
   if (($cptitle == "") or ($cpcontent == "")) {
      global $adsbgcolor1, $adsbgcolor2, $adsbgcolor3, $adsbgcolor4, $adsbgcolor5;
      include ("header.php");
      GraphicAdmin();
      OpenTable();
      NukeCAdminMenu();
      CustomContentheaderAdmin();
      echo "<br />";
      echo "<table align=\"center\" width=\"95%\" cellspacing=\"1\" cellpadding=\"2\" border=\"0\" bgcolor=\"".$adsbgcolor1."\"><tr><td bgcolor=\"".$adsbgcolor5."\" align=\"center\">";
      if ($cptitle == "") {
         echo "Title is Required<br />";
      }
      if ($cpcontent == "") {
         echo "Custom Content is required<br />";
      }
      echo "<br />The form is not complete, please click on back and complete the form";
      echo "<br /><a href=\"javascript:history.back(-1);\">Back</a>";
      echo "</td></tr></table>";
      CloseTable();
      include ("footer.php");
   } else {
      if ($cpstatus) {
         $cpstatus = 1;
      } else {
         $cpstatus = 0;
      }
      $cptitle = stripslashes(FixQuotes($cptitle));
       $cpcontent = stripslashes(FixQuotes($cpcontent));
      $resultweight = $db->sql_query("select MAX(weight) from ".$nukecprefix."_ads_custom");
      list($cpweight) = $db->sql_fetchrow($resultweight);
      $cpweight = $cpweight + 1;
      $sqlinsert = "insert into ".$nukecprefix."_ads_custom values ('','$cptitle','$cpcontent','$cpweight','$cpstatus','$cplanguage',NOW())";
      $db->sql_query($sqlinsert);
      $msg = "CPadded";
      header("location: admin.php?op=NukeC30CustomContent&msg_id=$msg");
   }
}

_________________
Tricked Out News 
View user's profile Send private message Send e-mail Visit poster's website
floppydrivez
Involved
Involved



Joined: Feb 26, 2006
Posts: 340
Location: Jackson, Mississippi

PostPosted: Mon Sep 21, 2009 5:23 pm Reply with quote

I assume you have display errors set to true. Most of the time an sql error doesn't cause a blank page. That is usually a syntax error.

All the same I integrated some sql checking just in case.

Code:
function NukeCCustomContentSubmit($cptitle,$cpcontent,$cpstatus,$cplanguage) {

   global $nukecprefix,$db;
   if (($cptitle == "") or ($cpcontent == "")) {
      global $adsbgcolor1, $adsbgcolor2, $adsbgcolor3, $adsbgcolor4, $adsbgcolor5;
      include ("header.php");
      GraphicAdmin();
      OpenTable();
      NukeCAdminMenu();
      CustomContentheaderAdmin();
      echo "<br />";
      echo "<table align=\"center\" width=\"95%\" cellspacing=\"1\" cellpadding=\"2\" border=\"0\" bgcolor=\"".$adsbgcolor1."\"><tr><td bgcolor=\"".$adsbgcolor5."\" align=\"center\">";
      if ($cptitle == "") {
         echo "Title is Required<br />";
      }
      if ($cpcontent == "") {
         echo "Custom Content is required<br />";
      }
      echo "<br />The form is not complete, please click on back and complete the form";
      echo "<br /><a href=\"javascript:history.back(-1);\">Back</a>";
      echo "</td></tr></table>";
      CloseTable();
      include ("footer.php");
   } else {
      if ($cpstatus) {
         $cpstatus = 1;
      } else {
         $cpstatus = 0;
      }
      $cptitle = stripslashes(FixQuotes($cptitle));
      $cpcontent = stripslashes(FixQuotes($cpcontent));
      $resultweight = $db->sql_query("select MAX(weight) from ".$nukecprefix."_ads_custom");
      list($cpweight) = $db->sql_fetchrow($resultweight);
      $cpweight = $cpweight + 1;
      $sqlinsert = "insert into ".$nukecprefix."_ads_custom values (NULL,'$cptitle','$cpcontent','$cpweight','$cpstatus','$cplanguage',NOW())";
      $db->sql_query($sqlinsert);
      //Floppy (I changed '' to NULL in the above line an assumption)
      if(mysql_error()){
         echo mysql_error();
         die();
      }
      //End Floppy
      $msg = "CPadded";
      header("location: admin.php?op=NukeC30CustomContent&msg_id=$msg");
   }
}


You can also take the code out of the function and see where that gets you. Once you get it working, put it back and see where you stand.

_________________
Phpnuke Downloads, Clan Themes, Mack Hankins 
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
nuken







PostPosted: Mon Sep 21, 2009 6:06 pm Reply with quote

Thanks. Still the same. I think I need to sleep on it. The lines are starting to get all wiggly...
 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Tue Sep 22, 2009 7:00 am Reply with quote

You may need to echo out the $sqlinsert variable and make sure the SQL syntax is right?

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> MySQL

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 ©