Jump to content

Correct this please


nadman123

Recommended Posts

$query="SELECT * FROM Property ORDER BY PROPERTY_ID WHERE Property_suburb LIKE '%{$_POST['search']}%";

 

 

when i try this i get this error message

 

Warning: oci_parse() [function.oci-parse]: ORA-01756: quoted string not properly terminated in e:\inetpub\students\fit2028\21400644\ass2\property.php on line 144

 

Warning: oci_execute() expects parameter 1 to be resource, boolean given in e:\inetpub\students\fit2028\21400644\ass2\property.php on line 145

 

Warning: oci_fetch_array() expects parameter 1 to be resource, boolean given in e:\inetpub\students\fit2028\21400644\ass2\property.php on line 148

Link to comment
https://forums.phpfreaks.com/topic/127633-correct-this-please/#findComment-660463
Share on other sites

Ok here you go its a bit long code man...

<?php

session_start();


if (!isset($_SESSION['basic_is_logged_in'])
    || $_SESSION['basic_is_logged_in'] !== true) {

   
    header('Location: login.php');
    exit;
}
?>
<?php
  ob_start();
  include("connection.php"); 
        $conn = oci_connect($UName,$PWord,$DB)
              or die("Couldn't logon to the database.");


?>
<html>
<head><title>Property Details</title>
    <link rel="stylesheet" href="stylesheet.css"
                           type = "text/css" /></head>
<body>
  <center><h2>Property Details</h2></center>
<form method="post" action="property.php?Action=Search">
<input type="text" name="search" size="50"/><input type="submit" value="Search"/></form>
<a style="text-decoration:none" href="addProperty.php"><input type = "button" value="New Property"></a>
  
