Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





PDO Transactions Life Span


Do transactions automatically commit or rollback after a specific period of time? does mySQL close its connection after a specific time? or maybe PHP closes the connection?

I've got quite a semi-complicated script that takes about 85 seconds to execute usually. This is due to it accessing remote files etc as that just adds time. Code:




View Complete Forum Thread with Replies

Related Forum Messages:
Php4 End Of Life
How long will PHP4 be supported ? When is PHP4 end of life scheduled ?

View Replies !
Equation Help - Half Life.
I am looking for some help setting up a half life equation in PHP. Does anyone have a prerolled function they would care to share?

View Replies !
Echo Span Tag
Can someone tell me how to echo the below code into a span tag?

<td class="state-<?php echo $player[1]; ?>">

I thought this would be correct, but I haven't gotten it to work yet

<span style='color:state-".$player[1]." '>

View Replies !
Session Id In A Long Life Cookie
Okay, my session's cookie is by default set to destroy on session closure. I want to make this cookie last 30 days. the only way I came up with is to put:

session_set_cookie_params()

before every time I say session_start(). Is there an easier way to do this? something that I can do only once?

View Replies !
Searching A Span Of Years
I have a database that allows users to enter the years that a boat has been built.

For example say a user enters the years a boat has been built. Say from 1970 to 1980.

Now another users wants to search for boats that were built between 1975 to 1980.

I need to have the boat that was built between 1970 and 1980 to show up in the search.

Should I have a separate field for first year built and then another field for the last year built?

An then how can I have the code calculate the years between 1970 and 1980 for the search page?

View Replies !
How To Change Css Id In Span Element?
How to change a link's color based on a php variable?

I have a number of links on a page:

<p><a href="page1.php">Page 1</a></p>
<p><a href="page2.php">Page 2</a></p>
<p><a href="page3.php">Page 3</a></p>
<p><a href="page4.php">Page 4</a></p>

I want the link to be red if $nav has a value that corresponds to the page
number: If $nav = 1, then the page1.php link should be red; if $nav = 2,
then the page2.php link should be red, and so on.

This is how I'd normally code the html to make a red link:

<p><span id="red"><a href="page1.php">Page 1</a></span></p>

But how do I check the value of $nav and insert the appropriate span id for
each link? Can I somehow make the span id a variable? How to I jump in and
out of php within a tag?

If $nav does not correspond with the link's page number, then the link
should remain the default color - which is blue:

<p><span id="blue"><a href="page1.php">Page 1</a></span></p>

View Replies !
In Search Of A Span Of Class.
Within a subsection of an HTML document (not a complete page), there will be
a few spans with the class "room_headings"
e.g.
<span class="room_headings" Double
Room</span>

Can folks suggest some nice ways of extracting all the text contents of such
spans into a list (for use in a drop-down select list)?

View Replies !
Regex For SPAN Tags
I need to able to use a regex within preg_replace to find a specified span tag and replace EVERYTHING between the tag and the </span> (the opening span can contain a number of params, the search term will always be the value of the id), there will be no embedded spans and even if there were I don't care what they are, I just need to replace them I've been playing around with regexs for hours without any success. example: Code:

<span id="left1" style="color:red" otherparam="blah">I need to replace this text</span>

or Code:

<span id="right1">I might also need to replace this too</span>

View Replies !
Real Life Examples Of Mysql+session_set_save_handler
In my test setup using my own session handlers with session_set_save_handler and mysql, the session handler opens and close mysql connections.

But what if my page also requires some mysql queries? Should I open a new connection or use the already opened one (opened by the session handler)?

I have made it a good practice to close a connection after a query but if I do it with only connection open no session data will be written to my mysql table.

I have seen some scripts using persistent connections but are not sure what would be the best for a real world environment.

View Replies !
Last Ditch Attempt To Prolong The Life Of A Dying RH9 Server
does anyone know where I can get php4.4 or php5 rpms (including all dependencies) for RedHat 9.

View Replies !
Calculating Span Between Earliest And Latest Dates
I'm wanting to find the span between the earliest and latest date in my database so I can calculate how many applications are filled out every day. It would be incredible if I could exclude weekends, but that's not necessary at this point.

