Posts

Showing posts from January, 2015

Upload Image to Folder & Store Name in Database

<?php $allowedExts = array("gif", "jpeg", "jpg", "png"); $temp = explode(".", $_FILES["file"]["name"]); $extension = end($temp); $uimg=$_FILES["file"]["name"]; if ($_FILES["file"]["error"] > 0)  { echo "Return Code: " . $_FILES["file"]["error"] . "<br>"; }  else  {     echo "Upload: " . $_FILES["file"]["name"] . "<br>";     echo "Type: " . $_FILES["file"]["type"] . "<br>";     echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";     echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";     if (file_exists("upload/" . $_FILES["file"]["name"])) {       echo $_FILES["file...

Auto Number in PHP

<?php mysql_connect("localhost","root",""); mysql_select_db("dabase_name"); $query=mysql_query("select uid from profile order by uid desc"); $row=mysql_fetch_array($q); if(mysql_num_rows($q)>0) { $myid=$row['uid']; $mynew=$myid+1; } $uname="user1"; $query="insert into profile (uid, uname) values ($mynew,'$uname')"; mysql_query($query); echo "1 Record Added"; ?>