Wednesday, October 29, 2008

Invalid Parameter Submit.x in HTTP Post

I thought I'd done the code wrong though I was really wondering how it could go wrong with just some keys and values for my HTTP post. Usually, you'll just put the following code for your simple HTTP post, right?

< form method="post" action="(wherever you want to post this form to)" >

Upon posting, if you have images within the form, there will be additional parameters for its x and y positions. Thus if you're posting to a page which is strict with the parameters, you'll end up with an "invalid parameter" error or the like.

Just add an onsubmit attribute in your form tag to clean up the x and y parameters, like so:

< form method="post" action="(wherever you want to post this form to)" onsubmit="this.submit();return false;">

Thanks to webmasterworld for this info.

Monday, October 27, 2008

Using ClientFlags in ADODB Lite to Execute MySQL Stored Procedures

I am currently programming a cron in PHP using ADODB connection. (See sample connection.)

$dbConn =& ADONewConnection(DB_DRIVER);
$dbConn->Connect($dbServer, $dbUsername, $dbPassword, $dbName);
$dbConn->SetFetchMode(ADODB_FETCH_ASSOC);

I thought it worked fine but when I checked on the supposed updates in the database, I found that the stored proc wasn't executed. Upon checking on the net (and I might say it took a while on pinpointing the real problem due to limited sources), I found a solution that inserted the ff. code for clientflags similar with mysql connections:

$dbConn->clientFlags = 131074;

I needed to understand what 131074 means until I found an explanation (ironically on Drupal) with regards to this, telling that the value sets the client flags to CLIENT_MULTI_RESULTS.

The stored procedure doesn't know ahead of time how many results will be returned so the client needs to support reading any multiple of results.

So here's the corrected code:
$dbConn =& ADONewConnection(DB_DRIVER);
$dbConn->clientFlags = 131074;
$dbConn->Connect($dbServer, $dbUsername, $dbPassword, $dbName);
$dbConn->SetFetchMode(ADODB_FETCH_ASSOC);

Monday, September 1, 2008

How to View Content Body of Stored Procedure in MySQL

Unlike MSSQL's sp_helptext that lets you view the body of an SQL object (i.e. table, stored procedure, function), MySQL has different commands to view each object's contents.

The commands "show create procedure" and "show create function" are used to check on the contents of either a stored procedure or function, respectively. Simply append the name of the SP or function after the corresponding command like so:

show create procedure spGetData;


Note that you should have privileges for the said routine in order to display the contents of the SQL object. Otherwise, it would return NULL.

Thursday, August 21, 2008

How to Remove Underline in Hyperlink

Despite being an IT person, I don't delve much into HTML until now because of my new job. So when I was doing a popup window and did buttons via hyperlink (I didn't know then that window.open can still be used via document.write), I was boggled with the underline.

To remove the hyperlink put style='text-decoration: none;' like so:

< a href="http://iamner.blogspot.com/" style="text-decoration: none;">
< value="Sample" type="button">
< /a>

Output:

Note: Codes supplied were intentionally given spaces in order to be read in this post.

Tuesday, June 3, 2008

VLC Media Player

I've been having difficulty playing my AVI file in Windows Media Player because of the codec that was missing. So I installed XVid in my computer. Still having problems.

I tried it with QuickTime Player but it also prompted for a missing codec.

So I installed DivX instead and tried to play it with DivX Player. To my delight, the video played. But with no sound!

I searched through DivX' online help and found an article stating that I run GSpot to check if I have the correct codec for my video/audio. So I installed GSpot and ran the program. I got this "Failed to connect output pin on AVI Splitter" message when I tested for the audio codec. Yet the program told me that I had the correct audio codec.

So as a last resort (thank God!), I downloaded VLC Media Player, which had its own codec and voila! I can watch my AVI file now! Whew!

Thursday, March 6, 2008

Could not access CDO.Message

I encountered this error (Could not access CDO.Message) upon sending email. The article The scary "Could not access 'CDO.Message' object" helped me in solving this problem just by modifying my previous code:

SmtpMail.SmtpServer = "IP_address"


to

SmtpMail.SmtpServer.Insert( 0, "IP_address")


where IP_address is the IP address of the SMTP server.

My officemate explained to me that this is a known issue of .NET 1.1 Framework. He said that the above-mentioned code will do as a workaround, but not all the time. Bummer.
Your Ad Here