Solved

editing the php source module

Posted on 2003-10-31
7
232 Views
Last Modified: 2006-11-17
I need to know the following:

 

1.       How to add new function to php module

2.       In that function how to write to the http stream

3.       How to access data from sql recordset
0
Comment
Question by:buck2769
  • 2
  • 2
7 Comments
 
LVL 11

Expert Comment

by:shmert
ID: 9660984
<?php
// 1. How to add new function to php module
function myNewFunction() {
    // 2. In that function how to write to the http stream
    echo "This is being written to the HTTP response stream";
    // 3. How to access data from sql recordset
    $result = mysql_query("SELECT * FROM USER");
    while ($row = mysql_fetch_assoc($result)) {
        foreach ($row AS $key=>$value) echo "$key = $value <br />\n";
        echo "<hr />\n";
    }
}

?>
0
 
LVL 1

Author Comment

by:buck2769
ID: 10272818
Yes that would be how to do it inside a php file. Read the initial question and you will find that I want add a built in function inside of php. In other words I need to write C not PHP and then recompile PHP with my added enhancements. Thanks anyways.
0
 
LVL 14

Expert Comment

by:ThG
ID: 10275213
buck2769, are you still interested in this question? I can partially help you because I already edited php/zend source.
Otherwise I can delete this question and refund your points, let me know.
0
 
LVL 1

Author Comment

by:buck2769
ID: 10409695
yes, I am still interested
0
 
LVL 14

Accepted Solution

by:
ThG earned 500 total points
ID: 10425194
ok then..
first you should definitely read http://www.zend.com/apidoc/
this will give an interesting starting point.

After that, IIRC, you are going to need more information about the ext_skel tool, and you can find them in README.EXT_SKEL file, included in php distribution.

After that, you can start testing your new extension (note that everything in php is filed as "extension", but you can builtin it if you want, it's not necessarily a shared module).

In my experience, i found more help in ext/standard/, which contains all basic functions of PHP. There you can understand how the parameter passing works and all other internal things that are not covered in the apidoc manual.

For the sql handling of course watch in the proper extension (ext/mysql/) and so on.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question