Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. Yes. You can create Stored Procedure in PhpMyAdmin.
  2. Here is one example that how you can write it. For that we have to first change the delimiter sign so that we can execute the query.
  3. delimiter //
  4. CREATE PROCEDURE Sample(IN userID INT, OUT userName VARCHAR(20))
  5. BEGIN
  6. SELECT UserName INTO userName FROM TblUsers WHERE UserID=userID;
  7. END
  8.  
  9. Here is the PHP code. MYSQL: calling sp with out variables.
  10.  
  11. $rs = mysql_query( "CALL getCountry(1, @userName)" );
  12. $rs = mysql_query( "SELECT @userName" );
  13. while($row = mysql_fetch_assoc($rs))
  14. {
  15. echo $row['@userName'];
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement