Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Removing table

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Removing table

Postby sidhu7018 » Sat Apr 19, 2014 4:41 am

I downloaded MySQL Table Search script from PhpJabbers I want to remove the below table.I want to display only the given name only demo link : http://www.phpjabbers.com/free-scripts/mysql-search-table/search.php
Code: Select all
<?php

error_reporting(0);
include("config.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Order Status</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<style>
BODY, TD {
   font-family:Arial, Helvetica, sans-serif;
   font-size:12px;
}
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="search.php">
 <label>Name or Email:</label>
<input type="text" name="string" id="string" value="<?php echo stripcslashes($_REQUEST["string"]); ?>" />

<option value="">--</option>
</select>
<input type="submit" name="button" id="button" value="Check Order" />
  </label>
</form>
<br /><br />
<table width="700" border="1" cellspacing="0" cellpadding="4">
  <tr>
    <td width="90" bgcolor="#78be55"><strong>Order Number</strong></td>
    <td width="95" bgcolor="#78be55"><strong>Order Status</strong></td>
    <td width="159" bgcolor="#78be55"><strong>Name</strong></td>
    <td width="191" bgcolor="#78be55"><strong>Email</strong></td>
    <td width="113" bgcolor="#78be55"><strong>City</strong></td>
  </tr>
<?php
if ($_REQUEST["string"]<>'') {
   $search_string = " AND (full_name LIKE '%".mysql_real_escape_string($_REQUEST["string"])."%' OR email LIKE '%".mysql_real_escape_string($_REQUEST["string"])."%')";   
}

if ($_REQUEST["from"]<>'' and $_REQUEST["to"]<>'') {
   $sql = "SELECT * FROM ".$SETTINGS["data_table"]." WHERE from_date >= '".mysql_real_escape_string($_REQUEST["order_id"])."' AND to_date <= '".mysql_real_escape_string($_REQUEST["to"])."'".$search_string.$search_city;
} else if ($_REQUEST["from"]<>'') {
   $sql = "SELECT * FROM ".$SETTINGS["data_table"]." WHERE from_date >= '".mysql_real_escape_string($_REQUEST["order_id"])."'".$search_string.$search_city;
} else if ($_REQUEST["to"]<>'') {
   $sql = "SELECT * FROM ".$SETTINGS["data_table"]." WHERE to_date <= '".mysql_real_escape_string($_REQUEST["order_status"])."'".$search_string.$search_city;
} else {
   $sql = "SELECT * FROM ".$SETTINGS["data_table"]." WHERE id>0".$search_string.$search_city;
}

$sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql);
if (mysql_num_rows($sql_result)>0) {
   while ($row = mysql_fetch_assoc($sql_result)) {
?>

  <tr>
    <td><?php echo $row["order_id"]; ?></td>
    <td><?php echo $row["order_status"]; ?></td>
    <td><?php echo $row["full_name"]; ?></td>
    <td><?php echo $row["email"]; ?></td>
    <td><?php echo $row["city"]; ?></td>
  </tr>
<?php
   }
} else {
?>
<tr><td colspan="5">No results found in our Database.</td>
<?php   
}
?>
</table>
</body>
</html>

:help:
Attachments
screenshot_62.png
Screen shot
screenshot_62.png (27.85 KiB) Viewed 70 times
sidhu7018
New php-forum User
New php-forum User
 
Posts: 1
Joined: Sat Apr 19, 2014 4:35 am

Re: Removing table

Postby seandisanti » Sun Apr 20, 2014 11:50 pm

the short answer is to take out the while loop that executes for every record
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.