20
Aug

Prevent MySQL lower-case conversion on windows

On Wamp server navigate to my.ini from tray icon

lower_case_table_names=2

add this to the end of file and restart mysql server.

20
Jul

Easy Mysql insert with PHP

Let’s see how to cut short code to insert or update mysql queries just with few lines of code.The key to making this happen is to name your html form elements with the same names as your column names.


<form name="myform" method="post" action="insert.php">

Name:<input type="text" name="name" />

Comment:<textarea cols="42" rows="8" name="comment"></textarea>

<input type="submit" value="Send" />

</form>

Observe that there is no name provided for the submit button.Now on to the PHP code.


<?php

$keys = "";

$vals = "";

foreach($_POST as $key=>$val) {

$keys .= "`".$key."`,";

$vals .="'".$val."',";

}

//Remove the last comma, else SQL will fail

$keys = substr($keys,0,-1);

$vals = substr($vals,0,-1);

$sql = "insert into table_name ($keys) values ($vals)";

mysql_query($sql);

?>
20
Jul

Simplest Php Image Gallery


<script type="text/javascript">
function changeimg(e){
var a = document.getElementById('img');
a.src = e;
}
</script>

<div align="center">

<img src="images/1.jpg" id="img" width="400" height="400" />

</div>

<br /><br /><br />

<?php
$filenames = glob('images/*');
foreach ($filenames as $filename){

echo '<div style="text-align:center;float:left;"><a href="#" onmouseover="changeimg(\''.$filename.'\');"><img src="'.$filename.'" width="100" height="100" style="border:1px solid #333;padding:20px; margin:10px;" /></a><br />'.basename(substr($filename,0,-4)).'<br /></div>';
}
?>
20
Jul

Making a css horizontal menu

A simple horizontal css menu

Step 1:

Let’s create a simple unordered list


<div id="simple_menu">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">About us</a></li>
<li><a href="#">Contact us</a></li>
<li><a href="#">Sitemap</a></li>
</ul>
</div>

Result:

Lets apply some style to it:


div#simple_menu li{
float:left;
list-style: none;
}

div#simple_menu li a{
display:block;
font-size:10px;
font-family:Verdana;
background: #333333;
text-decoration:none;
padding-left: 10px;
padding-right: 10px;
color:#ffffff;
line-height:30px;
}

div#simple_menu li a:hover{
background:#666666;
}

Result:


18
Jul

Adonis - The Making Part 1

A simple yet powerful framework to offer flexible and rapid web development.

The Development is still ongoing, it is based on MVC architechture based on ADOdb database abstraction layer. Ext Js has been chosen as native support for ajax and layout management as it is flexible and can be used with adapters to go with protoype, Jquery or Yui.

The latest SVN code can be checked out from http://adonis.googlecode.com/svn/trunk

Please contact us if you would like to participate in development

18
Jul

Easy way of making a random password with php


<?php

echo substr( md5 ( rand( 0, 99999999 ) ) );

?>

Simple eh!!