
clay1
Members-
Posts
161 -
Joined
-
Last visited
Never
Everything posted by clay1
-
Using the function here: http://shauninman.com/archive/2008/01/08/recovering_truncated_php_serialized_arrays Seems to have worked on my test data. Still waiting for the owner of the site to test out the reworked file
-
I can not figure this out at all. The most frustrating part is if I enter in the same answers in the form-- it works fine and the data appears exactly the same in the table. So what on earth could be causing the problem???
-
OK So with a bit more direction thanks to your help I found someone who had written a function that appears to work at extracting the serialized data. Is there a way I can do a check where if there is an error unserializing such as: If(!isset(unserialize($variable) { fixdatafunction($variable)}
-
It's not my server, but I will try to find out. Should it be off? If it's on is there anyway to fix the problem without editing php.ini? I don't know that the owner of this site will want to risk breaking other pages/scripts by changing magic_quotes Is there anyway I can get the data I already have, out of the table in a human readable format? Thanks for your help this has been driving me insane
-
Unserialized Romantic_Partner(good): Array ( [0] => Over Jealous ) Serialized: a:1:{i:0;s:12:"Over Jealous";} Unserialized potential_Partner(bad): Serialized: a:3:{i:0;s:22:"Lack of Communication";i:1;s:43:"Inability to be compassionate toward others";i:2;s:18:"Lack of self worth";}
-
If I just echo unserialized(variable) I get Array This is one of the ones that isn't working(as stored in the table): a:3:{i:0;s:22:"Lack of Communication";i:1;s:43:"Inability to be compassionate toward others";i:2;s:18:"Lack of self worth";} If I copy that to another field in the table I get the same error. If I enter those answers in the form I don't get the error. Again it only happens some of the time and not always the same field.
-
I have a form which inputs some fields into a table It has some serialized variables like such: $ss_important_traits = serialize($_POST['ss_important_traits']); Records are then exported. function contate($array){ return implode(",",$array); } contate(unserialize($row['social_situation'])) Most of the time everything works fine. However occasionally when exporting errors will be produced saying invalid argument passed for implode and it screws up the exported file. The data is in the table and appears to be fine. Is there something that people filling out the form could be doing that causes this error?
-
Anyone have any tutorials or directions on creating invoice numbers? I have a table called invoices with a column named invoicenumber which is set to a serial I want to be able to assign a new invoice the next number in the sequence.
-
What do you mean by how do I pass the data? I am using php and the following pg_query, but I'm not sure if that is what you are asking about pg_query($conn, "INSERT into \"markets\" VALUES (DEFAULT, '{$market}', '{$leadsemail}', '{$leadsemailcc}', '{$invoiceemail}', '{$invoiceemailcc}', {$fullprice}, {$halfprice}, {$pricelevel1}, {$pricelevel2}, {$pricelevel3}, '{$owner}', {$fullpriceagefrom}, {$fullpriceageto}, {$halfpriceagefrom}, {$halfpriceageto}, {$pricelevel1agefrom}, {$pricelevel1ageto}, {$pricelevel2agefrom}, {$pricelevel2ageto}, {$pricelevel3agefrom}, {$pricelevel3ageto})");
-
I thought I had this fixed but the problem has come back. I have a form which has about a dozen fields some are strings and some are integers Not all of the fields will be filled out for each record. My problem is inserting the record when some of the fields are empty I put this in my script: if (trim($value) == '') { $_POST[$key] = 'null'; } And that works when the integers are empty, but when it's a string I end up with the string 'null' in my record. Then when doing something like: if (!empty($leadsemailcc)){ or if(isset($leadsemailcc) It's considering the string 'null' as NOT NULL If I user $_POST['key'] = NULL; then the insert fails How the heck does PG handle this stuff?
-
Cool thanks a lot!
-
Using pg yes. How would I go about updating the timestamp? Could you elaborate on the table with the emails? Thanks
-
I have a site which I upload records to-- we can call them leads. They are coded with a market and given a date they are uploaded. I then have a query script which I can select a date and then email the leads based on that date. However this requires me looking up and seeing when the last day I emailed each market was. I've been thinking of ways I can automate this so all new leads are emailed automatically each week or whatever(running a cron job) I thought about adding a timestamp field to my markets table which is updated whenever the email script is run for that market. I also thought of having a flag column for each record that is set when the record has been emailed. Any suggestions on the best way to go about this?
-
That worked thank you
-
I guess I am mostly wonder how to validate this stuff I have about a 2 dozen fields on this form do I need to write an if(empty($ check for each field or is there a way to do this in less code?
-
The fields are set to accept nulls but apparently I need to explicitly pass a NULL value to the database and not just an empty integer like: ,, I can't replace zeros because there are cases where I want the value to be set as zero So I am still rather stuck here Pricelevel2 and 3 for example won't be used very often so I don't want to have to fill every single field in the form out every time
-
I have a form I am using to add a record to a postgresql database I am getting an error when I try to insert an empty integer field. I don't want to put 0 in the empty fields How do I handle this? Do I need to test each integer field with an if statement? Thanks The insert statement: INSERT into "markets" VALUES (DEFAULT, 'Test Market', 'email1', '', '', 'email2', 20, 10, 16, , , 'string', 35, 100, 25, 29, 30, 34, , , , ) "INSERT into \"markets\" VALUES (DEFAULT, '{$market}', '{$leadsemail}', '{$leadsemailcc}', '{$invoiceemail}', '{$invoiceemailcc}', {$fullprice}, {$halfprice}, {$pricelevel1}, {$pricelevel2}, {$pricelevel3}, '{$owner}', {$fullpriceagefrom}, {$fullpriceageto}, {$halfpriceagefrom}, {$halfpriceageto}, {$pricelevel1agefrom}, {$pricelevel1ageto}, {$pricelevel2agefrom}, {$pricelevel2ageto}, {$pricelevel3agefrom}, {$pricelevel3ageto})";
-
I think you are right!
-
I added 3 new fields to an insert statement and keep getting this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '312-577-0000', '2', 'Tuesday, September 29th')' at line 1 The three new fields are the last 3. "INSERT INTO free_for_all_payment () ". "VALUES ('','". $partyid."', '". $Name."', '". $main_gender."', '". $txtAddress."', '". $second_billing_address."', '". $billingCity."', '". $billingState."', '". $billingZip."', '". $billingCountry."', '". $billingTelephone."', '". $billingEmail."', '". $Special_requests."', '". $age."', '". $occupation."', '". $ageFrom."', '". $ageEnd."', '". $relationship_goal."', '". $ss_social_situation."', '". $ss_children."', '". $ss_date_with_children."', '". $ss_like_to_have_children."', '". $ss_ways_met_people."', '". $ss_online_dating_issues."', '". $other_issues."', '". $textfield."', '". $ss_important_traits."', '". $ss_three_biggest_turn_offs."', '". $ss_previous_problems."', '". $ss_previous_problems_desc."', '". $ss_local_contact."'". $Telephone2."', '". $Income."', '". $date."'". ")";
-
I'm selecting all from table where market = I'm using just a simple count as suggested to this now It's working
-
Cool, thanks
-
That would work Would there be a better way than looping through and counting?
-
I have a query which selects all the rows matching a market and then displays how many results there were I need to be able to break that down to display how many total results, and how many were under a certain age Do I need to do a separate select statement? Or can I use something like pg_num_rows to count how many are under age 25?
-
[SOLVED] Selecting a single field from a row and assign it to a variable?
clay1 replied to clay1's topic in PHP Coding Help
I need a loop for a single field from a single row? -
[SOLVED] Selecting a single field from a row and assign it to a variable?
clay1 replied to clay1's topic in PHP Coding Help
I haven't made it past the pg_query I tried $email = pg_query(....) but when I echo it I just get resource id #9