Jump to content

X0ML

New Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by X0ML

  1. OK, about ready to go postal, as I've been wasting inordinate amounts of time trying to resolve this issue!  If I create basic HTML echo-ed content, PHP works fine.  But if I try to reference any database related syntax, the whole PHP web page breaks!  VERY FRUSTRATING.  This works:

    <?php
    
    // Printing results in HTML
    echo "<html>\n";
    echo "<head>";
    echo "</head>";
    echo "<body bgcolor=\"#CCCCCC\">";
    
    echo "<CENTER><H1>Current Inventory</H1>";
    

    but this blows up and just gives me a white page with nothing!:

    <?php
    
    // Printing results in HTML
    echo "<html>\n";
    echo "<head>";
    echo "</head>";
    echo "<body bgcolor=\"#CCCCCC\">";
    
    echo "<CENTER><H1>Current Inventory</H1>";
    
    
    
    $dbhostip = "192.168.0.10";
    $dbport = "5432";
    $dbname = "testdata";
    $dbuser = "postgres";
    $dbpass = "password1";
    
    $dbconn = pg_connect($dbhostip,$dbport,$dbname,$dbuser,$dbpass);
    
    echo $dbconn;
    if(!$dbconn) {
    	echo "An error has occurred (line 17)\n";
    	exit;
    	}
    
    
    	$result = pg_query($dbconn, "SELECT * FROM inventory");
    	if(!$result){
    	echo "An error has occurred (line 24)\n";
    	exit;
    	}
    	
    $resultCheck = pg_num_rows($result);
    
    	if ($resultCheck > 0) {
    		while ($row = pg_fetch_assoc($result)){
    		echo $row['cid'];			
    		echo $row['item_title'];				
    		}
    
    	}
    ?>

    Any help would be appreciated.  It seems that anything with $whatever causes the issue...

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.