<?php
  if(empty($_GET["Action"]))
  {
    $strAction = "Display";
  }
  else
  {
    $strAction = $_GET["Action"];
  }

  switch($strAction)
  {
    case "Display":
      $query="SELECT * FROM Property ORDER BY PROPERTY_ID";
        $stmt = oci_parse($conn, $query);
        oci_execute($stmt); 
?>
<?php
      while ($row = oci_fetch_array ($stmt))
      {
?>
       <table><tr><table width="50%">  
        <tr><td rowspan="8"width ="25%"><a href='uploads/<?php echo $row["PROPERTY_IMAGE"]; ?>'><img src="uploads/<?php echo $row["PROPERTY_IMAGE"]; ?>"width="200" height="150"/></a></td><td><b>Property ID</b></td><td><b><?php echo $row["PROPERTY_ID"]; ?></b></td></tr>
        <tr><td><b>Street</b></td><td><?php echo $row["PROPERTY_STREET"]; ?></td></tr>
         <tr><td><b>Suburb</b></td><td><?php echo $row["PROPERTY_SUBURB"]; ?></td></tr>
         <tr><td><b>State</b></td><td><?php echo $row["PROPERTY_STATE"]; ?></td></tr>
         <tr><td><b>Post Code</b></td><td><?php echo $row["PROPERTY_POSTCODE"]; ?></td></tr>
         <tr><td><b>Price</b></td><td>$<?php echo $row["PROPERTY_PRICE"]; ?></td></tr>
         <tr><td><b>Type of property</b></td><td><?php echo $row["PROPERTY_TYPE"]; ?></td></tr>
            <tr><td>
                
<a style="text-decoration:none" href="PropertyModify.php?Property_id= <?php echo $row["PROPERTY_ID"]; ?> &Action=Update"><input type="button" value="Update"></a>

            
            
                
<a style="text-decoration:none" href="PropertyModify.php?Property_id= <?php echo $row["PROPERTY_ID"]; ?> &Action=Delete"><input type="button" value="Delete"></a>

            </td>
        </tr><tr></tr></table></tr><tr></tr></table>
<?php
      }
?>
     
      <form method="post" action="property.php?Action=CreateXML">
        
          <input type="submit" value="Create XML Document">
       
      </form>
<?php
      if(isset($_GET["XML"]))
      {
        echo "<a href='customers.xml' target='_blank'>
          View XML Document</a>";
      }
      oci_free_statement($stmt);

    break;

    case "CreateXML":
      $query="SELECT * FROM Property";
      $stmt = oci_parse($conn,$query);
      oci_execute($stmt);
      $nrows = oci_fetch_all($stmt,$results);

      if ($nrows> 0)
      {
        $doc = new DOMDocument('1.0');
        $doc->formatOutput = true;
        $properties = $doc->createElement('properties');
        $doc->appendChild($properties);
        for ($i = 0; $i<$nrows; $i++)
        {
          $property_record = 
            $doc->createElement('property_record');
          $properties->appendChild($property_record);
          reset($results);
          while (list($column_name,$column_value) = 
            each($results))
          {
            $each_column_name = 
              $doc->createElement(strtolower($column_name));
            $property_record->appendChild($each_column_name);
            $each_column_value = 
              $doc->createTextNode($column_value[$i]);
            $each_column_name->appendChild($each_column_value);
          }
        }
        $fp = @fopen('properties.xml','w');
        if(!$fp)
        {
          die('Error cannot create XML file');
        }
        else
        {
          $doc->save('customers.xml');
          fclose($fp);
          header("Location: property.php?XML=OK");
        }
      }
      else
      {
        echo "No Records found";
      }
      oci_free_statement($stmt);
    break;
   case "Search":
   $query=SELECT * FROM Property ORDER BY PROPERTY_ID WHERE Property_suburb LIKE '%{$_POST['search']}%'";
        $stmt = oci_parse($conn, $query);
        oci_execute($stmt);

      while ($row = oci_fetch_array ($stmt))
      {
?>
       <table><tr><table width="50%">  
        <tr><td rowspan="8"width ="25%"><a href='uploads/<?php echo $row["PROPERTY_IMAGE"]; ?>'><img src="uploads/<?php echo $row["PROPERTY_IMAGE"]; ?>"width="200" height="150"/></a></td><td><b>Property ID</b></td><td><b><?php echo $row["PROPERTY_ID"]; ?></b></td></tr>
        <tr><td><b>Street</b></td><td><?php echo $row["PROPERTY_STREET"]; ?></td></tr>
         <tr><td><b>Suburb</b></td><td><?php echo $row["PROPERTY_SUBURB"]; ?></td></tr>
         <tr><td><b>State</b></td><td><?php echo $row["PROPERTY_STATE"]; ?></td></tr>
         <tr><td><b>Post Code</b></td><td><?php echo $row["PROPERTY_POSTCODE"]; ?></td></tr>
         <tr><td><b>Price</b></td><td>$<?php echo $row["PROPERTY_PRICE"]; ?></td></tr>
         <tr><td><b>Type of property</b></td><td><?php echo $row["PROPERTY_TYPE"]; ?></td></tr>
            <tr><td>
                
<a style="text-decoration:none" href="PropertyModify.php?Property_id= <?php echo $row["PROPERTY_ID"]; ?> &Action=Update"><input type="button" value="Update"></a>

            
            
                
<a style="text-decoration:none" href="PropertyModify.php?Property_id= <?php echo $row["PROPERTY_ID"]; ?> &Action=Delete"><input type="button" value="Delete"></a>

            </td>
        </tr><tr></tr></table></tr><tr></tr></table>
<?php
      }

break;



?>

<?php 

}
oci_close($conn);
?>
<a href="DisplaySource.php?filename=property.php"><img src="images/codebuttonproperty.jpg"/></a> 
</body>
</html>

 

I guess the error comes at case: Search

i.e as soon as I hit the button search....

Link to comment
https://forums.phpfreaks.com/topic/127633-correct-this-please/#findComment-660572
Share on other sites

I'm not really sure, I did a google search for you and found this link: microsoft CGI header error

 

Are you using another CGI script you're aware of?  If you are, they said put this in it.

 

   print "HTTP/1.0 200 OK\n";
   print "Content-Type: text/html\n\n\n";

 

I could be entirely wrong...

Link to comment
https://forums.phpfreaks.com/topic/127633-correct-this-please/#findComment-660577
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.