Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
NURSING , CAREGIVER , HOTEL & BEAUTY COURSES
IVA Para Medical Campus
Updated:
Today at 9:24 AM
Handmade Character Soft Toys Peppa Pig Family
anil1961
Updated:
Yesterday at 9:58 PM
Ad icon
Video Content Creator
pramukag
Updated:
Sunday at 6:10 AM
Ad icon
QA Engineer Intern
pramukag
Updated:
Sunday at 6:07 AM
Ad icon
Sell your Land, House on idamata.lk for FREE
sajith.xp.pk
Updated:
Jun 25, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
machanla mata PHP help ekak one project ekakata
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="0775097172" data-source="post: 13001041" data-attributes="member: 267213"><p><?php</p><p>//product_classs.php file eka</p><p>class product{</p><p> var $table_name = "products";</p><p> var $rows;</p><p></p><p>public $ProductCategoryID , $manufacturer , $ProductLocation , $ProductName , $ProductPrice , $ProductWeight , $ProductStatus , $ProductStock , $ProductCartDesc , $Product_image , $ProductThumb , $ProductShortDesc , $ProductLongDesc ;</p><p></p><p>public $pressSumbitButton , $productImage;</p><p>public $cur_auto_id;</p><p>public $updateProductID;</p><p>//*******************************************************************</p><p>// Anti MySQL injection Method</p><p>//******************************************************************* </p><p>function cleanVer($formVar) {</p><p> if(!get_magic_quotes_gpc()){</p><p> $formVar = mysql_real_escape_string($formVar);</p><p> $formVar = htmlspecialchars($formVar, ENT_IGNORE, 'utf-8');</p><p> $formVar = strip_tags($formVar);//remove html internal tags</p><p> $formVar = stripslashes($formVar);</p><p> $formVar = trim($formVar);</p><p> return $formVar;</p><p> }</p><p> }</p><p></p><p>//*****************************************************************</p><p>// Update Product Method</p><p>//******************************************************************</p><p>function updateFormToDB($id){</p><p> $pid = $id;</p><p> if(isset($this->pressSumbitButton)){</p><p> </p><p> </p><p> </p><p> $manufacturer = $this->manufacturer ; </p><p> $ProductLocation = $this->ProductLocation ;</p><p> $ProductName = $this->ProductName ;</p><p> $ProductPrice = $this->ProductPrice ;</p><p> $ProductWeight = $this->ProductWeight ;</p><p> $ProductStatus = $this->ProductStatus ;</p><p> $ProductStock = $this->ProductStock ;</p><p> $ProductCartDesc = $this->ProductCartDesc ;</p><p> $cur_auto_id = $this->cur_auto_id ;</p><p> $ProductShortDesc = $this->ProductShortDesc;</p><p> $ProductLongDesc = $this->ProductLongDesc;</p><p> mysql_query("BEGIN"); </p><p> $sql = ("UPDATE Products SET manufacturer = '$manufacturer',ProductLocation = '$ProductLocation',ProductName = '$ProductName' ,ProductPrice = '$ProductPrice' ,ProductWeight = '$ProductWeight' ,ProductStatus = '$ProductStatus' ,ProductStock = '$ProductStock',ProductCartDesc ='$ProductCartDesc' , ProductShortDesc = '$ProductShortDesc' ,ProductLongDesc = '$ProductLongDesc' WHERE ProductID = '$pid'");</p><p> </p><p> mysql_query($sql) or die(trigger_error("<br><storng><u>MySQL Error:</u></strong><br>".mysql_error()."<br><br><storng><u>Query Used:</u></strong><br>".$sql."<br><br><storng><u>Info:</u></strong><br>",E_USER_ERROR));</p><p> if(mysql_affected_rows()){ echo "update sucessfuly"; }</p><p>mysql_query("COMMIT");</p><p> }</p><p>}</p><p>}</p><p>?></p><p><?//mehema class ekak heduwa mama form ekak haraha mage data me function eken update karanna heduwama eka update karanna be kiyanawa</p><p>phala form eka ethi.HELP ekak oneeeeee?></p><p><div></p><p><? </p><p>//edit.php kiyala ekaka</p><p>if(!isset($_POST['update'])){</p><p>foreach($updateProduct as $u){?></p><p><form action="edit.php" method="post" enctype="multipart/form-data" name="addProduct"></p><p></p><p> </p><p><table width="595" border="1" cellspacing="1px" cellpadding="2px"></p><p><tr></p><p><th colspan="2" bgcolor="#4180BE"><font color="#FFFFFF">Update Product Details Panal</font></th></p><p></p><p></tr></p><p><tr></p><p> <td width="238">Product Category Id</td></p><p> <td width="340"><input name="ProductCategoryID" type="text" value=" <? echo $u['ProductID']; ?>" /></td></p><p> </tr></p><p></p><p> <tr></p><p> <td width="238">ProductName</td></p><p> <td width="340"><input type="text" name="ProductName" value="<? echo $u['ProductName'] ?>" /></td></p><p> </tr></p><p> <tr></p><p> <td>ProductPrice</td></p><p> <td><input type="text" name="ProductPrice" value="<? echo $u['ProductPrice']?>"/></td></p><p> </tr></p><p> <tr></p><p> <td>ProductWeight</td></p><p> <td><input type="text" name="ProductWeight" value="<? echo $u['ProductWeight']?>" /></td></p><p> </tr></p><p> </p><p> <tr></p><p> <td>ProductStatus</td></p><p> <td><input type="text" name="ProductStatus" value="<? echo $u['ProductStatus']?>" /></td></p><p> </tr></p><p> <tr></p><p> <td>ProductCartDesc</td></p><p> <td><input type="text" name="ProductCartDesc" value="<? echo $u['ProductCartDesc']?>" /></td></p><p> </tr></p><p> <tr></p><p> <td>ProductShortDesc</td></p><p> <td><input type="text" name="ProductShortDesc" value="<? echo $u['ProductShortDesc']?>" /></td></p><p> </tr></p><p> <tr></p><p> <td>ProductLongDesc</td></p><p> <td><input type="text" name="ProductLongDesc" value="<? echo $u['ProductLongDesc']?>" /></td></p><p> </tr></p><p> </p><p> <tr></p><p> <td>productImage</td></p><p> <td><input name="productImage" type="file" value="<? $u['ProductImages']?>" /></td></p><p> </tr></p><p> <tr></p><p> <td>Product Stock</td></p><p> <td><select name="ProductStock" ></p><p> <option value="<? echo $u['ProductStock']?>" selected="selected"><?php echo $u['ProductStock']?></option></p><p> <option value="inStock">inStock</option></p><p> <option value="outStock">out of stock</option></p><p> <option value="unlimited">unlimited</option></p><p> </select></td></p><p> </tr></p><p> <tr></p><p> <td>ProductLocation</td></p><p> <td><input type="text" name="ProductLocation" value="<? echo $u['ProductLocation']?>" /></td></p><p> </tr></p><p> <tr></p><p> <td>manufacturer</td></p><p> <td><input type="text" name="manufacturer" value="<? echo $u['manufacturer']?>" /></td></p><p> </tr></p><p> </p><p> <tr ><td colspan="2" align="center"></p><p> <input type="hidden" name="pid" value="<?php $u['ProductID'] ?>"/></p><p> <input name="update" type="submit" value="Update Product Details" /></td></p><p> </tr></p><p></table></p><p></p><p></form></p><p><? }}else{ </p><p>$product->manufacturer = $product->cleanVer($_POST['manufacturer']);</p><p>$product->ProductLocation = $product->cleanVer($_POST['ProductLocation']);</p><p>$product->ProductName = $product->cleanVer($_POST['ProductName']);</p><p>$product->ProductPrice = $product->cleanVer($_POST['ProductPrice']);</p><p>$product->ProductWeight = $product->cleanVer($_POST['ProductWeight']);</p><p>$product->ProductStatus = $product->cleanVer($_POST['ProductStatus']);</p><p>$product->ProductStock = $product->cleanVer($_POST['ProductStock']);</p><p>$product->ProductCartDesc = $product->cleanVer($_POST['ProductCartDesc']);</p><p>$product->pressSumbitButton = $product->cleanVer($_POST['update']);</p><p>$product->productImage = $_FILES['productImage'];</p><p>$product->ProductShortDesc = $product->cleanVer($_POST['ProductShortDesc']);</p><p>$product->ProductLongDesc = $product->cleanVer($_POST['ProductLongDesc']);</p><p> </p><p> $updated = $product->updateFormToDB($_POST['pid']);</p><p> if($updated){ echo "update was successfully";}else{ echo "counld not update,try again later";}</p><p> $product->addProductImages();} ?></p><p></p><p></p><p></p><p></p><p></div></p></blockquote><p></p>
[QUOTE="0775097172, post: 13001041, member: 267213"] <?php //product_classs.php file eka class product{ var $table_name = "products"; var $rows; public $ProductCategoryID , $manufacturer , $ProductLocation , $ProductName , $ProductPrice , $ProductWeight , $ProductStatus , $ProductStock , $ProductCartDesc , $Product_image , $ProductThumb , $ProductShortDesc , $ProductLongDesc ; public $pressSumbitButton , $productImage; public $cur_auto_id; public $updateProductID; //******************************************************************* // Anti MySQL injection Method //******************************************************************* function cleanVer($formVar) { if(!get_magic_quotes_gpc()){ $formVar = mysql_real_escape_string($formVar); $formVar = htmlspecialchars($formVar, ENT_IGNORE, 'utf-8'); $formVar = strip_tags($formVar);//remove html internal tags $formVar = stripslashes($formVar); $formVar = trim($formVar); return $formVar; } } //***************************************************************** // Update Product Method //****************************************************************** function updateFormToDB($id){ $pid = $id; if(isset($this->pressSumbitButton)){ $manufacturer = $this->manufacturer ; $ProductLocation = $this->ProductLocation ; $ProductName = $this->ProductName ; $ProductPrice = $this->ProductPrice ; $ProductWeight = $this->ProductWeight ; $ProductStatus = $this->ProductStatus ; $ProductStock = $this->ProductStock ; $ProductCartDesc = $this->ProductCartDesc ; $cur_auto_id = $this->cur_auto_id ; $ProductShortDesc = $this->ProductShortDesc; $ProductLongDesc = $this->ProductLongDesc; mysql_query("BEGIN"); $sql = ("UPDATE Products SET manufacturer = '$manufacturer',ProductLocation = '$ProductLocation',ProductName = '$ProductName' ,ProductPrice = '$ProductPrice' ,ProductWeight = '$ProductWeight' ,ProductStatus = '$ProductStatus' ,ProductStock = '$ProductStock',ProductCartDesc ='$ProductCartDesc' , ProductShortDesc = '$ProductShortDesc' ,ProductLongDesc = '$ProductLongDesc' WHERE ProductID = '$pid'"); mysql_query($sql) or die(trigger_error("<br><storng><u>MySQL Error:</u></strong><br>".mysql_error()."<br><br><storng><u>Query Used:</u></strong><br>".$sql."<br><br><storng><u>Info:</u></strong><br>",E_USER_ERROR)); if(mysql_affected_rows()){ echo "update sucessfuly"; } mysql_query("COMMIT"); } } } ?> <?//mehema class ekak heduwa mama form ekak haraha mage data me function eken update karanna heduwama eka update karanna be kiyanawa phala form eka ethi.HELP ekak oneeeeee?> <div> <? //edit.php kiyala ekaka if(!isset($_POST['update'])){ foreach($updateProduct as $u){?> <form action="edit.php" method="post" enctype="multipart/form-data" name="addProduct"> <table width="595" border="1" cellspacing="1px" cellpadding="2px"> <tr> <th colspan="2" bgcolor="#4180BE"><font color="#FFFFFF">Update Product Details Panal</font></th> </tr> <tr> <td width="238">Product Category Id</td> <td width="340"><input name="ProductCategoryID" type="text" value=" <? echo $u['ProductID']; ?>" /></td> </tr> <tr> <td width="238">ProductName</td> <td width="340"><input type="text" name="ProductName" value="<? echo $u['ProductName'] ?>" /></td> </tr> <tr> <td>ProductPrice</td> <td><input type="text" name="ProductPrice" value="<? echo $u['ProductPrice']?>"/></td> </tr> <tr> <td>ProductWeight</td> <td><input type="text" name="ProductWeight" value="<? echo $u['ProductWeight']?>" /></td> </tr> <tr> <td>ProductStatus</td> <td><input type="text" name="ProductStatus" value="<? echo $u['ProductStatus']?>" /></td> </tr> <tr> <td>ProductCartDesc</td> <td><input type="text" name="ProductCartDesc" value="<? echo $u['ProductCartDesc']?>" /></td> </tr> <tr> <td>ProductShortDesc</td> <td><input type="text" name="ProductShortDesc" value="<? echo $u['ProductShortDesc']?>" /></td> </tr> <tr> <td>ProductLongDesc</td> <td><input type="text" name="ProductLongDesc" value="<? echo $u['ProductLongDesc']?>" /></td> </tr> <tr> <td>productImage</td> <td><input name="productImage" type="file" value="<? $u['ProductImages']?>" /></td> </tr> <tr> <td>Product Stock</td> <td><select name="ProductStock" > <option value="<? echo $u['ProductStock']?>" selected="selected"><?php echo $u['ProductStock']?></option> <option value="inStock">inStock</option> <option value="outStock">out of stock</option> <option value="unlimited">unlimited</option> </select></td> </tr> <tr> <td>ProductLocation</td> <td><input type="text" name="ProductLocation" value="<? echo $u['ProductLocation']?>" /></td> </tr> <tr> <td>manufacturer</td> <td><input type="text" name="manufacturer" value="<? echo $u['manufacturer']?>" /></td> </tr> <tr ><td colspan="2" align="center"> <input type="hidden" name="pid" value="<?php $u['ProductID'] ?>"/> <input name="update" type="submit" value="Update Product Details" /></td> </tr> </table> </form> <? }}else{ $product->manufacturer = $product->cleanVer($_POST['manufacturer']); $product->ProductLocation = $product->cleanVer($_POST['ProductLocation']); $product->ProductName = $product->cleanVer($_POST['ProductName']); $product->ProductPrice = $product->cleanVer($_POST['ProductPrice']); $product->ProductWeight = $product->cleanVer($_POST['ProductWeight']); $product->ProductStatus = $product->cleanVer($_POST['ProductStatus']); $product->ProductStock = $product->cleanVer($_POST['ProductStock']); $product->ProductCartDesc = $product->cleanVer($_POST['ProductCartDesc']); $product->pressSumbitButton = $product->cleanVer($_POST['update']); $product->productImage = $_FILES['productImage']; $product->ProductShortDesc = $product->cleanVer($_POST['ProductShortDesc']); $product->ProductLongDesc = $product->cleanVer($_POST['ProductLongDesc']); $updated = $product->updateFormToDB($_POST['pid']); if($updated){ echo "update was successfully";}else{ echo "counld not update,try again later";} $product->addProductImages();} ?> </div> [/QUOTE]
Insert quotes…
Verification
Payakata winadi keeyak tibeda?
Post reply
Top
Bottom