Blank page returned from PHP execution

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
IGS6764
-


Joined: 21 Apr 2005
Posts: 3

PostPosted: Thu Apr 21, 2005 8:10 pm    Post subject: Blank page returned from PHP execution Reply with quote

Hi all...running Abyss with PHP5, MySQL 4.1.1....my index.html is calling a php file called tradeleads_view.php. Tradeleads_view.php includes a lib.php and datalist.php for database connections, etc. I can connect to the db as I see the session open in SQLyog Admin...but the page comes back blank

Index.html
Code:

<style type=text/css><!--

.Caption {font-family:arial; font-weight:bold; font-size:18px; color:navy; text-decoration:none;}

.Caption:hover {color:red; text-decoration:underline;}

--></style>



<html><div style='text-align:center;'><table>

<tr><td><a href="tradelead_view.php"><img src=table.gif border=0></a></td><td class=Caption><a href="tradelead_view.php" class=Caption>tradelead</a></td></tr>
</table><br></div></html>


tradelead_view.php
Code:

<?php


   include("./language.php");
   include("./lib.php");
   include("./tradelead_dml.php");
   
   $x = new DataList;
   if($HTTP_POST_VARS["Filter_x"] != "")
   {
      // Query used in filters page
      $x->Query = "select tradelead.CONTACTNAME as 'CONTACTNAME', tradelead.EXPIRATIONDATE as 'EXPIRATIONDATE', tradelead.CONTACTID as 'CONTACTID', tradelead.OPPORTUNITYID as 'OPPORTUNITYID', tradelead.TRADELEADPK as 'TRADELEADPK' from tradelead";
   }
   else
   {
      // Query used in table view
      $x->Query = "select tradelead.CONTACTNAME as 'CONTACTNAME', tradelead.EXPIRATIONDATE as 'EXPIRATIONDATE', tradelead.CONTACTID as 'CONTACTID', tradelead.OPPORTUNITYID as 'OPPORTUNITYID', tradelead.TRADELEADPK as 'TRADELEADPK' from tradelead";
   }
   $x->DataHeight = 150;
   $x->AllowSelection = 1;
   $x->AllowDelete = 1;
   $x->AllowInsert = 1;
   $x->AllowUpdate = 1;
   $x->AllowFilters = 1;
   $x->AllowSorting = 1;
   $x->AllowNavigation = 1;
   $x->AllowPrinting = 1;
   $x->HideTableView = 0;
   $x->RecordsPerPage = 10;
   $x->QuickSearch = 0;
   $x->QuickSearchText = $Translation["quick search"];
   $x->ScriptFileName = "tradelead_view.php";
   $x->TableTitle = "tradelead";
   $x->PrimaryKey = "tradelead.TRADELEADPK";
   $x->ColWidth[] = 150;
   $x->ColWidth[] = 150;
   $x->ColWidth[] = 150;
   $x->ColWidth[] = 150;
   $x->Render();
   
   include("./header.php");
   echo $x->HTML;
   include("./footer.php");
?>


lib.php
Code:

<?php


error_reporting(E_ALL ^ E_NOTICE);
include("./datalist.php");

function sql($statment)
{
   
   global $Translation;
   
      $dbhost = "http://127.0.0.1:3306";
      $dbuser = "sf1";
      $dbpass = "integrate";
      $dbname = "iwdemo";
      
      /****** Connect to MySQL ******/
      if(!@mysql_connect($dbhost, $dbuser, $dbpass))
      {
         echo StyleSheet() . "\n\n<div class=Error>";
         echo $Translation["error:"] . mysql_error();
         echo "</div>";
         exit;
      }
      /****** Select DB ********/
      if(!@mysql_select_db($dbname))
      {
         echo StyleSheet() . "\n\n<div class=Error>";
         echo $Translation["error:"] . mysql_error();
         echo $Translation["if you haven't set up"];
         echo "</div>";
         exit;
      }
   
   if(!$result = mysql_query($statment))
   {
         echo StyleSheet() . "\n\n<div class=Error>";
      echo "<br><b>" . $Translation["sql error:"] . "</b><br><br>
           <strong>" . $Translation["query:"] . "</strong><br> $statment<br><br>
           " . mysql_error();
         if(stristr($statment, "select ")) echo ".<br>" . $Translation["if you haven't set up"];
         echo "</div>";
         echo "<a href=\"javascript:history.go(-1);\">" . $Translation["< back"] . "</a>";
      exit;
   }
   return $result;
}

