|
||||||
| Database & Database Programming MySQL, Oracle, SQL, PL/SQL, ABAP, Smart Forms, and other databases and languages. A database is an organized body of related information used in many websites (including CC). |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Hello there. In order to improve speed of my php code, I would like to rewrite it to an MySQL Stored Procedure, is there anyone who can help med with this? is it even possible to do?
what I want to do is this, written in some kind of pseudocode Code:
for each post in table x
select * from table y where y.id=x.yid
if match not found
insert into y
else
if x.value = y.value
update y set y.date = now();
else
update y set y.value = x.value
endif
endif
endfor
|
| Sponsored Links |
|
|
|
|||||
|
Yes, that is possible. It doesn't look like the code in PHP will slow your script down that much though. In my experience (working with DBs and PHP), PHP is always faster to execute conditional statements than using the database to execute these statements.
Here is a guide that will help you write your stored procedure though: MySQL :: MySQL 5.0 Reference Manual :: 18 Stored Procedures and Functions
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
|
|||
|
yepp, that is the very manual, yes
unfortunately, it doesn't really explain how you really make them work i guess i would need an sp for dummies or an howto-sp-file about it instead, which describes sp from the user perspective rather from the database perspective. any suggestions of anything online? |
![]() |
| Tags |
| mysql, stored procedure |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Tutorial: Storing Images in MySQL with PHP | Jordan | PHP Tutorials | 10 | 06-22-2008 07:02 PM |
| Tutorial: PHP to MySQL | Jordan | PHP Tutorials | 5 | 04-22-2008 09:15 AM |
| MYSQL CheatSheet - A must for MySQL Users | reachpradeep | Database & Database Programming | 1 | 03-03-2007 03:05 PM |
| Toad for MySQL | Lop | Database & Database Programming | 0 | 12-06-2006 11:07 AM |
| MySQL Resources | dirkfirst | Database & Database Programming | 1 | 05-25-2006 02:31 AM |