Quote originally posted by ﻼim ...Quote originally posted by detweiller ...Quote originally posted by ﻼim ...i'm sorry but i didn't understand clearly your problem or rather the output and manipulation you wanted.Quote originally posted by detweiller ...kim, need your expertise in another problem..
eto yung link..
http://www.daniweb.com/forums/thread306829.html
gusto ko din sana i-modify yung code na existing. now kasi isang textbox lang meron yun at search button lang sya meron. ang gusto ko sana is 1 textbox for the key search and 1 dropdown list na kung saang column sya ng kahit anong table sa db ko maghahanap.. yung existing kasi i-qquery nya yung kada column ng kada table..
pwede mo ba ako matulungan??
thanks!!!
ang nakita ko kasi sa query mo dun sa link is that you are searching at all columns na kay table1 lang pero pinag'join mo yung lahat ng tables.
anong output po ba dapat?
yung mag'search po s'ya sa lahat ng columns per table?
o yung mag'search sa lahat ng tables?
i mean, pwede yung dropdown mo dun sa tatlong keys mo if ever yung mga options is mga pangalan nalang ng tables mo para dun ma'specify kung saang table mag'search.
i really have no idea yet with the universal search.
when i say a universal search, yung search na gagamitin mo is pwede para sa lahat ng tables sa database(let's say meron kang 15 tables sa db), magdedepende na lang kung anong form yung tatawag dun sa search form na yun..
yung search form will consist of a textbox, kung saan mo ittype yung isesearch mo, a dropdown menu, ang lalabas dito is yung fieldnames ng table na tinawag mo sa db mo. magdedepende yung lalabas dito sa form na tumawag sa kanya.
then sa baba is ilalabas nya yung results. at kapag naclick mo yung certain result then nafifill in nya yung form na tumawag sa kanyamay you attach here a sample GUI design of the certain form?
thanks.
here's 2 sample codes for that form.. di ko kasi alam kung pde magupload dito ng pic or hindi..
---------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<link rel="stylesheet" href="css/dhtmlwindow.css" type="text/css" />
<script type="text/javascript" src="script/dhtmlwindow.js">
</script>
<link rel="stylesheet" href="css/modal.css" type="text/css" />
<script type="text/javascript" src="script/modal.js"></script>
<script type="text/javascript">
function search(field,table)
{
emailwindow=dhtmlmodal.open('Search', 'iframe', 'search.php?table='+table, 'Search '+table,
'width=800px,height=500px,center=1,resize=0,scrolling=1','')
emailwindow.onclose=function()
{ //Define custom code to run when window is closed
var theform=this.contentDoc.forms[0] //Access first form inside iframe just for your reference
var theemail=this.contentDoc.getElementById("codeid")
var returnField = theemail.value.split("?");
var fieldId = field.split(",");
for(i = 0; i < fieldId.length; i++)
{
document.getElementById(fieldId[i]).value=returnField[i];
}
return true //allow closing of window
}
} //End "opennewsletter" function
</script>
<script language="javascript" src="script/daces.js"></script>
<script language="JavaScript" src="script/gen_validatorv31.js" type="text/javascript"></script>
<script language="JavaScript" type="text/JavaScript">
function confirmSubmit(action)
{
if (action != "delete")
{
document.Stocks.action.value=action;
return true;
}
else
{
var agree=confirm("Are you sure you wish to continue?");
if (agree)
{
document.Stocks.action.value=action;
return true ;
}
else
{
document.discount.del.value = '';
return false ;
}
}
}
</script>
</head>
<body>
<?php
include ("datacon.php");
$BrandCode = '';
$ColorCode = '';
$BarCode = '';
$CategoryCode = '';
$StockCode = '';
$StockName = '';
$Description = '';
$Size = '';
$UoM = '';
$Price = 0.00;
$SoH = 0;
$Warehouse1 = 0;
$Warehouse2 = 0;
$Warehouse3 = 0;
if (array_key_exists ('action',$_POST))
{
$BrandCode = $_POST['BrandCode'];
$ColorCode = $_POST['ColorCode'];
$CategoryCode = $_POST['CategoryCode'];
$StockCode = $_POST['StockCode'];
$StockName = $_POST['StockName'];
$Description = $_POST['Description'];
$Size = $_POST['Size'];
$UoM = $_POST['UoM'];
$Price = $_POST['Price'];
$SoH = $_POST['SoH'];
$Warehouse1 = $_POST['Warehouse1'];
$Warehouse2 = $_POST['Warehouse2'];
$Warehouse3 = $_POST['Warehouse3'];
$ACTION = $_POST['action'];
if($Action == 'save')
{
$query = "Select * FROM Stock WHERE StockCode = '$StockCode'";
$result = mysql_query ($query);
$num = mysql_num_rows($result);
if ($num == 0)
{
$query = "INSERT INTO Stock (StockCode, BrandCode, ColorCode, CategoryCode, StockName,
Description, Size, UoM, Price, SoH, Warehouse1, Warehouse2, Warehouse3)
VALUES ('$StockCode', '$BrandCode', '$ColorCode', '$CategoryCode', '$BarCode',
'$StockName', '" .addslahes($Description) .
"', '$Size', '$UoM', '$Price', '$SoH', '$Warehouse1', '$Warehouse2', '$Warehouse3')";
}
else
{
$query = "UPDATE Stock set WHERE stockcode='$Stockcode'";
}
mysql_query ($query);
}
else
{
$query = "DELETE FROM Stock WHERE stockcode='$Stockcode'";
} mysql_query($query);
}
if(array_key_exists('Stockcode', $_GET))
{
$StockCode =$_GET['Stockcode'];
$query = "Select * FROM Stock WHERE StockCode = '$StockCode'";
$result = mysql_query ($query);
$BrandCode = mysql_result($result, 0, 'BrandCode');
$ColorCode = mysql_result($result, 0, 'ColorCode');
$CategoryCode = mysql_result($result, 0, 'CategoryCode');
$StockCode = mysql_result($result, 0, 'StockCode');
$StockName = mysql_result($result, 0, 'StockName');
$Description = mysql_result($result, 0, 'Description');
$Size = mysql_result($result, 0, 'Size');
$UoM = mysql_result($result, 0, 'UoM');
$Price = mysql_result($result, 0, 'Price');
$SoH = mysql_result($result, 0, 'SOH');
$Warehouse1 = mysql_result($result, 0, 'wareHouse1');
$Warehouse2 = mysql_result($result, 0, 'wareHouse2');
$Warehouse3 = mysql_result($result, 0, 'wareHouse3');
}
?>
<font size="12"><b>Stocks</b></font>
<form name="Stocks" method="post" action="Stock.php">
<input type="hidden" name="action" value=""/>
<div id="Stocks" align="center">
<table width="750" border="2">
<tr>
<td width="200">STOCK BRAND:<br>
<input name="StockBrand" id ="brandcode"value="<?php echo $BrandCode;?>" maxlength="20" readonly style="width:100px">
<input name="SBrButton" type ="button" onclick="search('brandcode','StockBrand')" value =".."/>
</td>
<td width="200">STOCK COLOR:<br>
<input name="StockColor" value="<?php echo $ColorCode;?>" maxlength="20" readonly id="colorcode" style="width:100px"/>
<input name="SColButton" type ="button" onclick="search('colorcode','StockColor')" value =".." />
</td>
<td width="200">STOCK CATEGORY:<br>
<input name="StockCategory" value="<?php echo $CategoryCode;?>"
maxlength="20" readonly id ="categorycode" style="width:100px">
<input name="SCatButton" type ="button" onclick="search('categorycode','StockCategory')"
value =".."/>
</td>
<td rowspan="6" align="center" valign="top" width="120">
<table border="0">
<tr>
<td><INPUT TYPE="submit" name="Save" style="width:100px" value="Save" onclick ="confirmSubmit('save')"></td>
</tr>
<tr>
<td><input type="submit" name="Delete" style="width:100px" value="Delete" onclick ="confirmSubmit('delete')"></td>
</tr>
<tr>
<td><INPUT TYPE="button" name="New" value="New" style="width:100px" onclick ="confirmSubmit('new')"></td>
</tr>
<tr>
<td><input name="Search" TYPE="button" style="width:100px"
onclick="test('search.php?code=Stocks&field=Stocks.Stocks','',900,400)" value="Search"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>STOCK CODE:</td>
<td colspan="2"><input name="StockCode" value="<?php echo $StockCode;?>" maxlength="50" readonly></td>
</tr>
<tr>
<td>BARCODE:</td>
<td colspan="2"><input name="BarCode" value="<?php echo $BarCode;?>" maxlength="50"></td>
</tr>
<tr>
<td>STOCK NAME:</td>
<td colspan="2"><input name="StockName" value="<?php echo $StockName;?>" maxlength="50"></td>
</tr>
<tr>
<td align="left" valign="top">Description:</td>
<td colspan="2" valign="top"><textarea name="StockDescription" cols="50" rows="4"><?php echo $Description;?></textarea></td>
</tr>
<tr>
<td>Size:</td>
<td colspan="2"><input name="StockSize" value="<?php echo $Size;?>" maxlength="50"></td>
</tr>
<tr>
<td>Unit of Measure:</td>
<td colspan="2"><input name="UoM" value="<?php echo $UoM;?>" maxlength="50"></td>
<td rowspan="5" valign="middle" align="center"><img src="phpimage.php?stockcode=<?php echo $StockCode;?>"
alt="" height="100" width="100"><br>
<input type="button" value="Upload" name="Upload"/>
</td>
</tr>
<tr>
<td>Price:</td>
<td colspan="2"><input name="Price" value="<?php echo $Price;?>" maxlength="50"></td>
</tr>
<tr>
<td>Stock on Hand:</td>
<td colspan="2"><input name="SoH" value="<?php echo $SoH;?>" maxlength="50"></td>
</tr>
<tr>
<td valign="top">Minimum Quantity:</td>
<td colspan="2">
Warehouse 1: <input name="Warehouse1" value="<?php echo $Warehouse1;?>" maxlength="50"><br>
Warehouse 2: <input name="Warehouse2" value="<?php echo $Warehouse2;?>" maxlength="50"><br>
Warehouse 3: <input name="Warehouse3" value="<?php echo $Warehouse3;?>" maxlength="50"></td>
</tr>
</table>
</div>
</form>
<script>
var frmvalidator = new Validator("Stocks");
frmvalidator.EnableMsgsTogether();
frmvalidator.addValidation("StockName","req","Please enter the StockName");
frmvalidator.addValidation("BarCode","req","Please enter the Barcode");
frmvalidator.addValidation("Description","req","Please enter the Description");
frmvalidator.addValidation("Size","req","Please enter the Size");
frmvalidator.addValidation("UoM","req","Please enter the Unit of Measure");
frmvalidator.addValidation("Price","req","Please enter the Price");
frmvalidator.addValidation("Price","num");
frmvalidator.addValidation("SoH","req","Please enter Stock on Hand");
frmvalidator.addValidation("SoH","num");
frmvalidator.addValidation("Warehouse1","req","Please enter the minimum quantity of the item in Warehouse 1");
frmvalidator.addValidation("Warehouse1","num");
frmvalidator.addValidation("Warehouse2","req","Please enter the minimum quantity of the item in Warehouse 2");
frmvalidator.addValidation("Warehouse2","num");
frmvalidator.addValidation("Warehouse3","req","Please enter the minimum quantity of the item in Warehouse 3");
frmvalidator.addValidation("Warehouse3","num");
frmvalidator.setAddnlValidationFunction("DoCustomValidation");
</script>
</body>
</html>
------------------------------------------------------------------------
and another one,
-------------------------------------------------------------------------
<!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" lang="en" xml:lang="en">
<head>
</head>
<script language="javascript" src="script/daces.js"></script>
<script language="javascript">
function confirmSubmit()
{
var agree=confirm("Are you sure you wish to continue?");
if (agree)
{document.Stock.del.value = 1;
return true ;}
else
{document.Stock.del.value = '';
return false ;}
}
</script>
<body>
<?php
include "datacon.php";
if (array_key_exists('Stockcode', $_GET))
{
$Stockcode = $_GET['Stockcode'];
$query="select * from Stock where Stockcode = $Stockcode";
$result = mysql_query($query);
$brandcode = mysql_result($result, 0, 'brandcode');
$categorycode = mysql_result($result, 0, 'categorycode');
$colorcode = mysql_result($result, 0, 'colorcode');
$barcode = mysql_result($result, 0, 'barcode');
$name = mysql_result($result, 0, 'name');
$description = mysql_result($result, 0, 'description');
$size = mysql_result($result, 0, 'size');
$uom = mysql_result($result, 0, 'uom');
$price = mysql_result($result, 0, 'price');
$warehouse1 = mysql_result($result, 0, 'warehouse1');
$warehouse2 = mysql_result($result, 0, 'warehouse2');
$warehouse3 = mysql_result($result, 0, 'warehouse3');
}
else if (array_key_exists('Stockcode', $_POST))
{
$Stockcode = $_POST['Stockcode'];
$del = $_POST['del'];
if ($del==1)
{
$queryContact ="delete from Stock where Stockcode = $Stockcode";
mysql_query($queryContact);
$queryContact ="delete from Stock where Stockcode = $Stockcode";
mysql_query($queryContact);
?>
<script language=JavaScript>
// location.href='clients.php?code=Stock'
</script>
<?php
}
else
{
$companyname = $_POST['companyname'];
$address = $_POST['address'];
$contactperson = $_POST['contactperson'];
$phone1 = $_POST['phone1'];
$phone2 = $_POST['phone2'];
$TIN = $_POST['TIN'];
$query="select * from Stock where Stockcode = $Stockcode";
$result = mysql_query($query);
$num = mysql_num_rows($result);
if($num>0)
{
$queryContact = "update Stock set companyname = '" .
addslashes($companyname) . "',address='" . addslashes($address) . "',
phone1='" .addslashes($phone1) ."',phone2='" . addslashes($phone2) .
"',contactperson = '".addslashes($contactperson)."',
TIN = '" . addslashes($TIN) . "' where Stockcode = $Stockcode";
}
else
{
$queryContact ="insert into Stock (companyname,contactperson,phone1,phone2,address,TIN)
values ('" .addslashes($companyname) . "','" .addslashes($contactperson)
.addslashes($phone1) . "','" .addslashes($phone2)
. "','" .addslashes($address) . "','" .addslashes($TIN) . "')";
}
mysql_query($queryContact) or die(mysql_error().$queryContact);
}
}
?>
<form name='Stock' action = 'Stock.php' method =post >
Stock Details
<table width ='500'>
<input type="hidden" value ="<?php echo $Stockcode;?>" name="Stockcode" />
<input type="hidden" value ="" name="del" />
<tr>
<td width="150">Company Name</td>
<td ><input type = 'text' style="width: 300px;" value = '<?php echo $companyname;?>' name = 'companyname'/></td>
</tr>
<tr>
<td> Contact Person </td>
<td><input type = 'text' style="width: 300px;" value = '<?php echo $contactperson;?>' name = 'contactperson'/></td>
</tr>
<tr>
<td> Phone </td>
<td><input type = 'text' style="width: 300px;" value = '<?php echo $phone1;?>' name = 'phone1'/></td>
</tr>
<tr>
<td> Fax </td>
<td><input type = 'text' style="width: 300px;" value = '<?php echo $phone2;?>' name = 'phone2'/></td>
</tr>
<tr>
<td> Address </td>
<td><textarea name="address" style = "border:1px solid #000000;
width:300px" ><?php echo trim($address);?></textarea>
</td>
</tr>
<tr>
<td> TIN </td>
<td><input type = 'text' style="width: 300px;" value = '<?php echo $TIN;?>' name = 'TIN'/></td>
</tr>
<tr><td colspan="2" align="center" /></tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Submit"/>
<input type="Reset" value="Reset"/>
<?php
if ($Stockcode<>"none") echo "<input type=\"submit\" value=\"Delete\" onClick= 'confirmSubmit()'/>";
?>
</td>
</tr>
</table>
</form>
<?php
$queryDetails = "Select stockcode,if(percent=='T',concat(discount.'%'),discount) discounts
from SupplierProduct where Stockcode = $Stockcode";
$resultDetails = mysql_query($queryDetails);
$numDetails = mysql_num_rows($resultDetails);
echo "<table width = '600px'>
<tr bgcolor ='#3262d6' style =\"color:white;font-weight:bold;\" align = 'center'>
<td width ='40%' >Stock Code</td>
<td width ='25%' >Discount</td>
</tr>";
if ($numDetails>0)
{
$i=0;
while ($i < $numDetails)
{
if(($i%2)==0)
{
echo "<tr onMouseOver=\"this.bgColor = '#c9cc99';this.style.cursor='pointer';\"
onMouseOut =\"this.bgColor = '#B0C4DE';this.style.cursor='auto';\"
onClick = \"test('Stock_discount.php?Stockcode=$Stockcode&
stockcode=". mysql_result($resultDetails, $i, 0) . "','',400,200)\"
bgcolor=\"#B0C4DE\">";
}
else
{
echo "<tr onMouseOver=\"this.bgColor = '#c9cc99';this.style.cursor='pointer';\"
onMouseOut =\"this.bgColor = '#FFFFFF';this.style.cursor='auto';\"
onClick = \"test('Stock_discount.php?Stockcode=$Stockcode&
stockcode=". mysql_result($resultDetails, $i, 0) . "','',400,200)\"
bgcolor=\"#B0C4DE\">";
}
$j=0;
while ($j < mysql_num_fields($resultDetails))
{
echo "<td width ='80' >" . mysql_result($resultDetails, $i, $j) . "</td>";
$j++;
}
echo "</tr>";
$i++;
}
}
else
{
echo "<tr><td colspan = '4'> NO DATA </td><tr>";
}
echo ($Stockcode==''?'':"<tr><td>
<a href = \"javascript:test('Stock_discount.php?Stockcode=$Stockcode&stockcode=none','',450,200)\">Add</a></td></tr>");
echo "</table>";
?>
</body>
</html>
<?php
mysql_close();
?>
----------------------------------------------------------
Please respect the forum rules regarding posting in English.
sorry for that again.sorry for that again.
how may i edit or delete this post?
thanks.

Just translate for us and state why you posted and that is enough.
And.. which language is that?
then sa baba is ilalabas nya yung results. at kapag naclick mo yung certain result then nafifill in nya yung form na tumawag sa kanya

| DaniWeb Message | |
| Cancel Changes | |