Jump to content

varun7952

Members
  • Posts

    38
  • Joined

  • Last visited

Everything posted by varun7952

  1. i already tried this can ne1 try ths at thr own localhost
  2. yes directory is there also
  3. this is not helping in anyway
  4. yes after selecting a file nd cliking submit button form is a different page and it action attribute set to upload.php where alll the php thing is placed
  5. ok i did ths also ths will mk array bt this return a blank array nothing else bt with same error
  6. soon after submitting the form
  7. thanks but this also not helping its still showing the same error
  8. hi i m new to php there is two basic script i m testing on my localhost but it gives me error "( ! ) Notice: Undefined index: video in C:\wamp\www\Boysjoys\video\upload.php on line 4" "( ! ) Notice: Undefined index: video in C:\wamp\www\Boysjoys\video\upload.php on line 16" "( ! ) Notice: Undefined index: video in C:\wamp\www\Boysjoys\video\upload.php on line 27" i cant find where is the real problem is ##########FORM########### <form name="upload" action="upload.php" method="POST" enctype="multipart/form-data"> <input type="file" name="video"> <input type="submit" value="UPLOAD"> </form> #########FORM############ #########PHP############# <?php // This is the directory where images will be saved $path="uploaded/"; $path=$path.basename($_FILES["video"]["name"]); //This gets all the other information from the form $video=$_FILES["video"]["name"]; //connect to database $con=mysql_connect("localhost","root","") or die (mysql_error()); //SELECTING THE DATABASE mysql_select_db("admin_bj",$con) or die(mysql_error()); //write information to the database mysql_query("INSERT INTO 'video'(video) VALUES('$video')"); //write file to server if(move_uploaded_file($_FILES["video"]["tmp_name"],$path)) { // execute if all is ok echo "the file " . basename( $_FILES['uploadedfile']['name']). "has been uploaded and your information has been added to the server"; } else { //GIVES AND ERROR IF ITS NOT OK echo "Sorry,there was a problem in uploading."; } ?> #########PHP#############
  9. can any one tell me where is the problem in this script i gt the error Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\HW\test first login.php on line 44 and in username txt box whn i opened page its shows default value " i cant find where this " comes from please help me <HTML> <HEAD> <TITLE>New Document</TITLE> </HEAD> <BODY> <?php $uname= ""; $pword= ""; $errormessage=""; //========================================== // ESCAPE DANGEROUS SQL CHARACTERS //========================================== function quote_smart($value, $handle) { if (get_magic_quotes_gpc()) { $value = stripslashes($value); } if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value, $handle) . "'"; } return $value; } if($_SERVER['REQUEST_METHOD']=='POST'){ $uname =$_POST['user']; $pword =$_POST['pass']; $uname=htmlspecialchars($uname); $pword=htmlspecialchars($pword); // connection with database $connection=mysql_connect("127.0.0.1","root",""); $db=mysql_select_db("addressbook",$connection); if($db){ $uname=quote_smart($uname,$connection); $upword=quote_smart($pword,$connection); $SQL="SELECT * FROM address_data WHERE First_name=$uname AND Last_name=$pword"; $output=mysql_query($SQL); $num_rows=mysql_num_rows($output); if($output){ if($num_rows=1){ session_start(); $_SESSION['login']="1"; echo "logged in as".$uname; } else { ession_start(); $_SESSION['login']=""; echo $errormessage="invalid username or password"; } } else{ echo $errormessage="invalid login"; } } mysql_close($connection); } ?> <FORM NAME ="form1" METHOD ="POST" ACTION =""> Username: <INPUT TYPE = 'TEXT' Name ='user' value="<?PHP echo $uname;?>" maxlength="20"> Password: <INPUT TYPE = 'TEXT' Name ='pass' value="<?PHP echo $pword;?>" maxlength="16"> <P align = center> <INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Login"> </P> </FORM> <P> <?PHP print $errormessage;?> </BODY> </HTML>
  10. function quote_smart($value, $handle) { if (get_magic_quotes_gpc()) { $value = stripslashes($value); } if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value, $handle) . "'"; } return $value; } how this script works and this script not linked to any variable or any other place so how this scripts works without linked or connected to anywhere (sorry if this ques is dumb but i m newbie in php
  11. but if i go with working script it works well i dont see aby difference between my script nd the working script please tell me where is the problem in these script
  12. i m tryin to create table from mysql coding and when i run the script its runs without any errors and just show that its created table but whn i chk into phpmyadmin i cnt find my table there and also when i use some copy paste from some website its just do the same thing but this time table is created but i cant find any difference between my table and the website table but still my script wont work please help me where is the mistake $connection=mysql_connect("127.0.0.1","root",""); $db=mysql_select_db("addressbook",$connection); if($db){ $SQL="CREATE TABLE address_data_new { ID int(7) NOT NULL auto_increment, First_name varchar(50) NOT NULL, ################## MY SCRIPT################ Last_name varchar(50) NOT NULL, email varchar(50) NOT NULL, PRIMARY KEY (ID), UNIQUE Id (ID) }"; /* $SQL="create table address_data { ID int(7) NOT NULL auto_increment, ############# working script############ First_Name varchar(50) NOT NULL, Surname varchar(50) NOT NULL, email varchar(50), PRIMARY KEY (ID), UNIQUE id (ID) )"; */ mysql_query($SQL); mysql_close($connection); echo "table added successfully"; } else { echo "database not found"; } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.