Re: Re: [PHP-DB] Maintain MySQL Transactions
| From: | Jeroen Timmers | Date: | Sat, 09 Feb 2002 17:01:42 +0000 |
| Subject: | Re: Re: [PHP-DB] Maintain MySQL Transactions | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-16755@lists.php.net to get a copy of this message | ||
you must first connect to the mysql database,
for example
$dbhost = "localhost";
$dbuser = "DATABASE USER";
$dbpass = "DATABASE PASSWORD";
$database = "DATABASE NAME";
@mysql_connect($dbhost, $dbuser, $dbpass) or die ("Deze pagina is
tijdelijk offline.");
@mysql_select_db($database) or die ("Deze pagina is tijdelijk offline.");
after the connect you need to query the stuff
for example
$result = mysql_query("select * from table where id > 5");
while ($row = mysql_fetch_array($result))
{
echo $rij[0];
echo $rij[id];
}
/* delete query */'
$result = mysql_query("delete from table where id = 1");
$nr = mysql_affected_rows($result);
echo $nr . "rows are deleted.";
i hope you have enough info
the examples are not tested.
Jeroen Timmers.
http://www.php.net/manual/en/ref.mysql.php
----- Original Message -----
From: "Hayan Al Mamoun" <hayan@ureach.com>
To: "Jeroen Timmers" <jeroen@start4me.nl>
Sent: Saturday, February 09, 2002 12:54 PM
Subject: Re: Re: [PHP-DB] Maintain MySQL Transactions
> I have two sql statements, and I want to execute them all or
> nothing at all.
> For an example
> 1- Delete * from sometable where Id=SOMETHING
> 2- insert into OtherTable (fieldlist) values (valuelist) where
> Id=SOMETHING.
> How can I do so?????
>
>
>
>
> ________________________________________________
> Get your own "800" number
> Voicemail, fax, email, and a lot more
> http://www.ureach.com/reg/tag
>
>
> ---- On Sat, 9 Feb 2002, Jeroen Timmers (jeroen@start4me.nl)
> wrote:
>
> > what would you like todo?
> > explain further
> >
> > Jeroen
> > ----- Original Message -----
> > From: "Hayan Al Mamoun" <hayan@ureach.com>
> > To: "PHPList (E-mail)" <php-db@lists.php.net>
> > Sent: Saturday, February 09, 2002 7:51 AM
> > Subject: [PHP-DB] Maintain MySQL Transactions
> >
> >
> > > Hi, How can I maintain MySQL transactions with PHP
> > >
> > > Best Regards
> > > Hayan
> > >
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> >
> >
>
>