Dear Charlie
I gave you an example. I know  mysql_insert_ id is use for getting last id.
The purpose of the question is some experience person told me that if you are 
using more then one queries continuously it is not a good practice use the 
procedure for defining all the queries and use it in your program That 's why I 
ask this.
How to use a procedure in php?  
I am sure you understand it.

Imran Shafiq Khan

--- On Fri, 16/4/10, ya...@southcot.com <ya...@southcot.com> wrote:

From: ya...@southcot.com <ya...@southcot.com>
Subject: [php_mysql] Re: Question about MySQL Procedure??
To: php_mysql@yahoogroups.com
Date: Friday, 16 April, 2010, 11:31







 



  


    
      
      
      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_my...@yahoogrou ps.com, imran shafiq <jibreel_amin@ ...> 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_my...@yahoogrou ps.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]

>





    
     

    
    


 



  






      

[Non-text portions of this message have been removed]

Reply via email to