Re: [PHP-DB] MySQL two tables and an uneven number of rows

2016-09-19 Thread Karl DeSaulniers
Thanks Bert,
Sorry for late response, but I had to step away from this for a moment to work 
on other things.
Will most likely be back though as things are not working still.

Thank you for your responses.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com




> On Sep 13, 2016, at 2:15 AM, B. Aerts  wrote:
> 
> On 13/09/16 08:42, Karl DeSaulniers wrote:
>>> On Sep 12, 2016, at 2:53 PM, B. Aerts  wrote:
>>> 
>>> On 12/09/16 05:24, Karl DeSaulniers wrote:
 Hello All,
 Hoping you can help clear my head on this. I have two MySQL tables for 
 custom fields data to be stored.
 
custom_fields   custom_fields_meta
 
 custom_fields is the info for the actual field displayed in the html and 
 custom_fields_meta is the data stored from entering a value on said field 
 in the form.
 
 Custom fields can be added and removed at will by the user and so when for 
 instance, adding a field,
 it currently creates an uneven number of rows in the custom_fields_meta if 
 there were any entries with fields create prior to this new one.
 
 Currently I have this code:
 
 $SQL = "SELECT ft.*, mt.Meta_Value
FROM `CUSTOM_FIELDS` ft
LEFT JOIN `CUSTOM_FIELDS_META` mt
ON mt.Field_ID = ft.Field_ID
WHERE mt.Order_ID=%d
ORDER BY ft.Field_ID ASC";
 
 I have tried JOIN, FULL JOIN, FULL OUTER JOIN, OUTER JOIN and LEFT JOIN.
 If I manually put in the missing rows in the meta table, left join works.
 However, manually updating prior entries is not going to happen.
 
 So my question is how do I get all the table rows in both tables even if 
 there is not a row to match on the meta table?
 or
 How would I update the prior entries to include this new field in the meta 
 table and keep things orderly?
 The meta is stored per order id and so there is groups of meta data per 
 order id. I would like to avoid scattered data.
 Is there a way to push the index down to fit them in or is this just going 
 to be too costly on server resources?
 
 TIA,
 
 Best,
 
 Karl DeSaulniers
 Design Drumm
 http://designdrumm.com 
 
 
 
 
 
>>> Hi Karl,
>>> 
>>> I can't really follow your problem ... Any chance to post 2 dummy table 
>>> layouts to show what you want, and what you get ?
>>> 
>>> And it isn't something you could solve with a UNION ?
>>> 
>>> 
>> 
>> 
>> Hello,
>> Thanks fro your reply. I can try. :)
>> 
>> BEFORE:
>> 
>> CUSTOM_FIELDS:
>> 
>> `Field_ID`, `Field_Group`, `Field_Label`, `Field_Name`, `Field_Slug`, 
>> `Field_Type`, `Field_Description`, `Field_Values`, `Field_Display`, 
>> `Field_Required`, `Field_Date_Created`
>> ||
>> (1, 'Pickup Info', 'Phone 1', 'Origin_Phone1', 'origin-phone1', 'phone', 
>> 'Pickup Main phone number', '', 'Yes', 'No', '2015-04-19 08:46:10'),
>> (2, 'Pickup Info', 'Phone 2', 'Origin_Phone2', 'origin-phone2', 'phone', 
>> 'Pickup alternate phone number 1', '', 'Yes', 'No', '2015-04-19 08:46:11'),
>> (3, 'Pickup Info', 'Phone 3', 'Origin_Phone3', 'origin-phone3', 'phone', 
>> 'Pickup alternate phone number 2', '', 'Yes', 'No', '2015-04-19 08:46:12')
>> 
>> CUSTOM_FIELDS_META:
>> 
>> `Meta_ID`, `Field_ID`, `Order_ID`, `Meta_Value`
>> |—|
>> (1, 1, 1003, '555-123-4567'),
>> (2, 2, 1003, ''),
>> (3, 3, 1003, '')
>> 
>> 
>> Then lets say the user wants to add a cell phone field.
>> 
>> AFTER:
>> 
>> CUSTOM_FIELDS:
>> 
>> `Field_ID`, `Field_Group`, `Field_Label`, `Field_Name`, `Field_Slug`, 
>> `Field_Type`, `Field_Description`, `Field_Values`, `Field_Display`, 
>> `Field_Required`, `Field_Date_Created`
>> ||
>> (1, 'Pickup Info', 'Phone 1', 'Origin_Phone1', 'origin-phone1', 'phone', 
>> 'Pickup Main phone number', '', 'Yes', 'No', '2015-04-19 08:46:10'),
>> (2, 'Pickup Info', 'Phone 2', 'Origin_Phone2', 'origin-phone2', 'phone', 
>> 'Pickup alternate phone number 1', '', 'Yes', 'No', '2015-04-19 08:46:11'),
>> (3, 'Pickup Info', 'Phone 3', 'Origin_Phone3', 'origin-phone3', 'phone', 
>> 'Pickup alternate phone number 2', '', 'Yes', 'No', '2015-04-19 08:46:12'),
>> (4, 'Pickup Info', 'Cell', 'Origin_Cell', 'origin-cell', 'phone', 'Pickup 
>> cell phone number', '', 'Yes', 'No', '2015-04-19 08:46:13')
>> 
>> CUSTOM_FIELDS_META:
>> 
>> `Meta_ID`, `Field_ID`, `Order_ID`, `Meta_Value`
>> |—|
>> (1, 1, 1003, '555-123-4567'),
>> (2, 2, 1003, ''),
>> (3, 3, 1003, '')
>> 
>> The 4th field id is not in the meta table. So when I read out what is in the 
>> custom fields and matching meta data, cell phone does not show up for order 
>> that were processed before adding the custom field cell 

Re: [PHP-DB] Corn job anomaly

2016-09-19 Thread Karl DeSaulniers
> On Sep 19, 2016, at 6:14 AM, Richard 
>  wrote:
> 
> 
> 
>> Date: Monday, September 19, 2016 03:26:54 -0500
>> From: Karl DeSaulniers 
>> 
>> I am hoping someone can enlighten me on this issue I am having.
>> I am trying to set up a cron job to run a php file.
>> I am getting a strange error though.
>> 
>> /home/(protected directory)/auto_reminder.php: line 1: ?php: No
>> such file or directory /home/(protected
>> directory)/auto_reminder.php: line 2: =: command not found
>> /home/(protected directory)/auto_reminder.php: line 3: /*WordPress:
>> No such file or directory
>> 
>> This is lines 1, 2 and 3 from my code.
>> 
>> > $error_log = "";
>> /*WordPress Optons Table*/
>> 
>> Am I correct in thinking that the error is saying that php doesn't
>> exist? Has anyone ever experienced this? Is this a server related
>> issue? Any clue on how to fix?
> 
> What do you have on the "command-line" part of your crontab entry?
> Your php script will need to be called as a php cgi or cli. Because
> of the way things get set up via cron, it's best to include the full
> path to the php binary on the cron command-line.
> 

Hey thanks Richard. That was the problem.
Sorry, I am new to command line and cron jobs. 
Was probably a newb question, however, now it is saying that my database user 
is not allowed access.
I have a mysql connection inside my script that reads the database to get user 
email addresses to send a reminder email to.

Is there supposed to be a call or directive to load mysql in my command line as 
well?
Man this is frustrating.

Much thanks for your input!

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Corn job anomaly

2016-09-19 Thread Richard


> Date: Monday, September 19, 2016 03:26:54 -0500
> From: Karl DeSaulniers 
>
> I am hoping someone can enlighten me on this issue I am having.
> I am trying to set up a cron job to run a php file.
> I am getting a strange error though.
> 
> /home/(protected directory)/auto_reminder.php: line 1: ?php: No
> such file or directory /home/(protected
> directory)/auto_reminder.php: line 2: =: command not found
> /home/(protected directory)/auto_reminder.php: line 3: /*WordPress:
> No such file or directory
> 
> This is lines 1, 2 and 3 from my code.
> 
>  $error_log = "";
> /*WordPress Optons Table*/
> 
> Am I correct in thinking that the error is saying that php doesn't
> exist? Has anyone ever experienced this? Is this a server related
> issue? Any clue on how to fix?

What do you have on the "command-line" part of your crontab entry?
Your php script will need to be called as a php cgi or cli. Because
of the way things get set up via cron, it's best to include the full
path to the php binary on the cron command-line.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] ANN: PHP Generator 16.9 released

