Highlight table row using Javascript
if(document.getElementById(id).hasChildNodes()){
var ctds = document.getElementById(id).getElementsByTagName('TD');
for(var chld = 0; chld < ctds.length ;chld++ ){
ctds[chld].className ='selectedFromList';
}
}
if(document.getElementById(id).parentNode){
var ctrs = document.getElementById(id).parentNode.getElementsByTagName('TR');
for(var chld = 0; chld < ctrs.length ;chld++ ){
if(ctrs[chld].id != id){
var ctds = ctrs[chld].getElementsByTagName('TD');
for(var chltr = 0; chltr < ctds.length ;chltr++ )
ctds[chltr].className = 'noteSelectedNorm';
}
}
}
Remove the blank bottom area in the html form
Convert MYQL timestamp format from php date function
Create object for php mailer class
$sendmail = new PHPMailer();
$sendmail->From = 'user@domain';
$sendmail->FromName = 'Name';
$sendmail->AddReplyTo('user@domain', 'Name');
$sendmail->AddAddress('email');
$sendmail->WordWrap = 50;
$sendmail->IsHTML(true); // set email format to HTML
$sendmail->Subject = 'Mail Subject';
$sendmail->Body = 'Mail Message';
$message = "Added new Bets";
if($sendmail->Send()){
$message = "";
}
How to validate the FCK Editor content using Javascript
set time limit for a script execution
window.open: Create a new html window with the content in the parent window
Create a HTML page by executing PHP script
Whether Session works without cookies enabled in the browser?
How to Import data into MYSQL Database(Linux)?
MYSQL command to view and delete the stored procedure
MYSQL:Set AUTO_INCREMENT attribute to the field name
Change Font Size and Color using Javascript
We can change the size and font of TEXTAREA or any element using the id of the element
Ex:
textarea cols="20" rows="10" id="txtarea"
input name="button" value="ChangeFont" onclick="changeFont()" type="button"
function changeFont() {
document.getElementById('txtarea').style.fontWeight = 'bold';
document.getElementById('txtarea').style.fontFamily = 'arial';
document.getElementById('txtarea').style.fontStyle = 'italic';
document.getElementById('txtarea').style.fontSize = '14px';
document.getElementById('txtarea').style.color = 'red';
}
MYSQL STORED PROCEDURE
By creating SP for application, we can create our logic seperate from the application. The main advantage for using this is we can reuse the code for differenct languages with ease.
Ex:
CREATE PROCEDURE `sp_user`(
id int,
name varchar(64),
type_id int,
OUT out_status varchar(10)
)
MODIFIES SQL DATA
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION,SQLWARNING,NOT FOUND
SET out_status = 'error';
IF id > 0 THEN
//Call the update query
ELSE
// Call the insert query
END IF;
SELECT out_status;
END;
You can call the procedures using the command : CALL `sp_user`(0,'user1','1',@out_status)