When I'm using a "date" type field in MySQL, I can use this ugly code:

View Replies !
Transactions
I have a program for 15-20 users and 1 admin guy to override everything.
The program is on the web and accesses a mysql db. Now what happens with php transactions  as I heard it does something automatically in terms of locking on a mysql db.

The users cant delete anything or update any existing data but just add. The only problem i can see is that if the admin decides to delete a user and associated records must be deleted from other tables. Now do I need to lock the tables to do this so they cant be used while this is being done?

View Replies !
Do You Use Transactions With PHP And MySQL?
I'm debating whether to use transactions for multiple inserts, updates, deletes .. or to not with the belief that it is very unlikely that a rollback would ever be necessary. What is everyone's stance on this and what has your experience been with and/or without transactions (where they might be needed)?

View Replies !
Php And Mysql Transactions
I am trying how to learn how to use transactions and commit/rollback with php. if I run the transaction, does it return true? how do i know there is an error, so i know to send a commit or a rollback? PHP Code:

View Replies !
Php 4.2, Mysql 4 And Transactions
Has anyone done any work with mysql 4 and using transactions from a php script? I am hoping to see a example(s) of program flow and syntax usage, since mysql.org is seriously lacking in documentation around this functionality.

View Replies !
E-Commerce Transactions
I would liike to give facility to purchase goods from my site by credit card. I don't have slightest idea how it all works. Where I can learn this technology.

View Replies !
Using Transactions In MySQL + PHP
My doubt is related with MySQL and Transactions (InnoDB) so here it
goes:

I have a query like this:

$query = 'START TRANSACTION; '
$query .= 'UPDATE sections '
$query .= 'SET position=position-%d '
$query .= 'WHERE position %d; '
$query .= 'DELETE FROM sections '
$query .= 'WHERE id IN %s; '
$query .= 'COMMIT;'

