Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8588277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:46:08+00:00 2026-06-11T22:46:08+00:00

I was using http://www.yiiframework.com/doc/guide/1.1/en/database.dao Data Access Objects (DAO) uses PDO. Was unsure which was

  • 0

I was using http://www.yiiframework.com/doc/guide/1.1/en/database.dao

Data Access Objects (DAO) uses PDO.

Was unsure which was best

Option One – Inline Code

    $alias_name =Utils::checkEnteredData($alias_name);
    $connection = Yii::app()->db;       
    $sql_images = $connection->createCommand("SELECT ig.id, 
        ig.is_flickr,                     
        ig.main_image,
        ig.author_id,
        ig.description,
        ig.latitude, 
        ig.longitude,
        ig.is_youtube, 
        ig.author_id,       
        ig.flickr_youtube_id, 
        ig.thumbnail_image_medium, 
        ig.thumbnail_image, 
        ig.alias_title,
                    ig.image_hits, 
                    ig.title, 
                    ig.created_on,
        a.title,
        a.alias_title as album_alias_title,
        igo.realname, 
        igo.username,
                    igo.location from image_gallery ig 
                    JOIN album a ON ig.album_id = a.id 
                    LEFT JOIN image_gallery_owner igo ON ig.author_id = igo.id  
                    WHERE ig.approved =:approved AND ig.visible=:visible AND ig.alias_title =:alias_title LIMIT 1");
    $sql_images->bindValues(array(':alias_title'=>$alias_name, ':approved'=>'Yes', ':visible'=>'1'));               
    $image = $sql_images->queryAll();

Option 2 Stored Procedure:

  public function getImageFromAliasTitle($alias_title)  
        {     
            $alias_title =Utils::checkEnteredData($alias_title);  
            $connection = Yii::app()->db;   
            $command = $connection->createCommand("CALL getSingleImage(:alias_title)");   
            $command->bindParam(":alias_title",$alias_title,PDO::PARAM_STR);  
            $image = $command->queryAll();  
            return $image;  
        }  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:46:09+00:00Added an answer on June 11, 2026 at 10:46 pm

    It depends, but I’d still recommend on using stored procedure for your case. The major reasons being(Taken from a previous answer):

    1. Stored procedure have the of benefits of no need to grant users direct table access.

    2. Since each non-parametrized query is a new, different query to SQL Server, it has to go through all the steps of determining the execution plan, for each query (thus wasting time – and also wasting plan cache space, since storing the execution plan into plan cache doesn’t really help in the end, since that particular query will probably not be executed again)

    3. Non-parametrized queries are at risk of SQL injection attack and should be avoided at all costs.

    This is an interesting read too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm following the information here: http://www.yiiframework.com/doc/guide/1.1/en/topics.logging Please take a look at my log component
I am using jqGrid ( http://www.trirand.com/blog/ ) to display some read-only data. The resizeable
Hy! I am using easyfacebookandroidsdk( http://www.easyfacebookandroidsdk.com/guide.asp ) for posting a status in facebook. I
Using this tutorial: http://www.c-sharpcorner.com/uploadfile/UrmimalaPal/creating-a-windows-phone-7-application-consuming-data-using-a-wcf-service/ I have created sample/hello world application on the windows phone
I'm using http://www.phpaes.com/ to encrypt some values and store them in a MySQL database.
When reading YIi guide at this link: http://www.yiiframework.com/wiki/327/events-explained/ , I have see this line:
I'm revamping a site using http://www.designinfluences.com/fluid960gs/ Fluid 960 uses uses MooTools as well as
So I've tried this: http://www.yiiframework.com/wiki/285/accessing-data-in-a-join-table-with-the-related-models Basically I have a table called User which relates
In my application i want to get the weather report I'm using http://www.google.com/ig/api?weather= for
I'm using this ( http://www.j-download.com/demo/demo-j-dcontact.html ) form on my website. It works great but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.