function NavMenus()
{
   global $Translation;

   $t = time();
   $menu  = "<select name=nav_menu onChange='window.location=document.myform.nav_menu.options[document.myform.nav_menu.selectedIndex].value;'>";
   $menu .= "<option value='#' class=SelectedOption style='color:black;'>" . $Translation["select a table"] . "</option>";
   $menu .= "<option value='tradelead_view.php?t=$t' class=SelectedOption>tradelead</option>";
   $menu .= "</select>";
   return $menu;
}

function StyleSheet()
{
   return "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">";
}
?>


tradelead_dlm.php
Code:

<?php

// Data functions for table tradelead


function insert()
{
   global $HTTP_SERVER_VARS, $HTTP_GET_VARS, $HTTP_POST_VARS, $Translation;
   
   if(get_magic_quotes_gpc())
   {
      $CONTACTNAME = $HTTP_POST_VARS["CONTACTNAME"];
      $EXPIRATIONDATE = $HTTP_POST_VARS["EXPIRATIONDATE"];
      $CONTACTID = $HTTP_POST_VARS["CONTACTID"];
      $OPPORTUNITYID = $HTTP_POST_VARS["OPPORTUNITYID"];
   }
   else
   {
      $CONTACTNAME = addslashes($HTTP_POST_VARS["CONTACTNAME"]);
      $EXPIRATIONDATE = addslashes($HTTP_POST_VARS["EXPIRATIONDATE"]);
      $CONTACTID = addslashes($HTTP_POST_VARS["CONTACTID"]);
      $OPPORTUNITYID = addslashes($HTTP_POST_VARS["OPPORTUNITYID"]);
   }
   
   sql("insert into tradelead (CONTACTNAME, EXPIRATIONDATE, CONTACTID, OPPORTUNITYID) values (" . (($CONTACTNAME != "") ? "'$CONTACTNAME'" : "NULL") . ", " . (($EXPIRATIONDATE != "") ? "'$EXPIRATIONDATE'" : "NULL") . ", " . (($CONTACTID != "") ? "'$CONTACTID'" : "NULL") . "," . (($OPPORTUNITYID != "") ? "'$OPPORTUNITYID'" : "NULL") . ")" );
   return mysql_insert_id();
}

function delete($selected_id)
{
   // insure referential integrity ...
   global $Translation;

   sql("delete from tradelead where TRADELEADPK='$selected_id'");
}

function update($selected_id)
{
   global $HTTP_SERVER_VARS, $HTTP_GET_VARS, $HTTP_POST_VARS, $Translation;
   
   if(get_magic_quotes_gpc())
   {
      $CONTACTNAME = $HTTP_POST_VARS["CONTACTNAME"];
      $EXPIRATIONDATE = $HTTP_POST_VARS["EXPIRATIONDATE"];
      $CONTACTID = $HTTP_POST_VARS["CONTACTID"];
      $OPPORTUNITY = $HTTP_POST_VARS["OPPORTUNITYID"];
   }
   else
   {
      $CONTACTNAME = addslashes($HTTP_POST_VARS["CONTACTNAME"]);
      $EXPIRATIONDATE = addslashes($HTTP_POST_VARS["EXPIRATIONDATE"]);
      $CONTACTID = addslashes($HTTP_POST_VARS["CONTACTID"]);
      $OPPORTUNITYID = addslashes($HTTP_POST_VARS["OPPORTUNITYID"]);
   }

   sql("update tradelead set CONTACTNAME=" . (($CONTACTNAME != "") ? "'$CONTACTNAME'" : "NULL") . ", EXPIRATIONDATE=" . (($EXPIRATIONDATE != "") ? "'$EXPIRATIONDATE'" : "NULL") . ", CONTACTID=" . (($CONTACTID != "") ? "'$CONTACTID'" : "NULL") . ", OPPORTUNITYID=" . (($OPPPORTUNITYID != "") ? "'$OPPORTUNITYID'" : "NULL") . ",  where TRADELEADPK='$selected_id'");
}

