Showing posts with label how to. Show all posts
Showing posts with label how to. Show all posts

Monday 20 August 2012

HOW TO insert and retrive an image into databse using PHP,MYSQL

// siddhu vydyabhushana // Leave a Comment
hello friends good morning am here with a extordinary coding , i know u all are aware about this, inserting and retriving an image into database mysql using php,

please save this file as index.php
<html>
<head>
</head>
<body>
<form name="myform" method="POST" action="index.php" enctype="multipart/form-data">
<input type='file' name='image'>
<input type='submit' name='upload'>
</form>
</body>

</html>

<?php

mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("dream") or die(mysql_error());


$file=$_FILES['image']['tmp_name'];

if(!isset($file))

echo "please select an image";

else
{
$image=addslashes(file_get_contents($_FILES['image']['tmp_name']));
$image_name=addslashes($_FILES['image']['name']);
$image_size=getimagesize($_FILES['image']['tmp_name']);

if($image_size==FALSE)

echo "that is not an image";

else
{
if(!$insert=mysql_query("INSERT INTO store VALUES('','$image_name','$image')"))
echo "problem uploading image";
else
{
$lastid=mysql_insert_id();
echo "image uploaded.<p/>Your image:<p/> <img src='get.php?id=$lastid'></img>";
}

}
}
?>

please save the below file as get.php

<?php
mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("dream") or die(mysql_error());

$id=addslashes($_REQUEST['id']);

$image=mysql_query("SELECT * FROM store WHERE id=$id");
$image=mysql_fetch_array($image);
$image=$image['image'];

//header("Content-type:image/jpeg");

echo $image;
?>

please create a mysql table like below with name store


CREATE TABLE IF NOT EXISTS `store` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`image` blob NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;

Read More

Saturday 18 August 2012

HOW TO highlight syntax in blogger,websites

// siddhu vydyabhushana // Leave a Comment
hello guys i know ,iknow,i know uuuuuu alllll areeeeeee waiting for this one along time , but am here with simple manner so dont worry u can also write

just copy the below soursce code and save it with extension .html       and see the result

if u want to write any code within <pre> and enclosed by </pre>

and u need to replace < with &lt; (including semicolon)
and u need to replace > with &gt; (including semicolon) 


thats all where u have <.> symobls u need to replace

although if have any doubts comment i will clarify

<style>
.srcFmt {
position: relative;
width: 650px;
height: 300px;
overflow: auto;
background-color: #e8e6e2;

margin: 1em 0;
padding: 10px 10px;
}
</style>
<div class="srcFmt" style="width: 430px; height: 500px">
<pre>
<script type="text/javascript">
function moveDomObj(id, l, t)
{
var domObj = document.getElementById(id);

domObj.style.left = l+"px";
domObj.style.top = t+"px";
}

var timer2 = null;
var n2 = 0;

function stepBall2()
{
x = 50+4*n2;
y = 30+1.6*n2*n2; // a parabolic path y=x*x
moveDomObj("ball2", x, y);
n2++;
if (n2>13)
{
clearInterval(timer2);
n2 = 0;
}
}

function startBall2()
{
timer2 = setInterval(stepBall2, 100);
}
</script>
</pre>
</div>
Read More

HOW TO design facebook profile using css

// siddhu vydyabhushana // 1 comment
Hi friends it was long time to post some thing new to u but easy one , i think u are not waiting for this one because u already know what i wana learn to u but am interested to learn u plz pay attention
the below code save it as .html file and enjoy it


<style>
.bar {
font-family: Lucida Console, Monaco, monospace;
font-weight:bold;
background-color:black;
color: #f0f0f0;
box-shadow: 0px 0px 2px #333;
line-height: 35px;
padding: 0px 20px;
position: fixed;
top: 0;
right: 0;
left: 0;
z-index: 10000;
}
.bar img
{
padding-top:5px;
}
.bar a {
color: #bdbdbd;
text-decoration:none;
}
.bar a:hover {
color: #FFFFFF;
}
#siddhu
{
width:333px;
background-color:e1e1e1;
padding:auto;
height:auto;
margin-top:auto;
margin-left:9px;
position:fixed;

}
#siddhu4
{
width:320px;
background-color:e1e1e1;
padding:auto;
height:auto;
margin-top:auto;
margin-right:10px;
position:fixed;
margin-left:24px;

}
#siddhu1
{
font-family: Lucida Console, Monaco, monospace;
width:880px;
background-color:white;
padding:20 35;
height:auto;
margin-right:auto;
margin-left:347px;
}
#siddhu img
{
width:333;
height:300;
}
left
{
float:left;
}
</style>

<body background="Picture.png">
<body bgcolor="#bdbdbd">
<div class="bar">
<a href="http://aitamelearning.blogspot.com">« Home </a>
<a href="http://aitamelearning.blogspot.com">&nbsp&nbspProfile </a>
<a href="http://aitamelearning.blogspot.com">&nbsp&nbsp<FONT COLOR="red">What u wana Learn?</font> </a>
<a href="http://aitamelearning.blogspot.com">&nbsp&nbsp Projects by U</a>
<a style="float: right" href="registration.php"><img src="Desert1.jpg" width="20" height="20"><img>Siddhu Vydyabhushana »</a>
</div>
<div id="siddhu">
<img src="Desert1.jpg"></img>

</div>
<div id="siddhu1">
<H3>Update your status Yar!!!!!!!</h3>
<form>
<textarea cols='72' rows='4' name='text' type='text'>
</textarea><br>
<input type="submit" value='share' name='submit'>
</form>
<hr size='1' color='#e1e1e1'/>

