
clay1
Members-
Posts
161 -
Joined
-
Last visited
Never
Everything posted by clay1
-
I guess so? I've got a lot of zips. Typing out record['zip'] == zip1 for every one will be a pretty lengthy file
-
if ($recordData['zip'] == 1 || $recordData['zip'] == 2 || $recordData['zip'] == 3) $emailList123[] = $recordData; For this part how could I test against an array of zips? in_array?
-
Great thanks-- that is pretty much how I figured it could be done but arrays give me trouble
-
I've got a table with profiles that I need to email to various people based on a list of zip codes provided for example all profiles matching zip codes 1,2, and 3 will be emailed to 123@whatever and all profiles matching zips 4,5 and 6 will be emailed to a different email address. If I grab all the appropriate records from the table with 1 query into an associative array what would be a good way to go through that array, parse the zipcodes and I suppose put them in a new array so that I can email them to the correct address?
-
Using length how would I prepend the 0? Thanks
-
I am looking directly in the table. Not all leading 0s are missing.. The issue is older data the vendor has sent me.. I just need to fix it and I would prefer not needing to manually edit each one. Can I use a regex to match the zip codes that have 4 digits and add the zero?
-
My table they are txt They are first being stored in a vendors table as varchar
-
I have a bunch of entries where the zipcode is missing the first digit Besides manually editing all of them is there a query I can write that will add it back? For example I've got xxxx I want it to be 0xxxx
-
I think I have it working
-
I fixed this problem by rewriting my sql queries to do one client at a time However I am at a loss as to how to get my totals to work correctly now and where in or outside the loop they should be calculated How do I add up a total then add to it on the next iteration rather than resetting it each time?
-
I have a script that generates an invoice. Clients are billed for different products. Currently the invoice is for one client. I am trying to modify it so that it will reflect the bill for multiple clients. Right now I have some variables that I use to count the quantity of products and then display that on the invoice For example: $product1qty $product2qty And then some if statements like: 'if $price == $20 $product1qty++' Later in the script I have an array of the product quantities and their descriptions which is looped through and printed to a pdf I am trying to add another loop so that multiple clients will be printed on 1 invoice. I've got an array holding my clients ie: $clientsarray("Mike", "Joe","Bill") What I am having trouble with is resetting the counter on the products variables after each client is looped through I tried foreach ($clients as client){ } Around my code that creates the invoice but I don't get the correct quantities
-
This seemed to work! Thank you-- an if you wouldn't mind could you explain the code a bit?
-
I've got a table with a list of cities, and a table with people. The cities table has a column for a manager I want all the people from the cities managed by a certain person Such as Select * from cities where manager = 'joe' Then use that to select * from people where city = all the cities from the other query Can I do this in one step or do I need to select the cities, put them in an array and loop through them while selecting the people? I'm using PG but any general help is welcome
-
I need to take a string and separate it into a set of variables or an associative array &Accepted=1&Accepted_msg=Warning%20dialer%5Fsource%5Fid%20is%200&error=0&Error_desc= The fields are delimited by & I'd like to get that to be something like: $accepted = 1 $accepted_message = "warning dialer source..' $error_desc =
-
Any ideas on how I can get this in a variable?
-
I dumped all declared variables and none of that stuff was found
-
I did a var_dump on get and it was null
-
I am posting data to a site using curl Their instructions say: 'Response: You will receive an escaped query string response back on the page containing 4 values: Error = 1 or 0 (1 = true, 0 = false) Error_desc = txt message describing error Accepted = 1 or 0 (1= true, 0 = false) Accepted_msg = response So your final response page will contain 1 string as such: &Error=1&error_desc=missing%29field%20emailaddress&accepted=0&accepted_msg=invalid%20post' I need to do different things depending on this response but I am not sure how to capture or parse it? I thought maybe it was being sent back to me as a $_post but it's not
-
OK. I fixed 1 issue However I now have a more vexing problem. When I run the script the first result comes back fine and is accepted: Form Fields - struct EMAILADDRESS [email protected] But then on the next iteration the results start stacking on top of each other and being rejected EMAILADDRESS [email protected],[email protected] This is what the URL is giving back to me. The fields I am posting are correct(I've done a var dump on them)
-
OK. So how do I generate the invoice_id so that it's sequential, not unique, but matches with the correct invoice?
-
So would I just have multiple records with the same invoice_id for each product? such as: invoice1 product123 invoice1 product234 invoice1 product566 etc?
-
This is getting annoying. if($rows>0){ for($i= 0; $i<$rows; $i++){ $lead = pg_fetch_assoc($result); $id = $lead['serial']; list($firstname, $lastname) = explode(' ' , $lead['name']); switch ($lead['income']) { case 1: $incomerange = '25 - 35k'; break; case 2: $incomerange = '36 - 50k'; break; case 3: $incomerange = '51k - 100k'; break; case 4: $incomerange = '>100k'; break; } $fields = array ( "Emailaddress" => $lead['e-mail'], "first_name" => $firstname, "last_name" => $lastname, "number" => $lead['telephone'], "number2" => $lead['telephone2'], "street" => $lead['street address'], "city" => $lead['city'], "state" => $lead['state/province'], "zip" => $lead['zip/postal code'], "gender" => $lead['gender'], "age" => $lead['age'], "dialer_source_id" => 0, "income" => $incomerange, "profile_href" => "http://removed$id" ); //url-ify the data for the POST foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string,'&'); echo "$i <BR><br>"; var_dump($fields); //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_POST,count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string); //execute post $result = curl_exec($ch); //close connection curl_close($ch); } } My DB query is working. If I comment out the curl stuff and do a var_dump($fields) everything is correct. However when I run this with the curl part included the first record posts fine. However the second record I get: Warning: pg_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/inthelea/domains/intheleadnightlife.com/public_html/elove/leadpost.php on line 25 And then the results from the 3rd party site are all wrong.. as if the script is trying to run pg_fetch_assoc on the 3rd party site not my own
-
I am creating a table to store some information about invoices I am sending to clients. The table is updated when the invoice is sent. One of the things I would like to store is which products the invoice was for, this way I can pull up a duplicate of the invoice at a later date if needed, view the product, and also for accounting purposes. Each product has a id number How should I go about storing this in the invoices table?
-
Thanks Perhaps I was unclear My question is more related to how do I set this up to loop and process all my results rather than just a 1 time iteration
-
I am pretty unfamiliar with curl and could use some help. I need to post the results of a db query to another site using curl. So far for testing purposes using hardcoded values I have a simple single record version working $url = "http://URLremove"; $fields = array ( "Emailaddress" => "[email protected]", "first_name" => "first", "last_name" => "last", "number" => "234234", "street" => "address", "city" => "city", "state" => "AX", "zip" => "12345", "gender" => "M", "age" => 30, "dialer_source_id" => 0, "income" => 35000, "profile_href" => "http://removed" ); //url-ify the data for the POST foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string,'&'); //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_POST,count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string); //execute post $result = curl_exec($ch); //close connection curl_close($ch); My question is how do I do this so all my results get posted and the result(the 3rd party page will respond whether a record was accepted or not) is logged for each one?