MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 27th, 1999, 09:41 AM
WannaKnow
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Is there a way to include PHP3-functions or -procedures in a MYSQL-UPDATE-statement?

Reply With Quote
  #2  
Old September 27th, 1999, 12:21 PM
rod k
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Yes, sort of. How depends on what you are trying to do. (hint, hint) URL

Reply With Quote
  #3  
Old September 28th, 1999, 11:34 AM
moderator
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
It is fine if you wanted to do something like this:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
<?
mysql_query("SELECT * FROM tableName WHERE id='".customPhpFunction($var)."'");
?>
[/quote]

What exactly where you trying to do?

Reply With Quote
  #4  
Old September 29th, 1999, 05:15 AM
WannaKnow
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Thank you for your quick reply. Ok, here are some more details: I want to update all records in a table at the same time with an update-statement, which should look like this:

------------

UPDATE tableName SET field_1=myPHPfunction('$field_1')";
======

MyLib.php3:
function myPHPfunction($field_1)
{
$field_1 = [... for example: several different commands to convert special characters ...]

return $field_1;
}

------------

Although the PHP3 manual states that UDFs must be written in C or C++ and the opereating system must support dynamic loading (under point 14.1) I hope there is a way to realize a.m. example. I know from other programming languages as FoxPro for Windows that you can include „foreign“ functions into an SQL-statement. I tried above UPDATE statement in several different ways but it didn’t work.

Reply With Quote
  #5  
Old September 30th, 1999, 02:56 PM
rod k
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
UDF's need to be in C, but you can include functions written in php in your script directly or by including or requiring an external file. UDF's become a part of the language itself.

I just reread your post. Are you trying to have a query read the field and modify it based on that read?

That can't be done with one query. That's a limitation of MySQL, not PHP. Sorry.

Just a note: The latest versions of MySQL DO allow INSERT ... SELECT statements. Unfortunatly, the table(s) referenced in the INSERT cannot appear in the SELECT. I don't believe any SQL engine allows what you are trying to do.

Why not just use two queries? Select, modify, update.

Rod


Reply With Quote
  #6  
Old October 7th, 1999, 10:03 AM
WannaKnow
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Select, modify, update – that’s what I did now. Nevertheless, thanks for your help.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > PHP3-functions in MYSQL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT