Wednesday 3 September 2014

Dynamic pop up dialog using Bootstrap

Dynamic pop up dialog using Bootstrap
html: /php File
    <td class="center"><a style="text-decoration:none;"   data-target="#myModal2" data-toggle="modal" class="btn-lg btn-success btn-small" href="#" onclick="videolink(2)">   Play </a></td>
    <input type="hidden" id="link2" value="mov_bbb.mp4"  />
js:
<script>


function videolink(id)
        {
       
        var videofile=document.getElementById('link'+id).value;
        //alert(videofile);
        
        $("video").append("<source src='<?php echo base_url();?>img/"+videofile+"' type='video/mp4'>");

        }
function closevideo()
{
location.reload(true);
}
</script>


<div class="modal fade " id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-content1">
    <div class="modal-body">
        <video width="530" height="300" controls>
       
        </video>
    </div>
    <div class="modal-footer">
    <button type="button" class="btn btn-danger" data-dismiss="modal" onclick="closevideo()">Close</button>
    </div>
    </div>
</div>

xamp conflict with skype Error

XAMPP, Apache - Error: Apache shutdown unexpectedly

I've just reinstaled XAMPP... + when I try to start my Apache server in the Control Panel I now get following errors:

16:50:25  [Apache]  Status change detected: running
16:50:26  [Apache]  Status change detected: stopped
16:50:26  [Apache]  Error: Apache shutdown unexpectedly.
16:50:26  [Apache]  This may be due to a blocked port, missing dependencies,
16:50:26  [Apache]  improper privileges, a crash, or a shutdown by another method.
16:50:26  [Apache]  Press the Logs button to view error logs and check
16:50:26  [Apache]  the Windows Event Viewer for more clues
16:50:26  [Apache]  If you need more help, copy and post this
16:50:26  [Apache]  entire log window on the forums

SOLUTION:



If you are using the latest Skype, go to Tools -> Options -> Advanced -> connection.

Disable the "Use port 80 and 443 for alternatives for incoming connections"

Sign Out and Close all Skype windows. Try restart your Apache again.

Thanks for Ref Link:
http://stackoverflow.com/questions/18300377/xampp-apache-error-apache-shutdown-unexpectedly

SOLUTION #2

open your xampp control panel then click its "config"
choose the "Apache (httpd.conf)" and find this code below and change it into this one:

#Change this to Listen on specific IP addresses as shown below

#to prevent Apache from glomming onto all bound IP addresses.

#Listen 0.0.0.0:80

#Listen [::]:80

Listen 80

# Dynamic Shared Object (DSO) Support

save it (ctrl + s)
after that, go back to xampp control panel and click again its config
choose "Apache (httpd-ssl.conf)" find this code below and change it again:
# Note: Configurations that use IPv6 but not IPv4-mapped addresses need two

# Listen directives: "Listen [::]:443" and "Listen 0.0.0.0:443"

#

#Listen 0.0.0.0:443

#Listen [::]:443

Listen 443

save it (ctrl + s)
then, click the "config" (note: above the netstat) and click the "service and port settings" then save both of it.
finally, go to the "control panel" -> "Programs & Features" -> "Turn Windows On or Off".
Uncheck your "Internet Information Services" then click ok.
just wait for it and your computer/laptop will be automatically restart and try to open again your xampp control panel then start your Apache.

PHP Array value existing in dropdown box

PHP site Array value existing in Drop Down box

$accom=mysql_query("SELECT * FROM `busyProfile` WHERE `id`='$updateid'");
$accomdetail=mysql_fetch_array($accom);
$accom=$accomdetail['accomm'];
$accom= explode(",",$accom);
//echo $accom[0];


$getcafeDetails=mysql_query("SELECT * FROM `accomm`");   
$i=0;
while($getDetails=mysql_fetch_array($getcafeDetails))
{
    $accom_id=$getDetails['accommodation_id'];
    $accom__text=urldecode($getDetails['accommodation_text']);
   
    ?>   


<?php if(in_array($accom_id, $accom)) {  echo 'checked'; } ?>


$i++;}
------------------------------------------------------------------------------------------

$type='str1';

while($getType=mysql_fetch_array($getBusinessType))
{
$businessType=$getType['businessType'];
$businessTypeid=$getType['id'];

?>


<option name="businessTypename" value="<?php echo $businessTypeid;?>" 
<?php if(isset($type)) if($type == $businessTypeid ) { ?>selected= "selected"<?php } ?>>
<?php echo $businessType; ?></option>

PHP upload empty checking

PHP upload file is checking for empty or null 

if (!empty($_FILES['file2']) && ($_FILES['file2']['name'] != ''))
{

}

Time show in header footer of Site

Display Time Header /footer any part of web site :
-------------------------------------------------------------------
paste this code with matched bgcolor and show time everypage of template / site
           
<?php    date_default_timezone_set("Asia/Kolkata");
echo date('h:i A'); ?>

PHP select single colun value





PHP single column value :

$post_like_id=mysql_query("SELECT * FROM `post_answer` WHERE `postid` = '$questionID'");

$post_answer = mysql_fetch_array($post_like_id);

$like=$post_answer['p_id'];

PHP 12 hour to 24 hrs time format conversion

PHP 12 hour time 24 hour time convertion:
==========================================


<?PHP

// 24-hour time to 12-hour time
$time_in_12_hour_format  = DATE("g:i a", STRTOTIME("13:30"));

// 12-hour time to 24-hour time
$time_in_24_hour_format  = DATE("H:i", STRTOTIME("1:30 pm"));

?>

REf :link Thax for link
http://psoug.org/snippet/Convert_12_to_24_hour_time_and_vice_versa_241.htm

To add one year - PHP mysql

To add one year to todays date use the following: PHP

$oneYearOn = date('Y-m-d',strtotime(date("Y-m-d", mktime()) . " + 365 day"));

For the other examples you must initialize $StartingDate with a timestamp value for example:

$StartingDate = mktime();  // todays date as a timestamp

Try this

$newEndingDate = date("Y-m-d", strtotime(date("Y-m-d", strtotime($StaringDate)) . " + 365 day"));

or

$newEndingDate = date("Y-m-d", strtotime(date("Y-m-d", strtotime($StaringDate)

PHP JS How to assign a PHP variable value to JavaScript variable

How to assign a PHP variable value to JavaScript variable

In javascript with echo version: var name1= "'.$name.'";

<?php
$name = "anurag singh";
echo '
    <html>
        <head>
        <script type="text/javascript" src="jquery-2.0.2.js"></script>
        <script type="text/javascript">
            $(document).ready(function(){
                var name1= "'.$name.'";
                $.post("main_page.php",{input1: name1}, function(msg){
                    alert("hi "+msg);
                });
            });
        </script>
        </head>

        <body>
            <h1>This is the demo!</h1>
            <h2>In echo we can add more than one statements</h2>
        </body>
    </html>
    ';
?>

Foreach loop in CI - Array value display

To display Array values from control ( more than 1 row or records) PHP

use foreach($arravar as $arr) :

 <?php foreach($schedule as $sched) { $sched['col_name'] }
    ?>

End once all records are showed

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

To display Array values from control only 1 row

use $arravar[0]['col_name']
 <?php echo $schedule[0]['schedule_child_id']; ?>
                              

To display Array values from control ( more than 1 row or recods)

To display Array values from control ( more than 1 row or records) PHP

use foreach($arravar as $arr) :

 <?php foreach($schedule as $sched) { $sched['col_name'] }
    ?>

End once all records are showed

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

To display Array values from control only 1 row

use $arravar[0]['col_name']
 <?php echo $schedule[0]['schedule_child_id']; ?>