Jump to content

duniya

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

duniya's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi effigy, Thank you for your reply. I have had a look at the link you posted. As you said I would prefer to use mysqli. When you said, "pass a MySQL variable as the OUT parameteter--@out, for example--and then run SELECT @out." Did you mean I should do something like: $db->query("call emailCount('$mail', '@out')") ; $result = $db->query("Select @out") ; I assume then I would need to process the $result variable to retrieve the @out value? If i do it this way using mysql variable. If two different scripts were to call this stored procedure emailCount(..) will there be two mysql variable called 'out' or would both scripts used the same 'out' variable? if I was to do it as a stored function would I do it like this? $result = $db->query("SELECT same_addr_cnt('email')") ; Then process the $result variable? I know that stored procedures and stored function differ in the sense that: - stored function can return a value whereas stored procedures can not. - all parameters to stored functions can only be input parameters. Is there any performance of security issue between stored procedures and stored functions that I should be aware of? Once again thank you for your time. Best regards, Duniya.
  2. Hi all, I am using Mysql 5.0.41 and PHP5 compiled with MySqli I have searched google, read mysql & PHP documentation but for some reason I cant seem to understand how to retrieve the OUT parameter of a mysql stored procedure in PHP. Does anyone have any ideas??? for example I have the following stored procedure: -------------------------------------------------------------------------- create procedure emailCount(address varchar(100), OUT counter tinyint(2)) select count(email) into counter from temp where email = address; --------------------------------------------------------------------------- The store procedure is used to find how many rows in the temp table has the same email address. In PHP I call the procedure <? include("db.inc.php"); $db = db::connect(); //I am using the singleton pattern for the database connection $count = 0; $mail = 'email@gmail.com' ; $db->query("call jsp_emailCount('$mail', '$count')") ; echo $count ; ?> But the $count variable doesnt get updated. I have verfied that the stored procedure does work from mysql command line. Thanks in advance for any help Best regards
  3. I have decided to use the singleton pattern when implementing db connection. Make more sense now after reading http://www.tozz.org/php/simple-database-connection-using-the-singleton-pattern-in-php
  4. Thanks. That makes sense in your situation. However, I am still not sure why would you implement a database connection has a singleton. Basically, I am building a web application and evaluating whether to use the singleton pattern to make database connection. Maybe using the singleton pattern for db connection I would not have to enter db connection details all over the place. Though I could overcome this by including db.inc.php file which contains connection details and then include this file to all other files. Best regards.
  5. Hi, I want to know why implement the singleton pattern in php? I am trying to work out if there is any real benefit in using this pattern in PHP or if it is just an unnecessary overhead. I have searched on google and read posts on several forums but I am still having trouble fully understanding the real benefits. The most common example used to explain the singleton pattern in PHP is database connection. Like the example in the PHP documentation about the singleton pattern. It explains, " Implementing this pattern allows a programmer to make this single instance easily accessible by many other objects". I kind of understand why this would be useful in c++ or java but I really cant understand why it would be useful in a scripting language such as PHP. From what I gather in PHP each request creates a new PHP environment on the server i.e each request is a fresh request and as no knowledge of any other requests. However, with C++ and Java application has common memory which can remember between requests etc... Going back to the common example of db connection being implemented as a singleton pattern. Isnt it true by calling mysql_connect() with the same arguments will used the last database connection anyway. I would appreciate your thoughts. Best regards.
  6. Hi, From what I gather is you have setup an email address for your friend using your domain name. i.e. your_freinds_name@your_domain_name.com or something like that. My understanding of google apps for domain is that you set up email address using your domain name but google do all the back end stuff. So you can set up email like your friend existing email address. Though I dont know how the back end stuff is set up..Another way is to set up a google email account up under your freinds name, like yourfriendsname@googlemail.com because google email allows you to fetch email from other email accounts. "How do I set up Mail Fetcher? Google Mail allows you to fetch mail from your other, non-Google Mail accounts. You'll be able to read email from up to 5 additional accounts, all in one place, and take advantage of all of Google Mail's great features. Note that the email accounts you would like to fetch will need to support POP access. Some free email services don't support POP access at this time."
  7. Hi, dont know if this helps but have you look into google apps for domains https://www.google.com/a/ or microsoft equivalent. It allows you to offer email accounts using your domain name but without the headache of providing the infrastructure.
  8. It might be a permission issue. Does the php process have correct permissions on the folder/images to delete the images? Hope this helps.
×
×
  • 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.