Re: Book Recommendation
David T. Ashley wrote: On 11/27/06, Nicholas Vettese [EMAIL PROTECTED] wrote: I am looking for a book that will help me understand PHP/MySQL, and the way that they work together. My biggest problem is multi-valued selections, and INSERTING them into the database. A book with great examples like that would be a huge help. Also, any websites that could do the same would be great too. Thanks, nick Beginning Databases with MySQL Beginning PHP4 PHP and MYSQL web development -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Calling Stored Procedures from PHP
Chris White wrote: On Monday 27 November 2006 09:12, Filipe Freitas wrote: CREATE PROCEDURE `getListaDeNewsflashes`(in quantidade smallint) COMMENT 'Devolve uma tabela com um número limite de newsflashes' begin PREPARE statement FROM SELECT * FROM newsflashes ORDER BY RAND() LIMIT ?; SET @limit=quantidade; EXECUTE statement USING @limit; end You seem to be mimicing the prepared query feature of mysqli in PHP5. Do you have the mysqli extension avaliable? If so, you can use things like: http://www.php.net/manual/en/function.mysqli-stmt-bind-param.php which has an example as to how to utilize a prepared query. I never really looked into mysqli, so far I only used the mysql extention in PHP. So maybe that will help. thanks -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Calling Stored Procedures from PHP
Hi, This is not a mysql thing but maybe you can help me. I want to call a stored procedure from PHP, so I tried it like normal querys: mysql_query(CALL mySP();); with no success. thx -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Calling Stored Procedures from PHP
Chris White wrote: On Monday 27 November 2006 07:59, Filipe Freitas wrote: Hi, This is not a mysql thing but maybe you can help me. I want to call a stored procedure from PHP, so I tried it like normal querys: mysql_query(CALL mySP();); with no success. thx No success how? Generally with stored procedures and returning values, you use a session variable and utilize it as OUT like so: DROP PROCEDURE IF EXISTS CURVAL $ CREATE PROCEDURE CURVAL (OUT current INT) BEGIN SELECT value INTO current FROM sequence; END $ DELIMITER ; so when I go to call curval: CALL CURVAL(@cur) and the value can be received by: SELECT @cur; My stored procedure is the following: CREATE PROCEDURE `getListaDeNewsflashes`(in quantidade smallint) COMMENT 'Devolve uma tabela com um número limite de newsflashes' begin PREPARE statement FROM SELECT * FROM newsflashes ORDER BY RAND() LIMIT ?; SET @limit=quantidade; EXECUTE statement USING @limit; end it works when I execute it on mysql monitor: call getListaDeNewsflashes(10); in php it doesn't. I think I need the out session variable like you said. But how? I will need a variable for every column? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]