Jump to content

maideen

Members
  • Posts

    36
  • Joined

  • Last visited

maideen's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi I have one issue. I do not know how to solve and also no idea. It is my scenario. I have Product table with details,selling price, purchase price and so on. I want to invoice to clients. Clients can buy lots of item in single invoice. If I select product, it will display the Name of item,Sell price Uom in text box. If I click the add button, it will show in grid in php page. I have to do this one by one until client's ordered items completed. Then I click submit, then the items in Grid should be saved into Mysql Data table. It look like cart, but not If there is any idea and how to do this, pls share your knowledge with me. Thank you Maideen
  2. thanks mec_gyver Once removed mysqli_close($con); it works fine Tq.
  3. Hi. I am new. I don't know how to validate certain data like emai, web site and numeric value. Here is my code which is work fine. Below is my code. Pls Help me add.php <?php include_once '../inc/header.php'; ?> <Script Language="javascript"> function change_action() { var frm_obj=document.getElementById("frm"); frm_obj.action="data.php"; } </Script> <form action="" method="POST" id="frm" > <table class="" align="center" cellpadding="4" cellspacing="1"> <tr> <td><label class="lbl">ID </label></td> <td><label class="lbl">: </label></td> <td><input type="text" name="id" id="id" readonly="" class="txt"></td> </tr> <tr> <td><label class="lbl">Name </label></td> <td><label class="lbl">: </label></td> <td><input type="text" name="name" id="name" class="txt"></td> </tr> <tr> <td><label class="lbl">Address </label></td> <td><label class="lbl">: </label></td> <td><textarea name="address" id="address" class="txt" rows="5" cols="40"></textarea></td> </tr> <tr> <td><label class="lbl">Tel</label></td> <td><label class="lbl">: </label></td> <td><input type="text" name="tel" id="tel" class="txt"></td> </tr> <tr> <td><label class="lbl">Fax</label></td> <td><label class="lbl">: </label></td> <td><input type="text" name="fax" id="fax" class="txt"></td> </tr> <tr> <td><label class="lbl">Email</label></td> <td><label class="lbl">: </label></td> <td><input type="text" name="email" id="email" class="txt"></td> </tr> <tr> <td><label class="lbl">Web site</label></td> <td><label class="lbl">: </label></td> <td><input type="text" name="website" id="website" class="txt"></td> </tr> <tr> <td><label class="lbl">Type</label></td> <td><label class="lbl">: </label></td> <!--<td><input type="text" name="type" id="type" class="txt"></td>--> <td> <SELECT NAME=type id="type"> <OPTION VALUE=0>Choose <?php $sql="SELECT * FROM bk_parameter where type='typcs' order by id"; $result = mysqli_query($con,$sql); while($row = mysqli_fetch_array($result)) { $typename=$row["name"]; echo "<OPTION VALUE=\"$typename\">".$typename.'</option>'; } ?> </SELECT> </td> </tr> <tr> <td></td> <td></td> <td><input type="submit" value="submit" name="submit" class="btn" onclick="change_action()"> <input type="submit" value="back" name="back" class="btn" onclick="change_action()"></td> </tr> </table> </form> <?php include_once '../inc/footer.php'; ?> data.php <?php include_once '../inc/header.php'; //insert into table if (isset($_POST['submit']) && $_POST['submit'] != "" ) { $name = ($_POST["name"]); $address = ($_POST["address"]); $tel = ($_POST["tel"]); $fax = ($_POST["fax"]); $email = ($_POST["email"]); $website = ($_POST["website"]); $type = ($_POST["type"]); try { $sql="INSERT INTO bk_customer (name,address,tel,fax,email,website,type) VALUES ('$name','$address','$tel','$fax','$email','$website','$type')"; $result = mysqli_query($con,$sql) ; header("Location:index.php"); exit(); } catch (Exception $ex) { echo $e->getMessage() . "\n"; file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND); exit(); } } //mysqli_close($con); // update table if (isset($_POST['update']) && $_POST['update'] != "" ) { $id= ($_POST["id"]); $name = ($_POST["name"]); $address = ($_POST["address"]); $tel = ($_POST["tel"]); $fax = ($_POST["fax"]); $email = ($_POST["email"]); $website = ($_POST["website"]); $type = ($_POST["type"]); try { $sql="UPDATE bk_customer SET name='$name',address='$address', tel='$tel',fax='$fax'," . "email='$email', website='$website',type='$type' WHERE id='$id'"; $result = mysqli_query($con,$sql) ; header("Location:index.php"); } catch (Exception $ex) { echo $e->getMessage() . "\n"; file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND); exit(); } } // update record if (isset($_POST['delete']) && $_POST['delete'] != "" ) { $id=$_POST["id"]; try { $sql="DELETE FROM bk_customer WHERE id='$id'"; $result = mysqli_query($con,$sql) ; header("Location:index.php"); } catch (Exception $ex) { echo $e->getMessage() . "\n"; file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND); exit(); } } // back to index.php if (isset($_POST['back']) && $_POST['back'] != "" ) { header("Location:index.php"); }
  4. hi ginerjm I have echoed. It is fine. But the below error It is echoed. it is fine 500 Kinney 661.64 af blandit.mattis@nonleoVivamus.ca www.mujveqthwgg.oys supplier Warning: mysqli_query(): Couldn't fetch mysqli in C:\xampp\htdocs\bkstore\customer\add_data.php on line 59 pls help me.
  5. Hi I have another issue in Update. Could not be updated. pls help me if (isset($_POST['update']) && $_POST['update'] != "" ) { $id=$_POST["id"]; $name = $_POST["name"]; $address = $_POST["address"]; $tel = $_POST["tel"]; $fax = $_POST["fax"]; $email = $_POST["email"]; $website = $_POST["website"]; $type = $_POST["type"]; try { $sql="UPDATE bk_customer SET name='$name',address='$address', tel='$tel',fax='$fax',email='$email', website='$website',type='$type' WHERE id='$id'"; $result = mysqli_query($con,$sql) ; // $result=mysqli_fetch_assoc($con,$sql); } catch (Exception $ex) { echo $e->getMessage() . "\n"; file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND); exit(); } }
  6. hi Thanks for your comment I have solved, just remove the id. Works fine. Thank you maideen
  7. Hi I am new in php. I could not insert the data into mysql table. and there is no error prompt Below is my code. Pls help me. <?php include_once '../inc/header.php'; if (isset($_POST['submit']) && $_POST['submit'] != "" ) { $name = $_POST["name"]; $address = $_POST["address"]; $tel = $_POST["tel"]; $fax = $_POST["fax"]; $email = $_POST["email"]; $website = $_POST["website"]; $type = $_POST["type"]; try { $sql="INSERT INTO bk_customer (id,name,address,tel,fax,email,type,website) VALUES ('$name','$address','$tel','$fax','$email','$website','$type')"; $result = mysqli_query($con,$sql) ; exit(); } catch (Exception $ex) { echo $e->getMessage() . "\n"; file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND); exit(); } } mysqli_close($con); ?>
  8. hi Ch0cu3r When I use below code, i got id of last record. If I have 100 record in database, I shows last record i.e 100. But I need what I selected. Pls help me <Script Language="javascript"> function change_action() { var frm_obj=document.getElementById("frm"); frm_obj.action="data.php"; } </Script> <form action="" method="POST" id="frm" > <table width="100%" align="center" cellpadding="4" cellspacing="1"> <tr> <td>ID</td> <td>ID</td> <td>NAME</td> <td>FIRST NAME</td> <td>AGE</td> <td></td> </tr> <?php if(isset($result)){ while($row = mysqli_fetch_array($result)){ ?> <tr> <td><input type="hidden" name="vid" id="id" value="<?php echo $row['id'];?>"></td> <td><?php echo $row['id'];?></td> <td><?php echo $row['name'];?></td> <td><?php echo $row['firstname'];?></td> <td><?php echo $row['age'] ;?></td> <td><input type="submit" value="update" name="update" onclick="change_action()"> <input type="submit" value="delete" name="delete" onclick="change_action()"> </td> </tr> <?php } } mysqli_close($con); ?> <?php include_once '../../inc/config.inc.php'; if (isset($_POST['update']) && $_POST['update'] != "" ) { $id = $_POST["vid"]; $sql="SELECT * FROM demo where id='$id'"; $result = mysqli_query($con,$sql); include 'edit.php'; //header("Location:edit.php"); }
  9. I am telling the scnario. I have page with all customer data as grid format. last column is "UPDATE". If I select 5th row and click update, next page open the details of 5th row customer data. My sql command: $sql="select id,name,firstname,age from customer where id='$id'" How can i pass the id for select customer to the next page to retrive data from mysql database and to update if any changes. Pls help me ID NAME FIRST NAME AGE 1 Hoffman Tatyana 100 Update 2 Atkins Ishmael 44 Update 3 Hamilton Mohammad 73 Update 4 Murray Troy 18 Update 5 Schwartz Carla 79 Update 6 Bond Leno 33 Update 7 Noble Georgia 88 Update 8 Frederick Bradley 80 Update 9 Chambers Aphrodite 63 Update 10 Schultz Allegra 90 Update 11 Garrett Lillith 20 Update 12 Mcdaniel Venus 89 Update 13 Acevedo Iola 26 Update
  10. Hi Guru This is the post action Basically page shows all data as table format with id. If i click the selected update button, the id of selected row to be posted into next pages to retrive the data of the particular Id. Can you pls explain how to do? <form action="" method="POST" id="frm" > <table width="100%" align="center" cellpadding="4" cellspacing="1"> <tr> <td>ID</td> <td>ID</td> <td>NAME</td> <td>FIRST NAME</td> <td>AGE</td> <td></td> </tr> <?php if(isset($result)){ while($row = mysqli_fetch_array($result)){ ?> <tr> <td><input type="text" name="vid" value="<?php echo $row['id'];?>"/></td> <td><?php echo $row['id'];?></td> <td><?php echo $row['name'];?></td> <td><?php echo $row['firstname'];?></td> <td><?php echo $row['age'] ;?></td> <td><input type="submit" value="update" name="update" onclick="change_action()"> <input type="submit" value="delete" name="delete" onclick="change_action()"> </td> </tr> <?php }
  11. Hi I am new, Pls help me the following issue. When click the update button, ID should be to another page to process the update function. Below is my entire code index.php <?php include_once '../../inc/config.inc.php'; $sql="SELECT * FROM demo order by id"; try { $result = mysqli_query($con,$sql); include 'view.html.php'; } catch (PDOException $e) { echo $e->getMessage() . "\n"; file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND); // $output = 'Error fetching authors from database!'; // include '../../notification/errormsg.php'; exit(); } view.html.php <Script Language="javascript"> function change_action() { var frm_obj=document.getElementById("frm"); frm_obj.action="data.php"; } </Script> <h3>User Details</h3> <form action="" method="POST" id="frm" > <table width="100%" align="center" cellpadding="4" cellspacing="1"> <tr> <td>ID</td> <td>ID</td> <td>NAME</td> <td>FIRST NAME</td> <td>AGE</td> <td></td> </tr> <?php if(isset($result)){ while($row = mysqli_fetch_array($result)){ ?> <tr> <td><input type="text" name="vid" value="<?php echo $row['id'];?>"/></td> <td><?php echo $row['id'];?></td> <td><?php echo $row['name'];?></td> <td><?php echo $row['firstname'];?></td> <td><?php echo $row['age'] ;?></td> <td><input type="submit" value="update" name="update" onclick="change_action()"> <input type="submit" value="delete" name="delete" onclick="change_action()"> </td> </tr> <?php } } mysqli_close($con); ?> </table> </FORM> <?php include '../../inc/footer.php'; data.php <Script Language="javascript"> function change_action() { var frm_obj=document.getElementById("frm"); frm_obj.action="data.php"; } </Script> <h3>User Details</h3> <form action="" method="POST" id="frm" > <table width="100%" align="center" cellpadding="4" cellspacing="1"> <tr> <td>ID</td> <td>ID</td> <td>NAME</td> <td>FIRST NAME</td> <td>AGE</td> <td></td> </tr> <?php if(isset($result)){ while($row = mysqli_fetch_array($result)){ ?> <tr> <td><input type="text" name="vid" value="<?php echo $row['id'];?>"/></td> <td><?php echo $row['id'];?></td> <td><?php echo $row['name'];?></td> <td><?php echo $row['firstname'];?></td> <td><?php echo $row['age'] ;?></td> <td><input type="submit" value="update" name="update" onclick="change_action()"> <input type="submit" value="delete" name="delete" onclick="change_action()"> </td> </tr> <?php } } mysqli_close($con); ?> </table> </FORM> <?php include '../../inc/footer.php'; edit.php <?php echo 'edit.php'; if(isset($result)) { while($row = mysqli_fetch_array($result)) { echo $row['id'];'<br>'; echo $row['name'];'<br>'; echo $row['firstname'];'<br>'; echo $row['age'];'<br>'; } } Tq Maideen data.php edit.php index.php view.html.php
  12. Hi I am new in php. Below code works fine. But If I change Select Command Like this: $sql = "SELECT login_id,password FROM user_right WHERE login_id = '$username' and password = '$password'"; It shows error recorde not found. Also I need to show the role of select user. Pls Help me <?php include_once'../inc/header.php'; if (isset($_POST['submit']) && $_POST['submit'] != "" ) { if(empty($_POST['username'])) { $handleError = "User is empty!"; $_SESSION["errormsg"] = $handleError; header("Location:../notification/errormsg.php"); //echo $handleError; return false; } if(empty($_POST['password'])) { $handleError = "Password is empty!"; $_SESSION["errormsg"] = $handleError; header("Location:../notification/errormsg.php"); //echo $handleError; return false; } $username = trim($_POST['username']); $password = trim($_POST['password']); try { $sql = "SELECT * FROM user_right WHERE login_id = '$username' and password = '$password'"; $stmt = $dbh->prepare($sql); $stmt->setFetchMode(PDO::FETCH_ASSOC); if ($stmt = $dbh->query($sql)) { if ($stmt->fetchColumn() > 0) { $_SESSION["username"] = $username; $_SESSION["password"] = $password; header("Location:../admin/"); exit(); } else { $handleError="user name or password is wrong"; $_SESSION["errormsg"] = $handleError; header("Location:../notification/errormsg.php"); exit(); }; } } catch (PDOException $e) { echo $e->getMessage() . "\n"; file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND); } } include '../inc/footer.php';
  13. hi Thank you of you to give the suggestion to solve the problem. there was wrong in Search.php Here is the code working fine <?php $query = $_GET['query']; echo $query; $stmt = $dbh->query("SELECT * FROM CompanyInfo WHERE (Name LIKE '%".$query."%' OR Address LIKE '%".$query."%')"); $stmt->setFetchMode(PDO::FETCH_ASSOC); if(isset($stmt)) { while($row = $stmt->fetch()){ ?> <tr> <td><?php echo $row['Name'];?></td> <td><?php echo $row['Address'];?></td> </tr> <?php echo $row['Name']; } }?> Thank you very much once again
  14. Hi I have tried this command too. Nothing happend. pls maideen
  15. Hi I have one problem , I need to search any string data . Below my code. When I click, no results as well as no error Index.php <?php include_once '../templete/header.php'; ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Search</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <form action="search.php" method="get" > <table border="0" cellpadding="0" cellspacing="0"> <tr> <td><input type="text" name="query" id="text" /> </td> <td><input type="submit" name="submit" id="search" value="Search" /></td> </form> </body> </html> Search.php <?php include_once '../templete/header.php'; include_once '../inc/connection.inc.php'; ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Search</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <table> <tr> <td>Name</td> <td>Address</td> </tr> <?php $query = $_GET['query']; $stmt = $dbh->prepare("SELECT * FROM CompanyInfo WHERE (Name LIKE '%".$query."%') OR (Address LIKE '%".$query."%')"); $stmt->setFetchMode(PDO::FETCH_ASSOC); //$stmt->execute(); if(isset($stmt)) { while($row = $stmt->fetch()); ?> <tr> <td><?php echo $row['Name'];?></td> <td><?php echo $row['Address'];?></td> </tr> <?php } ?> </table> </body> </html> Pls help me Maideen
×
×
  • 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.