I can't see any reason why you can't do that. I'm assuming that $sql2 is to get 
the id of the last insert? You can do this using mysql_insert_id:-

http://php.net/manual/en/function.mysql-insert-id.php

Charlie

--- In php_mysql@yahoogroups.com, imran shafiq <jibreel_a...@...> wrote:
>
> For Example:
> //.....mysql connection......
> $sql1="INSERT INTO Persons (FirstName, LastName, Age) VALUES
> 
> ('$_POST[firstname]','$_POST[lastname]','$_POST[age]')";
> 
> if (!mysql_query($sql,$con))      {  die('Error: ' . mysql_error());  }
> $sql2="SELECT * FROM Persons WHERE Max(person_id)");"
> //....Display the result of last record ...... 
> mysql_query("DELETE FROM Persons WHERE FirstName=' ' OR LastName=' ' ");
>  
> Is it OK practice?
> OR
> Use procedure for more than one continues queries.
> And how to use the mysql procedure for this?
>  
> 
> Imran Shafiq Khan
> 
> --- On Thu, 15/4/10, ya...@... <ya...@...> wrote:
> 
> From: ya...@... <ya...@...>
> Subject: [php_mysql] Re: Question about MySQL Procedure??
> To: php_mysql@yahoogroups.com
> Date: Thursday, 15 April, 2010, 12:57
> 
> 
> 
> 
> 
> 
> 
>  
> 
> 
> 
>   
> 
> 
>     
>       
>       
>       Can you give us an example of what you mean?
> 
> 
> 
> Charlie
> 
> 
> 
> --- In php_my...@yahoogrou ps.com, imran shafiq <jibreel_amin@ ...> wrote:
> 
> >
> 
> > Dear Expert  
> 
> > If we use three queries one after another for example
> 
> > INSERT
> 
> > SELECT
> 
> > DELETE
> 
> > Is it OK ?or we use procedure for this and how to use it?
> 
> > Imran Shafiq Khan
> 
> 
> 
> 
> 
>     
>      
> 
>     
>     
> 
> 
>  
> 
> 
> 
>   
> 
> 
> 
> 
> 
> 
>       
> 
> [Non-text portions of this message have been removed]
>


Reply via email to