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" <[EMAIL PROTECTED]>
To: "Jeroen Timmers" <[EMAIL PROTECTED]>
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 ([EMAIL PROTECTED])
> wrote:
>
> > what would you like todo?
> > explain further
> >
> > Jeroen
> > ----- Original Message -----
> > From: "Hayan Al Mamoun" <[EMAIL PROTECTED]>
> > To: "PHPList (E-mail)" <[EMAIL PROTECTED]>
> > 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
> > >
> > >
> >
> >
> >
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to