Author |
Message |
nuken
RavenNuke(tm) Development Team
Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina
|
Posted:
Mon Sep 21, 2009 4:19 pm |
|
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 |
|
|
|
floppydrivez
Involved
Joined: Feb 26, 2006
Posts: 340
Location: Jackson, Mississippi
|
Posted:
Mon Sep 21, 2009 5:23 pm |
|
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 |
|
|
|
nuken
|
Posted:
Mon Sep 21, 2009 6:06 pm |
|
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
|
Posted:
Tue Sep 22, 2009 7:00 am |
|
|
|
|
|