function form($selected_id = "", $AllowUpdate = 1, $AllowInsert = 1, $AllowDelete = 1)
{
   // function to return an editable form for a table records
   // and fill it with data of record whose ID is $selected_id. If $selected_id
   // is empty, an empty form is shown, with only an 'Add New'
   // button displayed.
   
   global $Translation;
   
   $code = "<br><table border=1 bordercolor=navy cellpadding=0 cellspacing=0><tr><td><div class=TableTitle>Detail View</div></td></tr><tr><td><table>";
   $code .= "\n\t<tr><td colspan=2></td><td rowspan=7 valign=top>";
   if($AllowInsert)
      $code .= "<div><input type=image src=insert.gif name=insert alt='" . $Translation["add new record"] . "'></div>";
   

   if($selected_id)
   {
      $res = sql("select * from tradelead where TRADELEADPK='$selected_id'");
      $row = mysql_fetch_object($res);

      $code .= "<br>";
      if($AllowUpdate)
         $code .= "<div><input type=image src=update.gif name=update alt='" . $Translation["update record"] . "'></div>";
      if($AllowDelete)
         $code .= "<div><input type=image src=delete.gif name=delete alt='" . $Translation["delete record"] . "' onclick='return confirm(\"" . $Translation["are you sure?"] . "\");'></div>";
      $code .= "<div><input type=image src=cancel_search.gif name=deselect alt='" . $Translation["deselect record"] . "'></div>";
   }

   $code .= "</td></tr>";


   // Detail view form fields
   $code .= "\n\t<tr><td class=TableHeader valign=top><div class=TableHeader style='text-align:right;'>CONTACTNAME</div></td><td class=TableBody><textarea class=TextBox name=CONTACTNAME cols=50 rows=2>$row->CONTACTNAME</textarea>&nbsp;&nbsp;</td></tr>";
   $code .= "\n\t<tr><td class=TableHeader valign=top><div class=TableHeader style='text-align:right;'>EXPIRATIONDATE</div></td><td class=TableBody><input size=10 type=text class=TextBox name=EXPIRATIONDATE value='$row->EXPIRATIONDATE'>&nbsp;&nbsp;</td></tr>";
   $code .= "\n\t<tr><td class=TableHeader valign=top><div class=TableHeader style='text-align:right;'>CONTACTID</div></td><td class=TableBody><input size= 18 type=text class=TextBox name=CONTACTID value='$row->CONTACTID'>&nbsp;&nbsp;</td></tr>";
   $code .= "\n\t<tr><td class=TableHeader valign=top><div class=TableHeader style='text-align:right;'>OPPORTUNITYID</div></td><td class=TableBody><input size= 18 type=text class=TextBox name=OPPORTUNITYID value='$row->OPPORTUNITYID'>&nbsp;&nbsp;</td></tr>";
   $code .= "\n\t<tr><td class=TableHeader valign=top><div class=TableHeader style='text-align:right;'>TRADELEADPK</div></td><td class=TableBody>$row->TRADELEADPK&nbsp;&nbsp;</td></tr>";

   $code .= "</table></td></tr></table>";

   return $code;
}
?>


I know it's a lot to swallow, but I have the server configured right for PHP use, the only published folder is the one I'm testing from...

Any insight would be appreciated..

Thx,

IGS
Back to top View user's profile Send private message
IGS6764
-


Joined: 21 Apr 2005
Posts: 3

PostPosted: Thu Apr 21, 2005 10:05 pm    Post subject: NEVER MIND__ Reply with quote

I had the error suppression on...@mysql_connect

There is no login....see my other post please
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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 phpBB Group