2016-09-19 Thread SQL Maestro Group

Hi!

SQL Maestro Group announces the release of PHP Generator 16.9, a family of 
GUI frontends for Windows that allow you to generate feature-rich CRUD web 
applications for your databases. There are versions for MySQL, MS SQL 
Server, PostgreSQL, Oracle, SQLite, Firebird, DB2, SQL Anywhere and MaxDB.

http://www.sqlmaestro.com/news/company/php_generators_16_9_released/

Online demos:
http://demo.sqlmaestro.com/feature_demo/
http://demo.sqlmaestro.com/nba/

Top 20 new features:


1. Column Filtering.
2. Custom Form Layouts.
3. Enhanced Master/Detail Views.
4. Record comparison.
5. Multi-Row Column Headers.
6. Breadcrumb navigation.
7. Automatic generation of index pages.
8. On-the-Fly Adding New Items to Lookup Controls.
9. Improved Filter Builder.
10. Quick Edit.
11. Adding multiple records from a single Insert form.
12. Geo Charts.
13. Permissions and RLS for all-level Details.
14. Flexible card views.
15. Enhanced JavaScript API.
16. OnGetCustomExportOptions event.
17. OnGetCustomUploadFileName event.
18. Built-in Lightbox component for external images.
19. Simple Data Grid Styling.
20. A number of GUI improvements.

Background information:
---
SQL Maestro Group offers complete database management and web development 
tools for MySQL, SQL Server, PostgreSQL, Oracle, DB2, SQLite, SQL Anywhere, 
Firebird and MaxDB providing the highest performance, scalability and 
reliability to meet the requirements of today's database applications.


Sincerely yours,
The SQL Maestro Group Team
http://www.sqlmaestro.com 



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Corn job anomaly

2016-09-19 Thread Karl DeSaulniers
I am hoping someone can enlighten me on this issue I am having.
I am trying to set up a cron job to run a php file.
I am getting a strange error though.

/home/(protected directory)/auto_reminder.php: line 1: ?php: No such file or 
directory
/home/(protected directory)/auto_reminder.php: line 2: =: command not found
/home/(protected directory)/auto_reminder.php: line 3: /*WordPress: No such 
file or directory

This is lines 1, 2 and 3 from my code.

http://designdrumm.com