MYSQL database connection using PHP for my gadget ?

130 views
Skip to first unread message

come2know

unread,
Feb 15, 2008, 4:08:07 AM2/15/08
to Orkut Developer Forum
Hi all!

I want to connect my gadget with MYSQL database using PHP, both are
on the same server.
I write database.php file having my server and database details.
and used it as follows:

<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="connect to database" />
<Content type="url" href="http://XYZ/database.php"/>
</Module>

How can I access my database in gadget?

do reply...

Thanks,

Mike Digital Egg

unread,
Feb 15, 2008, 4:25:29 AM2/15/08
to Orkut Developer Forum
Hi,

The contents of database.php will appear in the gadget when you are
using the content type url method.

So just query the database and print out results within database.php.

Hope this helps

Mike
www.learnitlists.com

come2know

unread,
Feb 15, 2008, 4:44:33 AM2/15/08
to Orkut Developer Forum
Thanks Mike!

I removed all code of database.php and echo "MYSQL connected".
I am getting the same , NOT FOUND error 404 .

I think content type url method is not working properly.

do reply..

Thanks,

Jason

unread,
Feb 15, 2008, 4:01:20 PM2/15/08
to Orkut Developer Forum
Yes, all type="url" gadgets are returning 404 errors in the Orkut
sandbox at the moment. The good news is that is a known issue that
should be resolved shortly.

Type="url" applications are limited in that you can't make use of the
existing OpenSocial JavaScript API, which severely limits your
application's social reach. You do have a few additional options,
however. For example, you can set up your PHP script to access your
MySQL database and return record information in an XML- or JSON-based
response. Then, in a type="html" app, you can use the
gadgets.io.makeRequest() method to fetch this response from your
server and display it. The beauty of this approach is that it's
flexible and affords you the ability to use the opensocial API to its
fullest.

Please let me know if you have any more questions.

- Jason
Reply all
Reply to author
Forward
0 new messages