<h2> @Siddhu Solutions <br><br><br>Come With without knowing what computer languages <br>before signout u go-out with extra knowedge
its our main aim.<br><br>Especially we aimed at <br><br><br>
1.C-Language<br>
2.Android<br>
3.JAVA<br>
4.Html<br>
5.jsp<br>
6.javascript<br>
7.ajax<br>
8.php<br>
9.asp.net<br>
</body>
Read More

Tuesday 14 August 2012

HOW TO upload image and retrive image using ajax

// siddhu vydyabhushana // 1 comment

i know you all are waiting for this tutorial , but there i worked one day to make easy for u dont mis use it and  learn and apply in your domain




db.php:- for database connection



<?php$mysql_hostname = "localhost";$mysql_user = "root";$mysql_password = "";$mysql_database = "test";$prefix = "";$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Opps some thing went wrong");mysql_select_db($mysql_database) or die("Opps some thing went wrong");
?>


image.php:- its for uploading image



<?php
include('db.php');
session_start();
$session_id='1'; //$session id
$path = "uploads/";

$valid_formats = array("jpg", "png", "gif", "bmp","JPG");
if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST")
{
$name = $_FILES['photoimg']['name'];
$size = $_FILES['photoimg']['size'];
if(strlen($name))
{
list($txt, $ext) = explode(".", $name);
if(in_array($ext,$valid_formats))
{
if($size<(1024*1024))
{
$actual_image_name = time().substr(str_replace(" ", "_", $txt), 5).".".$ext;
$tmp = $_FILES['photoimg']['tmp_name'];
if(move_uploaded_file($tmp, $path.$actual_image_name))
{
mysql_query("UPDATE users SET profile_image='$actual_image_name' WHERE uid='$session_id'");
echo "<img src='uploads/".$actual_image_name."'  class='preview'>";
}
else
echo "failed";
}
else
echo "Image file size max 1 MB";
}
else
echo "Invalid file format..";
}
else
echo "Please select image..!";
exit;
}
?>




Read More

HOW TO add email subscription to blogger

// siddhu vydyabhushana // Leave a Comment
email subscription to blogger
  1. Go to Blogger > Design > Page Element
  2. Add a Gadget Below Header 
  3. Choose HTML/JavaScript Gadget
  4. Paste the Following Code in Gadget

                

<style type="text/css">
#pbt_feature_box{background:#f0f4f4; border-bottom: 1px solid #D4D4D4; padding:10px 15px 0px; height:55px;}
#pbt_sleek-subscribe{display: block; margin:0 auto; } 
.pbt_newsheadline {color:#222; font-size:15px; line-height:50px; float:left; font-weight:bold;}
.pbt_newsheadline span{font-size:38px; color:#444; line-height:14px; font-family: "Droid Sans",arial,sans-serif; font-weight:normal;}
.pbt_newsheadline cite{font-style:normal; color:#f00;}
.pbt_signform{background:url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8vQrzIrpPbN3-RxV2Qrufkh4MR8vaWoEmVpB9MwZzx4NVgMEH79U7V09cAVXVCTtrH7heWRm7_I5sb1iXwcAIqPd9MGXhIDh8r2Q8mhuKmlZUc0KTnLfaaB_jgHk5tIxj1bh7UfNS3HLq/s1600/arrow.jpg') no-repeat;padding:0 0 10px 100px; float:right; }
.pbt_txt2, .pbt_txt2:focus{width:140px; font-size:15px; background:#f7f7f7; color:#004B80; border:1px solid #E36B0A; margin:0 5px; float:left; padding:10px; width:160px; border-radius: 10px;}
.pbt_btn2, .pbt_btn2:focus {background:#E36B0A; margin:0 5px; padding:8px 10px 9px; border:1px solid #AD5513; color:#fff; font-size:15px; border-radius:10px;}
.pbt_btn2:hover{background:#6689b0; }
</style>
<div id='pbt_feature_box'>
<div id='pbt_sleek-subscribe'>
<div class='pbt_newsheadline'><span>Sign up</span> for <cite>FREE</cite> daily Updates.</div>
<form action='http://feedburner.google.com/fb/a/mailverify?uri=probloggingtools' class='pbt_signform' method='post' target='_new'>
<input class='pbt_txt2' name='name' onblur='if (this.value == &#39;&#39;) {this.value = &#39;your name...&#39;;}' onfocus='if (this.value == &#39;your name...&#39;) {this.value = &#39;&#39;;}' value='your name...'/>
<input class='pbt_txt2' name='email' onblur='if (this.value == &#39;&#39;) {this.value = &#39;your email address...&#39;;}' onfocus='if (this.value == &#39;your email address...&#39;) {this.value = &#39;&#39;;}' value='your email address...'/>
<input class='pbt_btn2' type='submit' value='subscribe me!'/>
</form>
</div>
</div>


replace blue color with urs
Read More

HOW TO set Facebook Like widget to blogger

// siddhu vydyabhushana // Leave a Comment
i think you are awaiting for this one because this is attractive one  For this widget you have to only edit your Facebook Page id only. To get this Widget for your blog follows the instruction below..
Facebook Like widget to blogger


  1. Go to Blogger > Design > Page Elements
  2. Add a Gadget
  3. Select "HTML/JavaScript" gadget
  4. paste the following code in Gadget                                                                                                              


<iframe src="http://www.connect.facebook.com/widgets/fan.php?channel_url=http://probloggingtools.com/?fbc_channel=2&id=361232753932484&name=PBT&width=297&connections=10&stream=0&logobar=0&css=http://probloggingtools.googlecode.com/files/facebook-like-Box-style.css" height="300" frameborder="0"> </iframe>
Read More