nadman123 Posted October 9, 2008 Share Posted October 9, 2008 Can any one correct this please!!! $query="SELECT * FROM Property ORDER BY PROPERTY_ID" WHERE Property_suburb like '%.$_POST["search"]%'; Link to comment https://forums.phpfreaks.com/topic/127633-correct-this-please/ Share on other sites More sharing options...
Maq Posted October 9, 2008 Share Posted October 9, 2008 Try: $query="SELECT * FROM Property ORDER BY PROPERTY_ID" WHERE Property_suburb like '$_POST['search']'"; Link to comment https://forums.phpfreaks.com/topic/127633-correct-this-please/#findComment-660435 Share on other sites More sharing options...
trq Posted October 9, 2008 Share Posted October 9, 2008 $query="SELECT * FROM Property ORDER BY PROPERTY_ID WHERE Property_suburb LIKE '%{$_POST['search']}%"; Really bad form to have an unclean $_POST variable within a query like that though. Link to comment https://forums.phpfreaks.com/topic/127633-correct-this-please/#findComment-660436 Share on other sites More sharing options...
nadman123 Posted October 9, 2008 Author Share Posted October 9, 2008 $query="SELECT * FROM Property ORDER BY PROPERTY_ID WHERE Property_suburb LIKE '%{$_POST['search']}%"; Really bad form to have an unclean $_POST variable within a query like that though. so do ypu have any other alternative... Link to comment https://forums.phpfreaks.com/topic/127633-correct-this-please/#findComment-660456 Share on other sites More sharing options...
Maq Posted October 9, 2008 Share Posted October 9, 2008 Correct me if I'm wrong, but I think you're forgetting a single quote towards the end: $query="SELECT * FROM Property ORDER BY PROPERTY_ID WHERE Property_suburb LIKE '%{$_POST['search']}%'"; Link to comment https://forums.phpfreaks.com/topic/127633-correct-this-please/#findComment-660460 Share on other sites More sharing options...
nadman123 Posted October 9, 2008 Author Share Posted October 9, 2008 $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 More sharing options...
nadman123 Posted October 9, 2008 Author Share Posted October 9, 2008 Maq was correct..but now I am getting another error... CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. Link to comment https://forums.phpfreaks.com/topic/127633-correct-this-please/#findComment-660468 Share on other sites More sharing options...
Maq Posted October 9, 2008 Share Posted October 9, 2008 Could you post the entire code? Link to comment https://forums.phpfreaks.com/topic/127633-correct-this-please/#findComment-660559 Share on other sites More sharing options...
nadman123 Posted October 9, 2008 Author Share Posted October 9, 2008 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 More sharing options...
Maq Posted October 9, 2008 Share Posted October 9, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.