$result = $db->query(sprintf($query, count($id), $db-

Quote:

View Replies !
Bank Transactions?
I'm trying to learn if there is a method in which through PHP I would be able to make any money transactions with banks.

For example, I'm developing an accounting software based off PHP, and I'm thinking.. in order to communicate with the banks I might need to use a merchant to do so? Or is there a work around to that?

I just need a push in the right direction for this, I might be wrong completely in trying to use PHP to do so.. so what language would be good to do that?

View Replies !
Postgresql... Transactions?
i studied them in theory and typed some transactions using oracle. But it's time to write an aplication in wich i need to use transactions. i am using postgresql and writing the aplication in php.

can anybody paste here a fragment of code where i can see a transaction coded in php using postgres? Code:

View Replies !
Failed Transactions
For instance I'm dealing with products and inventory, I have a transaction that executes various updates. In between some of the transaction updates I use an item class to pull additional information from the database, the functions in this class make use of
Code:

$result = mysql_query($sql) or die("failed");

What would happen if the query in the item failed and killed the script, not letting the rollback query execute?

Would the transaction rollback after x time? Is x a configurable variable, and I presume if it is it's in the mysql cfg not php? Short of updating the functions used to return false rather then terminating, is there anything I can do to force a roll back if the script terminates before a commit or rollback query?

View Replies !
Transactions In PHP On SQL Server 2005
I'm trying to get a transaction to work with PHP 5.1.4 and SQL Server
2005... The first SQL statement deletes several rows in the database.
The next SQL statement loops through and inserts several rows into the
same table. What I'm wanting is for the database to rollback all
transactions if any 1 of the inserts fail. What's happening now is the
DELETE statement runs successfully deleting several rows... but as soon
as one of the INSERTS fail, the page errors out WITHOUT rolling back
the DELETE statements. What am I doing wrong in my code?

mssql_query("BEGIN TRAN");

$sql = "DELETE FROM MyTable WHERE Value 0";

$result = mssql_query($sql);

foreach(loopVar as val)
{
$sql = "INSERT INTO MyTable VALUES(1)";
$result = mssql_query($sql);

if( ! $result ){
mssql_query('ROLLBACK TRAN');
exit;
}

}

mssql_query("COMMIT TRAN");

View Replies !
Transactions Or Lock Tables Or Both??
Very general question about using transactions and lock tables. Do you use both in conjunction with eachother or one rather than another in certain scenarios etc.?

Does transactions BEGIN, COMMIT, ROLLBAck etc. stop others from updating the table at the same time or just ensures that that particular transaction occurs completely or not at all?

Using LOCK TABLES on InnoDB and using MySQL i read some material on the fact that both the InnoDB and MySQL get locks and that this can lead to possible deadlocks, does anyone know more about this?

SO in general just looking for some insight into Transactions and LOCKS and maybe some scripts to get a proper visual of how they work.

View Replies !
Inserting Multiple Transactions Into One Table
I am trying to insert multiple transactions into one table. Basically the user fills out a form and then checks a few boxes. What I need is to have a seperate row inserted into a table for each checkbox they check.

<input type=checkbox name=id value=1>
<input type=checkbox name=id value=2>
<input type=checkbox name=id value=3>
<input type=checkbox name=id value=4>

So if they would check all 4 boxes then it would insert 4 seperate rows into the table...
The checboxes are queried from a database so the amount of checkboxes shown can change anytime as well as the value. Right now it just inserts one transaction which is for the last id.

View Replies !
Secure Credit Card Transactions
I'm looking for some way of organizing secure credit card transactions hopefully via PHP. Are there any good libraries or something out there that would be useful? Obviously, security is the main issue.

View Replies !
Set Up Transactions To The Authoize.net Payment Gateway
I am trying to set up transactions to the authoize.net payment gateway. After running a test transaction I get this error back: Error with Transaction:
SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

I do not have an SSL umbrella over this page. Is their anything I could put in my code that might would overive this?

View Replies !
(n00b) One Script, Multiple Transactions
I'm currently trying to write a simple unit converter script. I thought
I saw a tutorial somewhere that used isset() to determine whether the
script is running for the first time, initialize if so, perform the
usual function otherwise.

But my own attempt at this doesn't seem to
work. Every time I hit Submit, my start-up branch runs, variables are
re-initialized, units not converted. Code:

View Replies !
FIXED: PEAR::prepare Problem With Transactions
I spent all this afternoon to solve this problem, so I thought to write
two lines to describe this strange behaviour.....

- I'm using PHP with PEAR:DB package.
- I set autocommit to false
- I prepare a statement
- I execute it
- THE PAGE NEVER COMPLETES

SOLUTION:

- Use the 'query' method intead of the 'prepare' method. Pass the
'query' method the prepared arguments.

$res =& $DB->query('INSERT INTO person (id,username)VALUES (?, ?)',
array(1, 'Dario'));

View Replies !
MySQL Transactions Doesn't Work With Included Files?
I have a situation where I open a database connection in main script.
Then I start a transaction, have some queries, include an another php
file within some queries and then commiting queries in the main script.
All queries in the main script gets committed but those in the included
file doesn't. Why's that? Adding COMMIT query to the included file
doesn't work either. Here are an test code which clears what I mean:

the main file (test.php):
<?PHP
$db = mysql_connect ("localhost", "dbuser", "dbpass") or die ("Database
connection error!");
mysql_select_db("databasename") or die ("Database selection error!");

mysql_query("START TRANSACTION", $db);
mysql_query("INSERT INTO news VALUES (NOW(),'author','message from main
script')", $db);

include "test2.php";

mysql_query("COMMIT",$db);
mysql_close($db);
?>

and the included one (test2.php):
<?PHP
mysql_query("INSERT INTO news VALUES (NOW(),'author2','message from the
included script')", $db);
?>

So, this script runs fine, but there is just one row inserted to db (the
one from the main script (test.php)). var_dump of $db in the included
script tells as it should: resource(2) of type (mysql link)

Tables are InnoDB type and START TRANSACTION and COMMIT both returns
true (1). I also made some error handlers but those were not trapped either.

View Replies !
MySql InnoDB Transactions, Exception Handling
If I start a db transaction, using a InnoDB table in MySql, and want
to ensure that at the end I either commit or rollback, what's the
cleanest way I can implement that in PHP? Pseudo code:

start_transaction()
try
{
do stuff

commit();
}
catch (Exception)
{
rollback();
}

Can this be done in PHP like this? I want to ensure that any error at
any point doesn't leave any allocated resource around, or open
transactions around.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved