Jump to content

alena1347

Members
  • Posts

    43
  • Joined

  • Last visited

Everything posted by alena1347

  1. why is the flename showing view.html.php this must be a wrong file name
  2. I am trying to store images in a folder on server. For some reason the images that need to be uploaded should be with their orignal name as uploaded by user i.e they can be changed only wth the original name in it. 1)So how can i put it in folder using php and retrieve it wherever needed whch means the name should be in database. 2)Now in the folder if two files with the same name are uploaded then the latest would overwrite whch should be avoided. Plz could anyone give some way to make ths up.
  3. first the session_start must be before any html tag. And when you put this on server it would not redirect because the header must be before any output and if you want to use header then you need output buffering. Try javascript <script type="text/javascript"> window.location="xyz.php"; </script> instead write this in place of header
  4. I have stored a image in database as it is small dd not upload in folder it got uploade and is shown in database i stored it with using $imgData =addslashes (file_get_contents($_FILES['image']['tmp_name'])); then a insert query with $imgData Now when i retrive it with select query from database and display <td rowspan="12"><?php header('Content-type:image/jpg'); $img=stripslashes($info['image']); echo $img; ?></td> it shows The image "localhost/final/../f.php?action="view&id=53" cannot be displayed because it contains errors
  5. suppose you have two tables table1 and columnname1 as column and table2 with columnname2 as column then the query would look like UPDATE table1,table2 SET table1.columnname1=table2.columnname1 where table2.columnname1=something; the error is for inserting duplicate values in the column with primary key check for that
  6. I have a data base that updates the photo 1) A error occurs everytime i update the database error:- Error in Query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\0JFIF\0\0`\0`\0\0ÿÛ\0C\0 ' at line 3 code:- $sql = "UPDATE freelancer SET image=$imgData, name='{$_FILES['image']['name']} WHERE id=$in"; here $imgData is image with slashes 2) this is the error for Error in Query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''image-04.jpg WHERE id=29' at line 3 code:- $sql = "UPDATE freelancer SET image='$imgData', name='{$_FILES['image']['name']} WHERE id=$in"; please help for the error
  7. I have made a html form and use the post method to redirect in the same page. 1) Now the problem is every time someone adds something and press refresh the vales are inserted again. cna there be any method by which it is not inserted again the code <?php if(isset($_POST['add_skills'],$_POST['skills']) && !empty($_POST['add_skills'])) { $row=$_POST['add_skills']; $edit=mysql_query("some insert query") or die("unable to insert"); if($edit) { echo "OK"; unset($_POST['add_skills'],$_POST['skills']); } } ?> <body> <form name="form1" action="<?php $_SERVER['PHP_SELF']; ?>" method="post" > <div align="center"> <div align="left"> <div align="left"><p>Add Skill</p></div> <div><input type="text" id="add_skills" name="add_skills" placeholder="Add Skill" /></div> </div> <div align="left"> <div></div> <div><input type="submit" name="skills" name="skills" value="Add" /></div> </div> </div> </form>
  8. I have a php file and need to redirect to other pages from middle of the page as header() needs to be put on the top is there any other way please.
  9. I have a html form in which the dropdown box is an array element now I have created a javascript function that get form as parameter . 1)I need to maniulate the values of the array present in the form in the below code sendmail is the form sname is the field array function addit(sendmail) { var x=document.sendmail.sname.length; //alert(x); while( x>0 ) { var skill=document.getElementById("sname[x]").value; //alert(skill); var anOption = document.createElement("OPTION"); anOption.innerText = skill; anOption.Value = skill; document.form.snames.options.add(anOption); x--; } }
  10. The $ser2 is a implode of an array The $ser3 is also an implode of an array for the lhname and exnum Thank you
  11. I am trying to build search option in which I want to match multiple options with database values 1)When using the "where IN" clause the values compared are 'OR'd' and i need it 'AND' the array. 2) $do=mysql_query("SELECT * from hire WHERE sname=$sname AND lhname IN ($ser2) AND exnum IN ($ser3)"); while($row2=mysql_fetch_array($do)) { ?> <tr> <td><?php echo $row2['id']; ?></td> <td><?php echo $row2['fname']; ?></td> <td><?php echo $row2['lname']; ?></td> <td><?php echo $row2['lhname']; ?></td> <td><?php echo $row2['cnum']; ?></td> <td><?php echo $row2['exnum']; ?></td> <td><?php $id=$row2['id']; $row3=mysql_query("SELECT * from skill where id=$id"); while($val=mysql_fetch_array($row3)) { $bits=$val['sname']; $arr[]=$bits; } $imp=implode(",",$arr); echo $imp ; ?></td> </tr> The above code gives Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given at the while loop please help Thank you!
  12. I have inserted a jquery in my html page but it is not fading out <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <link href="programmers.css" rel="stylesheet" type="text/css" /> <?php include('conn.php'); include('header.php'); ?> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>User Allotment</title> <script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $("#detail").hide(); $("#view").click(function() { $("#form").fadeout(); $("#detail").fadeIn(); }); }); </script> </head> <body> <form id="form1" name="form1" method="post" action="" id="form"> <table align="center" width="100%" id="form"> <tr> <td height="25" width="100%" bgcolor="#CCCCCC" align="center"><a href="user_allotment.php">User Allotment</a> <a href="view_users.php">View Users</a> <a href="">Pending Aprovals</a> <a href="freelancers_pending.php">Freelancer Pending</a> <a href="search.php">Search</a> <a href="admin_login.htm">Logout</a></td> </tr> <tr> <td><br/> <table width="1019" border="1" align="center" bgcolor="#FFFFFF"> <tr> <td colspan="13" align="center"><strong>PENDING APPROVALS</strong></td> </tr> <tr align="center"> <td width="60" align="center" >Id</td> <td width="60" align="center">First Name</td> <td width="60" align="center">Last Name</td> <td width="65" align="center">Company</td> <td width="50" align="center">Phone</td> <td width="40" align="center">Ext</td> <td width="50" align="center">E-mail</td> <td width="70" align="center">Skill required</td> <td width="75" align="center">Experience</td> <td width="70" align="center">Duration of hire</td> <td width="70" align="center">Location of hire</td> <td width="110" align="center">Brief project description</td> <td width="60" align="center">view</td> </tr> <?php mysql_select_db("programmers") or die(mysql_error()); $data = mysql_query("SELECT * FROM hire") or die(mysql_error()); while($info = mysql_fetch_array( $data )) { ?> <tr> <td><?php echo $info['id'];?></td> <td><?php echo $info['fname'];?></td> <td><?php echo $info['lname'];?></td> <td><?php echo $info['cname'];?></td> <td><?php echo $info['cnum'];?></td> <td><?php echo $info['enum'];?></td> <td><?php echo $info['email'];?></td> <?php $id=$info['id']; $fetch=mysql_query("SELECT sname FROM skill WHERE id=$id"); while($row=mysql_fetch_array($fetch)) { $sname=$row['sname']; $sk[]=$sname; } $arr=implode(',',$sk); ?> <td><?php echo $arr;?></td> <td><?php echo $info['exnum'];?></td> <td><?php echo $info['dnum'];?></td> <td><?php echo $info['lhname'];?></td> <td><?php echo $info['task'];?></td> <td><label><input type="button" class="view" id="view" value="view"/></label></td> </tr> <?php } ?> </table> </td> </tr> </table> </form> </body> </html> <?php include('footer.php'); ?>
  13. I need to call a javascript or a php function from a form made in php, so that I could make change in data base on clicks. 1)I included the function on onclick event on submit but nothing happens. 2)The file name in which this code is include is view_users.php could someone hel me solve this <?php mysql_select_db("programmers") or die(mysql_error()); $data = mysql_query("SELECT * FROM user_allotment") or die(mysql_error()); while($info = mysql_fetch_array( $data )) { echo "<tr>"; echo "<td>".$info['id'] . "</td>"; echo "<td>".$info['uname'] . "</td> "; echo "<td>".$info['password'] . "</td>"; $id=$info['id']; echo "<form method="post" action="view_users.php">"; echo "<td><label><input type="button" name=/"$id/" value="edit" align="middle" onclick="edit()"/></label></td>"; echo "<td><label><input type="button" name=/"$id/" value="delete" align="middle" onclick="edit()"/></label></td>"; echo "<td><label><input type="checkbox" name=/"$id/" value="privilege" align="middle" onclick="edit()"/></label></td>"; echo "</form>"; echo "</tr>"; } ?>
  14. we select multiple values by applying the multiple attribute to <select>
  15. I have a html form having a dropdown box from which i need to retrieve multiple data and display it on another page could anyone help me with the code please. 1)PHP code 2)the options i need to put in the dropdown menu to make the code work
  16. 1)I have two fields "id" and "field" in this table 2)Thank you for the second point it solved my problem.
  17. I am making a website having a "skills" field which is a dropdown menu dropdown menu which fetch's data from database and assign the Id to the option tag dynamically 1) I dont know if the id is assigned or not below is my code:- <select name="sname[]" id="sname" size="1" multiple="multiple" title="hold ctrl and click multiple options" > <?php include 'conn.php'; $que=mysql_query("select * from field"); while($row=mysql_fetch_array($que)) { $id=$row['id']; $field=$row['field']; echo "<option id="$id">".$field."</option>"; } ?> </select> 2)how do I insert multiple values of the option tag into the database into the database?
×
×
  • 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.