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

  • SEARCH
  • Home
  • 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 8322285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:20:11+00:00 2026-06-08T23:20:11+00:00

I have little php code for daily audit transaction.I make simple to get the

  • 0

I have little php code for daily audit transaction.I make simple to get the point.

$result = mssql_query("BEGIN TRAN");    
$result = mssql_query("insert into items_history (select * from items)");   //move transaction to history
$result = mssql_query("delete * from items)");                                  //clear transaction table for new month transaction
$result = mssql_query(                                                          //get the data for used in another script 
            "select items_history.item_id,
                items_history.item_name,
                group_items.group_name 
            from 
                items_history,group_items 
            where group_items.id=items_history.id and 
                day(items_history.date_trans)=day(items_history.date_trans)-1 "                     // whit where include 
            );
$result = mssql_query("update trans_control set current_day=current_day+1"  };  //update the system date to next day

if (!$result) {
     mssql_query("ROLLBACK TRAN");
    } else {
     mssql_query("COMMIT TRAN");
    }
mssql_close();

For some reason, this database need to store online with mysql database.
in offline, i am not much wory about secure with this code. But in online, it make me think allot about secure.
And now i want to convert this script in to PDO MySql.
the goal is simple with more secure:

$result = q("BEGIN");   
$result = q("qry1");
$result = q("qry2");
$result = q("qry3");// select with many join table and some parameter data in where like 'string','int', 'date', and maybe with "Union All" in select
$result = q("qry..."};

if (!$result) {
     q("ROLLBACK");
    } else {
     q("COMMIT");
    }

If another question have problem same like this. I am glade to start with that, specially simple wrapper, so i can learn how it work.
thank you to before.

  • 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-08T23:20:14+00:00Added an answer on June 8, 2026 at 11:20 pm

    The security should be no problem as long as you use bound parameters, see http://www.php.net/manual/en/pdostatement.bindparam.php and http://www.php.net/manual/en/pdostatement.bindvalue.php

    And for your transactions you can emulate the same thing by using these methods:

    http://www.php.net/manual/en/pdo.begintransaction.php instead of your BEGIN TRAN query,
    http://www.php.net/manual/en/pdo.commit.php instead of COMMIT,
    http://www.php.net/manual/en/pdo.rollback.php instead of ROLLBACK

    But if the queries are exactly the ones from your first code sample I don’t see any external parameters that could cause security issues

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

Sidebar

Related Questions

Our website code is written in PHP. We have very little testing in regards
its a little bit hard to understand. in the header.php i have this code:
Hey there, I have this little php code: <p class=category_text><? echo $category_text; ?></p> I
I have inherited some PHP code (but I've little PHP experience) and can't find
I need a little help with the fsockopen function. I have this PHP code:
I have a little problem with some preg_replace functions in PHP. First I have
This is a little tricky so bear with me: I have a PHP script
Suppose I have some PHP code running inside a web server, for example, running
I have a simple php site that I built, but for some reason my
I have a little PHP application in which I am attempting to display Google

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.