Jump to content

sraidr69

New Members
  • Content count

    9
  • Joined

  • Last visited

Community Reputation

0 Neutral

About sraidr69

  • Rank
    Newbie
  1. sraidr69

    Insert Into statement

    1. Error Reporting is on. There is no error. 2. I minimized to uname, password and email with the same result. 3. These 3 fields are varchar(45) $str ="Insert Into clients (username, password, email) Values (:username, :password, :email)"; $uname=$_POST["uname"]; $password = $_POST["pword"]; $hash = password_hash($password, PASSWORD_DEFAULT); $email=$_POST["email"]; $stmt = $conn->prepare($str); $stmt->execute(array('username'=> $uname, 'password'=>$hash, 'email'=>$_POST["email"]));
  2. sraidr69

    Insert Into statement

    I got the code above to execute but it did not insert into the table still. I tried changing it around to the code below with the same result. Could there be something with the mysql that is not allowing it to insert? I am able to read data from the db. $p1=$_POST["p11"] . $_POST["p12"] . $_POST["p13"]; $p2=$_POST["p21"] . $_POST["p22"] . $_POST["p23"]; $str ="Insert Into clients (fname, lname, username, password, addr, city, st, zip, phone1, phone2, email) Values (:fname, :lname, :username, :password, :addr, :city, :st, :zip, :phone1, :phone2, :email)"; $fname=$_POST["fname"]; $lname=$_POST["lname"]; $uname=$_POST["uname"]; $myhash=$hash; $addr=$fname=$_POST["addr"]; $city=$_POST["city"]; $st=$_POST["st"]; $zip=$_POST["zip"]; $p11=$p1; $p12=$p2; $email=$_POST["email"]; $stmt = $conn->prepare($str); //$stmt->bindParam(':fname', $fname); //$stmt->bindParam(':lname', $lname); //$stmt->bindParam(':username', $uname); //$stmt->bindParam(':password', $myhash); //$stmt->bindParam(':addr', $addr); //$stmt->bindParam(':city', $city); //$stmt->bindParam(':st', $st); //$stmt->bindParam(':zip', $zip); //$stmt->bindParam(':phone1', $p11); //$stmt->bindParam(':phone2', $p12); //$stmt->bindParam(':email', $_POST["email"]); $stmt->execute(array('fname'=>$fname, 'lname'=>$lname, 'username'=> $uname, 'password'=>$myhash, 'addr'=>$addr, 'city'=>$city, 'st'=>$st, 'zip'=>$zip, 'phone1'=>$p11, 'phone2'=>$p12, 'email'=>$_POST["email"])); echo $str;
  3. sraidr69

    Insert Into statement

    Yes error checking is on. Something interesting happened when I removed all the colons from both the values statement and array string and the insert was kind of successful. It insert a new line into the database but all the data was null. So I checked the $_POST[''] values and they have data.
  4. sraidr69

    Insert Into statement

    There really isnt anymore code to it, just display the error and set the $password and $hash. I have tried with and without the ":" and it does not work either way. Here is the entire code for the insert into statement... if($user=="n" && $email=="n") { $password = $_POST["pword"]; $hash = password_hash($password, PASSWORD_DEFAULT); $stmt = $conn->prepare("Insert Into clients (fname, lname, username, password, addr, city, st, zip, phone1, phone2, email) Values (:fname, :lname, :username, :password, :addr, :city, :st, :zip, :phone1, :phone2, :email)"); $rec = $stmt->execute(array ( 'fname'=>$_POST["fname"], 'lname'=>$_POST["lname"], 'username'=>$_POST["uname"], 'password'=>$hash, 'addr'=>$_POST["addr"], 'city'=>$_POST["city"], 'st'=>$_POST["st"], 'zip'=>$_POST["zip"], 'phone1'=>$_POST["p11"] . $_POST["p12"] . $_POST["p13"], 'phone2'=>$_POST["p21"] . $_POST["p22"] . $_POST["p23"], 'email'=>$_POST["email"])); if($rec) { echo "Item post successful."; }else{ echo "Item post failed."; } } The code provides this error "Item post failed."
  5. sraidr69

    Insert Into statement

    I am getting an Item Post Failed error and not sure why. Obviously the record is not inserted into the DB. Im fairly new to pdo and cannot see the error. Anyone see the issue? $stmt = $conn->prepare("Insert Into clients (fname, lname, username, password, addr, city, st, zip, phone1, phone2, email) Values (:fname, :lname, :username, :password, :addr, :city, :st, :zip, :phone1, :phone2, :email)"); $rec = $stmt->execute(array ( ':fname'=>$_POST["fname"], ':lname'=>$_POST["lname"], ':username'=>$_POST["uname"], ':password'=>$hash, ':addr'=>$_POST["addr"], ':city'=>$_POST["city"], ':st'=>$_POST["st"], ':zip'=>$_POST["zip"], ':phone1'=>$_POST["p11"] . $_POST["p12"] . $_POST["p13"], ':phone2'=>$_POST["p21"] . $_POST["p22"] . $_POST["p23"], ':email'=>$_POST["email"]));
  6. sraidr69

    Loop screen print overlap

    Sorry, I forgot that I split it out. Here is the CSS... body {margin-left: 0px; margin-right: 0px;} .container { position: absolute; margin-top: 100px; width: 100%; } #hdr { } .logo { \\background-color: red; height: 75px; position: absolute; left: 0px; margin-bottom: 100px; } .gu { position: absolute; right: 0px; height: 75px; width: 300px; //background-color: #b0e0e6; text-align: right; } .bill_to { position: absolute; left: 0px; height: 125px; width: 300px; \\background-color: blue; } .invoice { position: absolute; right: 0px; height: 125px; width: 250px; \\background-color: blue; } .tbl_bill_to { font-size: 85%; } .tbl_invoice { font-size: 85%; } .tbl_invoice_h { text-align: right; color: #848484;} .tbl_invoice_l { text-align: left; } .grays {color: #848484; font-size: 77%;} hr { width:100%; height:3px; background: #848484; } .inv_list {margin-top: 150px;} .inv_list_1 {width: 50%;} .inv_list_c {text-align: center;} .inv_list_r {text-align: right;} .tbl_inv_list { border-collapse: collapse; width: 100%; } .tbl_inv_list th { background-color: #0B2161; color: #848484; } .tbl_inv_list_hr {height: 3px; background-color: #848484;}
  7. sraidr69

    Loop screen print overlap

    <link rel="stylesheet" type="text/css" href="style_invoice.css"> <?php session_start(); //ini_set('display_errors', 1); //ini_set('display_startup_errors', 1); //error_reporting(E_ALL); include_once "db.php"; if(!empty($_GET['pg'])) {$pg=$_GET['pg'];} if(!empty($_POST['pg'])) {$pg=$_POST['pg'];} //echo $_GET['rec']; ?> <style> </style> <!-- Start Invoice Loop --> <?php $str="Select * From orders Where delivery_date = '0000-00-00' Order by `idorders`"; $qry = $pdo->prepare($str); $qry -> execute(); $rst = $qry->fetchAll(); //echo "ROWCOUNT='" . $qry ->rowCount() . "'"; //echo "TRAYS=" . $rst['order_date']; $cnt=1; foreach( $rst as $row ){ $str="Select * From customers Where idcustomers = " . $row['idcustomers']; $qry = $pdo->prepare($str); $qry -> execute(); $cst = $qry->fetch(); //echo "ROWCOUNT='" . $qry ->rowCount() . "'"; //echo "CST=" . $qry->rowCount() . "<br>"; //echo "CNT=" . $cnt; $cnt++; ?> <div class="logo">logo</div> <div class="gu"> Greens Unlimited <br> 1138 N Chestnut Ave. <br> Arlington Heights, Il 60004<br> (866) 512-2979 </div> <div class="container"> <div class="tbl_inv_list_hr"></div> <div style="text-align: right"></div> <div class="bill_to"> <span class="grays"><b>Bill To</b></span> <table class="tbl_bill_to"> <tr><td><?php echo $cst['business']; ?></td></tr> <tr><td><?php echo $cst['baddr']; ?></td></tr> <tr><td><?php echo $cst['bcity'] . ", " . $cst['bstate'] . " " . $cst['bzip']; ?></td></tr> <tr><td><?php echo "(" . substr($cst['bphone'],0,3) . ") " . substr($cst['bphone'],3,3) . " - " . substr($cst['bphone'],6,4); ?></td></tr> <tr><td><?php echo $cst['bemail']; ?></td></tr> </table> </div> <div class="invoice"> <table class="tbl_invoice"> <tr><td class="tbl_invoice_h">Invoice #:</td> <td class="tbl_invoice_l">123456789</td></tr> <tr><td class="tbl_invoice_h">Order Date:</td> <td class="tbl_invoice_l"><?php echo $row['order_date']; ?></td></tr> <tr><td class="tbl_invoice_h">Delivery Date:</td> <td class="tbl_invoice_l"><?php echo $row['delivery_date']; ?></td></tr> <tr><td class="tbl_invoice_h">Paid Date:</td> <td class="tbl_invoice_l"><?php echo $row['paid_date']; ?></td></tr> <tr><td class="tbl_invoice_h">Amount Due:</td> <td class="tbl_invoice_l">$<?php echo number_format($row['amount_due'],2); ?></td></tr> </table> </div> <div class="inv_list"> <table class="tbl_inv_list"> <tr><th class="inv_list_1" align=left >Items</th> <th class="inv_list_c">Quantity</th> <th class="inv_list_r">Price</th> <th class="inv_list_r">Amount</th></tr> <?php $total=0; if ($row['bibblettuce'] > 0) {?> <tr><td class="inv_list_1">Bibb Lettuce</td> <td class="inv_list_c"><?php echo $row['bibblettuce']; ?></td> <td class="inv_list_r">$<?php echo number_format($row['price_bibblettuce'],2); ?></td> <td class="inv_list_r">$<?php echo number_format($row['price_bibblettuce']*$row['bibblettuce'],2); ?></td></tr> <?php $total=$total + ($row['price_bibblettuce']*$row['bibblettuce']); } if ($row['wheatgrass'] > 0) {?> <tr><td class="inv_list_1">Wheatgrass</td> <td class="inv_list_c"><?php echo $row['wheatgrass']; ?></td> <td class="inv_list_r">$<?php echo number_format($row['price_wheatgrass'],2); ?></td> <td class="inv_list_r">$<?php echo number_format($row['price_wheatgrass']*$row['wheatgrass'],2); ?></td></tr> <?php $total=$total + ($row['price_wheatgrass']*$row['wheatgrass']); } if ($row['mg_hotandspicy'] > 0) {?> <tr><td class="inv_list_1">Microgreens: Hot & Spicy</td> <td class="inv_list_c"><?php echo $row['mg_hotandspicy']; ?></td> <td class="inv_list_r">$<?php echo number_format($row['price_mg_hotandspicy'],2); ?></td> <td class="inv_list_r">$<?php echo number_format($row['price_mg_hotandspicy']*$row['mg_hotandspicy'],2); ?></td></tr> <?php $total=$total + ($row['price_mg_hotandspicy']*$row['mg_hotandspicy']); }?> <tr><td colspan="4" class="tbl_inv_list_hr"></td></tr> <tr><td></td> <td class="inv_list_r">Tray Return:</td> <td class="inv_list_r"><?php echo $row['tray_returned']; ?></td> <td class="inv_list_r">$<?php echo $row['tray_returned']; ?> </td></tr> <?php $total = $total - $row['tray_returned']; ?> <tr><td colspan="3"></td><td class="tbl_inv_list_hr"></td></tr> <tr><td></td> <td class="inv_list_r"><b>Total Due:</b></td> <td></td> <td class="inv_list_r"><b>$<?php echo number_format($total, 2); ?></b></td></tr> </table> </div> <div style='page-break-before:always;'> </div> <?php flush(); } ?> <!-- End Invoice Loop -->
  8. sraidr69

    Loop screen print overlap

    There is a lot of css applied. But that does not explain why it doesnt print each iteration at the bottom of the previous one. Where can I upload the file?
  9. sraidr69

    Loop screen print overlap

    I am encountering something I've never seen before. I have a foreach loop where I print out an invoice, it's a loop because there are weekly recurring invoices and I am using the webpage to print them. The issue is that once the loop repeats the screen output does not continue where the printout ends, it reprints over itself. I used "<div style='page-break-before:always;'>" at the end of the loop but that did nothing until I moved it up 1 </div> which screws up the top of the invoice. I have also used "flush()" with no effect. I originally wanted to use libreoffice writer but could not get any connection to work. Any ideas on why this is happening? </div> <div style='page-break-before:always;'> </div> <?php flush(); } ?> <!-- End Invoice Loop --> Keith
×

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.