
jrobles
Members-
Posts
66 -
Joined
-
Last visited
Never
Everything posted by jrobles
-
Sorry, I noobed out for a moment...it works great! Now I have to study it and figure out what it's doing
-
I am trying to insert the form data before I post the form to the linkpoint site. I tried making the action="" then set the header location to the linkpoint site after the data is entered into the but i get headers already sent errors. if (!isset($_POST['Submit'])) {echo" <form action='' method='post'> blah blah blah </form>";} else {INSERT blah into blah; header("Location: www.linkpointcentral.com/blah/blah ") } How can I insert into my db before the form is posted to the linkpoint url?
-
I am trying to capture my payment data before I post my form values to the payment website. I have an IF statement that says if form isn't submitted display for else insert the data into various tables. The problem is that i have the form action set to the url of the payment website and that seems to be firing off before I can insert the records into the table. If i set the form action to action="" and in then put the header location as the payment website after I insert the data i get the headers already sent error. here are some examples of my code with a brief description of what happens if (!isset($_POST['Submit'])) {<form action="https://ccprocessingsite.com" method="post"></form>} else {INSERT DATA INTO TABLES} The above code sends the data to the payment site but does not enter the data into the DB tables if (!isset($_POST['Submit'])) {<form action="" method="post"></form>} else {INSERT DATA INTO TABLES; header('Location:https://ccprocessingsite.com'); } This example adds the data to the tables but does not send the form post to the payment website for processing I'm sure there is a simple way to do this, but I'm stumped. ANY help would be GREATLY appreciated THANKS IN ADVANCE!!!!
-
that didnt seem to work for me. This is what I have //INSERT ORDER DETAIL RECORDS if (isset($_SESSION['cart'])) { $cart = array(); foreach (explode(',',$_SESSION['cart']) as $value) { if (array_key_exists($value,$cart)) { $cart[$value]['count']++; } else { $cart[$value] = array('count'=>1,'price'=>''); } } } $sql = "INSERT INTO `cart_table` (ProductID, QtyOrdered,OrderID) VALUES "; $vals = array(); foreach ($cart as $id=>$var) { $vals[] = '("'.$id.'","'.$var['count'].'","'.$OrderID.'")'; } mysql_query($sql . join(',',$vals)); }
-
Thanks a million for your help Buddski, but where do I put the insert statement?
-
Here is my var dump: array(3) { ["cart"]=> string(13) "3,3,3,3,2,2,4" ["ORDER_TOTAL"]=> float(60.15) ["TOTAL_PROD"]=> int(7) } "3333" means there are 4 of item # 3 "22" means there are 2 of item #2 Can I grab the price per unit by querying the product table within the loop before the insert statement?
-
trying top get the var dump, but my server seems to be down so once I get it back up i'll post the vars
-
I have a session that contains shopping cart data i.e item# qty pricePerUnit 1 4 5.89 3 1 3.25 6 2 10.99 I want to insert these items into my table one item at a time but I cant figure out how to loop through the session variables. Any suggestions? THANKS IN ADVANCE
-
sweet, I'll give that a shot and see what happens thanks a million! Happy Festivus!
-
I eventually will be putting the array in a cookie where I can grab it from another page and insert the values into a mysql table as part of an "order detail" table. Jonsjava's code looks like what I need , how can I have to data in the $data var regardless of how many products I have. Jonsjava can you help me understand your code, i'm fairly new at PHP thanks a million!
-
Im trying to put some information into an array but need some assistance. If i want to put the following info into the array how would I go about it? ProductID Qty PricePerUnit The array can contain one product or multiple. Each product will have the three fields i.e. ProductID = 1 Qty = 2 PricePerUnit = $4.00 ProductID = 2 Qty = 4 PricePerUnit = $2.76 ProductID = 3 Qty = 26 PricePerUnit = $4.34 etc...
-
thanks for your help guys, I think I figured it out. Happy holidays
-
I am working on a credit card processing script and need to send the orderID to the payment gateway so the gateway can send the order id in the response page. my script uses an simple if statement if(FORM ISNT POSTED) {INSERT DATA INTO MYSQL TABLE(S)} else {SHOW FORM} In the form I can have a hidden field called oid (OrderID) How can I populate that value with what the order ID is going to be before I insert the records into the order table? I am pretty sure I have to have some code before the IF that will generate the next id from the table but Im not sure what the function is to do that. thanks
-
sweet, that worked! Thanks a million buddy!
-
Thats the UserID for the sales associate. I basically need all sales under that UserID
-
Im having a problem getting a sql statement to give me the data that i need. Here is my statement SELECT Clients.ClientID, ClientProfile.FirstName, ClientProfile.LastName, SUM(OrderAmount) AS TOTAL FROM Clients JOIN ClientProfile ON Clients.ClientID = ClientProfile.ClientID LEFT JOIN OrderHeader ON Clients.ClientID = OrderHeader.ClientID WHERE Clients.UserID =17 The code above only returns one Client row with the sum of all the rows in my orderheader table. I need each client listed with the sum of of their orders only in a table format i.e. CLIENTID---FNAME---LNAME---TOTAL 4 John Doe 57.87 5 Jane Smith 24.25 6 Steve Meh 14.85 Here is a brief description of what I am doing. I have sales associates that can have many clients, each client can have many orders. I need to report all the clients and their total sales for any given sales associate.
-
Dynamic dropdown with dynamically selected value
jrobles replied to jrobles's topic in PHP Coding Help
sorry, the only value available was 'State' -
Dynamic dropdown with dynamically selected value
jrobles replied to jrobles's topic in PHP Coding Help
Thanks for your help, but that didnt seem to work. any suggestions? -
I have a drop down that is dynamically populated with data from my mysql table. Now I need to have a value from said drop down list automatically selected based on the id passed in the url. My query works fine but I am stuck on the syntax to select the appropriate drop down value. Here is my while loop that populates the drop down <select name='dropdown' id='dropdown'> <option value='0'>Select a Value</option>"; if (mysql_num_rows($result) > 0) {while($row = mysql_fetch_object($result)) echo"<option value='$row->ID'>$row->Name</option>";} echo" </select> The drop down I am doing will be on a form that is editing a users address. So if the user lives in 'FL' I would like the option for 'FL' to be <option value="FL" selected>Florida</option>
-
could you point me in the right direction with the syntax? i'm a noob and cant find a good tut for preg_replace
-
any luck with this? i'm looking for the same thing
-
I am uploading a CSV file and loading the contents into a mysql table. The CSV contains credit card info so I am encrypting the cc string before i insert it into the table. That all works fine, but I have to keep a copy of the original CSV file on my server and I dont want a CSV file siting there with a bunch of credit card numbers in it, just waiting to get stolen. How can I replace the CC string inside the CSV after i insert the records and before I fclose()? here is some of my code: //UPLOAD THE FILE BEING PROCESSED $uploaddir = 'uploaded_files/'; $uploadfile = $uploaddir . basename($_FILES['file']['name']); move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile); //RENAME THE FILE $rand_num = mt_rand(5,9999999999); $new_file = $uploaddir. date("mdY"). $rand_num.".csv"; rename($uploadfile,$new_file); //DECLARE $HANDLE AS OPEN .CSV FILE $handle = fopen("$new_file", "r"); //INSERT RECORDS WITH CC VALIDATION $cnt = 0; while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { //INSERT INTO INVENTORY TABLE $import="INSERT INTO inventoryTable(customerid,imbatchid, importdate,fname, mname, lname, phone, address1, address2, city, state, zip) VALUES(CONCAT(substring('$data[2]',1,1),substring('$data[4]',1,3),substring('$data[0]',1,1)),'$batchid',NOW(),'$data[0]','$data[1]','$data[2]', '$data[3]','$data[4]','$data[5]','$data[6]','$data[7]','$data[8]')"; mysql_query($import) or die(mysql_error()); //VALIDATE CC if (checkCreditCard ($data[9], $data[10], $ccerror, $ccerrortext)) {$ccerrortext = 'This card has a valid format'; $ccerror=9;} //ENCRYPT CC NUMBER $cc = encrypt($data[9]); //INSERT CC DATA $cc_query="INSERT INTO creditCards(customerID,CardNumber,ValidationStatus,ValidationDesc,ExpireMonth,ExpireYear,CardType)VALUES(CONCAT(substring('$data[2]',1,1),substring('$data[4]',1,3),substring('$data[0]',1,1)),'$cc',$ccerror,'$ccerrortext','$data[11]','$data[12]','$data[10]')"; mysql_query($cc_query) or die(mysql_error()); } //CLOSE THE .CSV FILE fclose($handle);