-
Posts
2,134 -
Joined
-
Last visited
-
Days Won
42
Everything posted by benanamen
-
Seems to me this is the real problem. Stop them from signing both and you wont have to fix it afterwards.
-
Is this code representative of what you have been taught in school? If so, your teacher needs schooling.
-
Why not just get it from the DB the way you want it instead of jumping through code? SELECT IF (did_ivr_disable = TRUE, 'Enabled', 'Disabled') AS did_ivr_disable
-
That is not what you were shown to do. Look again.
-
PHP Parse error: syntax error, unexpected '<'
benanamen replied to thesunlover's topic in PHP Coding Help
Does this look right? <?=$bbname?'.'> <?=$navtitle?'.'> -
how can i fix this pls (Parse error: syntax error, unexpected '@')
benanamen replied to san19's topic in PHP Coding Help
Remove the debug.log on the previous line 14 -
When i press publish button code can't run
benanamen replied to Ehsan_collboy's topic in PHP Coding Help
You close out the form for the search but have no form opening for the rest. You are also missing the method attribute for the one you do have. -
Just a little tip on the trim function.... If you use a guard clause you can get rid of the else and clean up the function just a bit. Also, when you call the function, there is no need to call it with array_map. The $_POST data is already being run through array_map. No need to do it twice. 😀 <?php function _trim($val) { if (!is_array($val)) { return trim($val); } return array_map('_trim', $val); } $post = _trim($_POST);
-
Undefined variable error but that variable has been declared
benanamen replied to webdeveloper123's topic in PHP Coding Help
You need to just remove the action attribute completely. -
*
-
Why do you have two tables for the same data? Duplicated data is a red flag to a bad DB schema. Learn about Database Normalization.
-
For starters.... The DB connection "should" be passed to the Class using Dependency Injection, not extending Dbh. The submit button does not need a name attribute You should use Guard Clauses and get rid of the elses's
-
Trying to use php rand() function (newbie)
benanamen replied to DavidAbineri's topic in PHP Coding Help
You have the $ sign bass ackwards. It comes first. -
If you are going with a Windows WAMP, Laragon is the best one out of all of them for many reasons. I have used them all. https://laragon.org/
-
You would first need to trim the POST array as a space would bypass the check.
-
Just an FYI, Tables for layout went out in the 90's, We use CSS now.
-
@gizmola and I both gave you code that you have not implemented. You should spend some time going through this PDO tutorial. Making a PDO connection is one of the simplest things you would ever need to do. https://phpdelusions.net/pdo This is all that is required to make a PDO connection. Anything you do beyond this, you should know exactly WHY you are doing more. $con = new PDO("mysql:host=localhost;dbname=test", 'root', '');
- 1 reply
-
- 2
-
Call to undefined method in included file
benanamen replied to richarddunnebsc's topic in PHP Coding Help
Why are you extending PDO? There is no reason for you to do that and you haven't "extended" anything. You already create a connection in Config.php. Why are you recreating it again in Data.php? Take a look at my "Clean PDO" example. https://github.com/benanamen/clean-pdo -
Favor traits with interfaces over inheritance
benanamen replied to NotionCommotion's topic in PHP Coding Help
The best books I have found that deals with the Party Model A.K.A "Universal Data Model" is "The Data Model Resource Book" volumes 1-3 by Len Silverston. Your project is a perfect fit for this data model. You will end up needing to re-think how you are currently looking at your data. There are no tenents or vendors. There are parties that have one or more roles that could be a tenent, vendor or anything else. it is possible that a party has multiple roles such as being a tenent AND a vendor. Your current model could not handle that without duplicating data. The party model, no problem and no redesigning or duplicate data whatsoever. https://www.amazon.com/Data-Model-Resource-Book-Enterprises-ebook/dp/B006BBVQQY https://www.amazon.com/gp/product/B0033AHGMY/ref=dbs_a_def_rwt_bibl_vppi_i0 https://www.amazon.com/gp/product/B004U7MUOS/ref=dbs_a_def_rwt_bibl_vppi_i1 -
Favor traits with interfaces over inheritance
benanamen replied to NotionCommotion's topic in PHP Coding Help
IMO, your whole model is off. You would really benefit from implementing the "Party Model". Without getting too deep into it,... at the root you have a Party. A Party is either a Person or an Organization. It then branches off from there. The Party Model is infinitely scalable without having to ever re-design anything. * When you start duplicating things, i.e names, phone numbers, etc, that is a good sign you probably have a design problem. Here is an example. -
changing from mysql to mysqli but it won't connect?
benanamen replied to Tpick's topic in MySQL Help
"Every resource" is wrong. Try reading the free manual. This is too simple to just give you the answer. https://www.php.net/manual/en/mysqli.quickstart.connections.php https://www.php.net/manual/en/mysqli.select-db.php