Jump to content

wincen

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

wincen's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Is it possible to execute a prepared statement that does multiple queries? For example, say I need to delete a user from my database. I would need to delete all his child records. In a stored procedure typically I would delete all the child records, like messages from the user, then i would delete the actual user record. With a prepared statement can I do the same, if so how? Otherwise would I need to run multiple prepared statements to do the same?
  2. How do you run benchmarks on these calculations? I've never done so and am curious to see the results. Does anyone have tools they can suggest? Thanks!
  3. What are the pros and cons of calculating distance from lat/lons in php vs calculating it in mysql? I've been searching online and it appears that both are able to do so, but I have yet to find which is the preferred method. Does one offer more accuracy? Is it faster to do so in mysql and just return the distance?
  4. that's an excellent idea. thanks! i've been checking some other sites and it seems that with the same message (one being from the sender while the other is the recipient) that their message ids (in the url) are different. is there an advantage to this? maybe it's a security issue? just curious.
  5. or perhaps a db isn't the way to go? maybe using files would be better? it seems that using a db would mean dealing with scaling issues. btw... the messaging system would be something like friendster's... or at least that's the idea
  6. I'm working on a website where users that have logged in can send and receive messages from each other. I'm wondering what is the best database design for messages? I want users to be able to read and delete messages that they sent as well as received - and that is my delema. Do I create two tables, one for those in the inbox, and one for those in the sent box? my initial DB deisgn was something like: messages -------------- id sender_id receiver_id date_sent subject messages status_id if i just share one entry in this table for both users, one user may delete the message but the other may not. Thus do I need two entries per table, two tables, or some other solution? Thanks in advance
  7. so in each step i would have a session variable like $_SESSION['name'], $_SESSION['email'], etc etc? it is straight forward, but it seems like it could get huge depending on what's required during registration. when you say store each step in a $_SESSION array does that mean you can put the entire dataObject into a session variable?
  8. I'm writting my own php app using a front controller and MVC. For something simple like site registration i have 1 registration model, view, and controller. i want the registration to be done in 3 steps. doing that is easy enough, but i'm wondering what is the best way to store the data the user enters in step 1 and carry it over to step 2? currently the front controller creates a new registration controller on each time the user goes to the next step. the registration controller creates a new model. the old model's information is then lost. how do experienced php developers deal with this? do you store all user registration information in session variables to the end? do you actually make database updates after each step? is there another solution that i am compeltely missing?
  9. what is PoEEA? and where can i get it to read that chapter?
  10. wow, thorpe and buyocat, those are some very nice solutions. sweet. i don't remember every article that stated using a front controller in php is bad, but one of them was the on posted by buyocat. There was also Ramus Lerdorf no-framework PHP MVC framework http://toys.lerdorf.com/archives/38-The-no-framework-PHP-MVC-framework.html in which he states He brings this point up again in one of his replys to user comments: I've been taught that implementing design patterns like front controller, MVC, and factory are very good practices when creating websites; but when the creator of php is saying that the front controller is a bottleneck it makes me question what i've been taught.
  11. does anyone know if a phpunit plugin exists for eclipse? i'd love for something like junit integrated into eclipse to work for php.
  12. I was wondering if using one script that servers all is a good architecture for a php application? If it is used in a site which grows to have lots of traffic will it still hold up? If not, what are some other suggestions? this code i think is basically a front controller that calls other controllers depending on what the user sends to the server. $driver is basically the controller for whatever page is to be called. file: index.php <?php if (!in_array ($_GET['page'], array('index', 'contact', 'about'))) { $page = 'index'; } else { $page = $_GET['page']; } $driver = false; switch ($page) { case 'contact': include 'classes\contact.php'; $driver = new Contact(); break; case 'about': include 'classes\about.php'; $driver = new About() break; case 'index': default: include 'classes\main.php'; $driver = new Mainpage(); break; } if ($driver) { $driver->Display(); } else { die ('some type of 404 message'); } ?> suggestions, improvements, criticisms are all welcome. i'm trying to build my first OO php websites and would like to know if i'm on the right track. plus i haven't used php in a few years so i might be out of touch with new features and developments. i have read a few articles that state having a front controller, or one script to server all is bad because that's what apache already does... so this may be bad for performance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.