Jump to content

rinteractive

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Everything posted by rinteractive

  1. please anybody help me???? i am running out of my time my boss is scribbllinnng me
  2. Its giving error like this Err 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 '' at line 9
  3. The above query is running but the table is not updating the record :'(
  4. It give error on this line   //Connect to mysql server as un excepted '&'
  5. <?php include_once ("functions.php"); include_once ("config.php"); //Start session &#160; //Connect to mysql server &#160; $link = mysql_connect("localhost","root",""); &#160; if(!$link) { &#160; &#160; &#160; die('Failed to connect to server: ' . mysql_error()); &#160; } &#160; //Select database &#160; $db = mysql_select_db("project"); &#160; if(!$db) { &#160; &#160; &#160; die("Unable to select database"); &#160; } &#160; &#160; //Array to store validation errors &#160; //Connect to mysql server &#160; &#160; //Sanitize the POST values &#160; $id = CleanVar(h_($_POST['id'])); &#160; $fname = CleanVar(h_($_POST['fname'])); &#160; $lname = CleanVar(h_($_POST['lname'])); &#160; $gender = CleanVar(h_($_POST['gender'])); &#160; $day= CleanVar(h_($_POST['day'])); &#160; $month = CleanVar(h_($_POST['month'])); &#160; $year = CleanVar(h_($_POST['year'])); &#160; $country = CleanVar(h_($_POST['country'])); &#160; $postalcode = CleanVar(h_($_POST['postalcode'])); &#160; $error&#160; &#160; &#160; &#160; &#160; =&#160; "N"; //start the update If($error == "N") { &#160; $current_cat_sql = "UPDATE members SET firstname = '".d_($fname)."', &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lastname = '".d_($lname)."', &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; gender= '".d_($gender)."', &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; day = '".d_($day)."', &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; month = '".d_($month)."', &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; year = '".d_($year)."', &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; country = '".d_($country)."', &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; postalcode = '".d_($postalcode)."' &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; WHERE member_id = '".d_($id)."'"; &#160; mysql_query ($current_cat_sql) or die ("Err".mysql_error()); header("location: register-success.php"); &#160; &#160; &#160; exit; } else { echo "error"; } ?> This is the code i have used
  6. i have tired your code it showing error message like this Parse error: syntax error, unexpected '&' in C:\xampp\htdocs\project\admin\PHP-Login\register-edit-action1.php on line 6
  7. when i write session_start(); code it given the error message like this Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\project\admin\PHP-Login\register-edit-action1.php:1) in C:\xampp\htdocs\project\admin\PHP-Login\register-edit-action1.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\project\admin\PHP-Login\register-edit-action1.php:1) in C:\xampp\htdocs\project\admin\PHP-Login\register-edit-action1.php on line 57
  8. Thanks Adam i have tired your then also it gives the same error message
  9. hey guys , i have changed my code now bt error message is showing please anyone help me???? my code is this <?php include_once ("functions.php"); include_once ("config.php"); //Start session //Connect to mysql server $link = mysql_connect("localhost","root",""); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select database $db = mysql_select_db("project"); if(!$db) { die("Unable to select database"); } //Array to store validation errors //Connect to mysql server //Sanitize the POST values $id = CleanVar(h_($_POST['id'])); $fname = CleanVar(h_($_POST['fname'])); $lname = CleanVar(h_($_POST['lname'])); $gender = CleanVar(h_($_POST['gender'])); $day= CleanVar(h_($_POST['day'])); $month = CleanVar(h_($_POST['month'])); $year = CleanVar(h_($_POST['year'])); $country = CleanVar(h_($_POST['country'])); $postalcode = CleanVar(h_($_POST['postalcode'])); $error = "N"; if ($error == "Y"){ include_once ("register-edit.php"); exit; } else{ $current_cat_sql = "UPDATE members SET firstname = '".d_($fname)."', lastname = '".d_($lname)."', gender= '".d_($gender)."', day = '".d_($day)."', month = '".d_($month)."', year = '".d_($year)."', country = '".d_($country)."', postalcode = '".d_($postalcode)."' WHERE member_id = '".d_($id)."'"; mysql_query ($current_cat_sql) or die ("Err".mysql_error()); } header("location: register-success.php"); exit; ?> The error message is Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\project\admin\PHP-Login\register-edit-action1.php:1) in C:\xampp\htdocs\project\admin\PHP-Login\register-edit-action1.php on line 53 Thanks in Advance
  10. hai guys!!!! i am new to php and Mysql , i am trying to edit the user profile bt the table is not updating the records. The coding i have used for updating below: <?php include_once ("functions.php"); include_once ("config.php"); //Start session session_start(); //Array to store validation errors $errmsg_arr = array(); //Validation error flag $errflag = false; //Connect to mysql server //Function to sanitize values received from the form. Prevents SQL injection function clean($str) { if(!get_magic_quotes_gpc()) { $str = @trim(mysql_real_escape_string($str)); } else { return @trim($str); } } //Sanitize the POST values $fname = clean($_POST['fname']); $lname = clean($_POST['lname']); $gender = clean($_POST['gender']); $day= clean($_POST['day']); $month = clean($_POST['month']); $year = clean($_POST['year']); $country = clean($_POST['country']); $postalcode = clean($_POST['postalcode']); $id = Cleanvar($_REQUEST['id']); //Input Validations if($fname == '') { $errmsg_arr[] = 'First name missing'; $errflag = true; } if($lname == '') { $errmsg_arr[] = 'Last name missing'; $errflag = true; } if($gender == '') { $errmsg_arr[] = 'Gender missing'; $errflag = true; } if($day == '') { $errmsg_arr[] = 'Day missing'; $errflag = true; } if($month == '') { $errmsg_arr[] = 'Month missing'; $errflag = true; } if($year == '') { $errmsg_arr[] = 'Year missing'; $errflag = true; } if($country == '') { $errmsg_arr[] = 'Country name missing'; $errflag = true; } if($postalcode == '') { $errmsg_arr[] = 'Postal code missing'; $errflag = true; } //Check for duplicate login ID //If there are input validations, redirect back to the registration form //Create INSERT query $qry = "UPDATE members SET firstname = '$fname' , lastname = '$lname', gender = '$gender', day = '$day', month = '$month', year = '$year', country = '$country' , postalcode = '$postalcode' WHERE member_id = '".d_($id)."'"; $result = mysql_query($qry); //Check whether the query was successful or not if($result) { header("location: register-success.php"); exit(); }else { die("Query failed".mysql_error()); } ?>
  11. i am new to php , just i want the difference between session and cookies can any one explain me. Thanks in Advance
  12. Thanks Adam my problem is solved now, your code helped me a lot
  13. i am new to mysql, table is not creating even there is no error message. The code i have used below. <?php $con = mysql_connect("localhost","root",""); if(!$con) { echo"Connection failed".mysql_error(); } mysql_select_db("project",$con); $sql= "CREATE TABLE `experience` ( `id` int(11) unsigned NOT NULL auto_increment, `years` int(11) NOT NULL, PRIMARY KEY (`id`) ) TYPE=MyISAM"; mysql_query($sql,$con); mysql_close($con); ?> Please any one help me
  14. i am new to php and mysql. just i want to display the user id in all the pages when the user is login. i have created the session id for the user, i don't how to display the user id in all pages please any one help me and give the suggestion Thanks in Advance
  15. Thanks wolfrat my problem is solved. The image is displaying Thanks a lot, your code is very helpful
  16. Thanks wolfrat i have used your coding but the image is not displaying
  17. hey guys i am new to php , When i am retrieving the data from mysql table , the image is not displaying but it shows only the image name. The coding i have used for retrieving is given just below: <?php include ("../include/config.php"); $sql = "SELECT id, name, photo FROM member"; $results = mysql_query($sql) or die ("Err, Problem with the database....".mysql_error()); $num=1; while ($row = mysql_fetch_row($results)){ $id = $row[0]; $name = $row[1]; $photo = $row[2]; $display_str .= " <tr bgcolor=\"#FFFFFF\"> <td align=\"center\">$num</td> <td align=\"center\"><input type=\"radio\" name=\"id\" value=\"$id\"></td> <td align=\"center\">$name</td> <td align=\"center\">$photo</td> </tr>"; $num++; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Anti Corruption Intelligence Committee (ACIC) Admin Home</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" href="css/main.css" type="text/css" /> <script language="javascript" type="text/javascript"> <!-- function validate(action_type){ is_radio_checked=false; if (document.head.id.length){ no_of_radio=document.head.id.length; for (i=0;i < no_of_radio;i++){ if (document.head.id.checked == true){ is_radio_checked=true; break; } } } else{ if (document.head.id.checked) is_radio_checked=true;; } if (is_radio_checked == false){ alert("Please Select the Type") return false; } document.head.action_type.value = action_type; if (action_type == "edit"){ document.head.submit(); return true; } if (action_type == "delete"){ delete_confirm = confirm("IMPORTANT: Are you sure you want to delete? ALL the products inside this Family will be DELETED."); if(delete_confirm){ document.head.submit(); return true; } else{ return false; } } return false; } --> </script> </head> <body> <strong><h2 align="center">Select a <u>Members</u> to edit</h2></strong> <?php if ($msg == '1'){ ?> <center><big><font color="green"><strong>Your Changes Have Been Saved !!!</strong></font></big></center> <?php } if ($msg == '2'){ ?> <center><big><font color="green"><strong>Records Successfully Deleted !!!</strong></font></big></center> <?php } ?> <form name="head" action="head-action.php" method="post"> <table width="50%" align="center" cellpadding="2" cellspacing="1" class="TableBG" border="2"> <tr bgcolor="#FFFFFF"> <th class="BlueBG"><strong>#</strong></th> <th class="BlueBG"><strong>Select</strong></th> <th class="BlueBG"><strong>member</strong></th> <th class="BlueBG"><strong>Image</strong></th> </tr> <?php echo $display_str; ?> <tr bgcolor="#FFFFFF"> <td align="center" colspan="5"> <input type="button" name="edit" value="Edit Member" class="FormButton" onclick=validate("edit")> <input type="button" name="delete" value="Delete Member" class="FormButton" onclick=validate("delete")> <input type="hidden" value="" name="action_type"> </td> </tr> <tr bgcolor="#FFFFFF"> <td align="center" colspan="5" height="30"><a href="head-add.php"><b>Add Member</b></a></td> </tr> </table> </form> </body> </html><!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> </body> </html> Please anybody help me Thanks in advance
  18. The table has been created already the only thing is to insert a data into table using php code. The current code is below: <?php include_once ("../include/config.php"); include_once ("../include/functions.php"); $id = CleanVar(h_($_POST['id'])); $name = CleanVar(h_($_POST['name'])); $head = CleanVar(h_($_POST['head'])); $membership_no = CleanVar(h_($_POST['membership_no'])); $cat = CleanVar(h_($_POST['cat'])); $mobile = CleanVar(h_($_POST['mobile'])); $telephoner = CleanVar(h_($_POST['telephoner'])); $telephoneo = CleanVar(h_($_POST['telephoneo'])); $refcode = CleanVar(h_($_POST['refcode'])); $education = CleanVar(h_($_POST['education'])); $post = CleanVar(h_($_POST['post'])); $date_of_birth = CleanVar(h_($_POST['date_of_birth'])); $gender = CleanVar(h_($_POST['gender'])); $nationality = CleanVar(h_($_POST['nationality'])); $profession = CleanVar(h_($_POST['profession'])); $policestation = CleanVar(h_($_POST['policestation'])); $address1 = CleanVar(h_($_POST['address1'])); $address2 = CleanVar(h_($_POST['address2'])); $famillydetails1 = CleanVar(h_($_POST['familydetails1'])); $familydetails2 = CleanVar(h_($_POST['familydetails2'])); $municipalityoffice = CleanVar(h_($_POST['municipalityoffice'])); $place = CleanVar(h_($_POST['place'])); $detailsofbank = CleanVar(h_($_POST['detailsofbank'])); $date1 = CleanVar(h_($_POST['date1'])); $email = CleanVar(h_($_POST['email'])); $images = uploadImage('photo', GALLERY_IMG_DIR); if ($images['image'] == '' ) { echo "Error uploading file"; exit; } $image = $images['image']; $sql = "INSERT INTO member (id, membership_no, cat, head, refcode, post, photo, name, date_of_birth, Gender, profession, nationality, education, familydetails1, familydetails2, address1, address2, telephoner, telephoneo, mobile, email, policestation, municipalityoffice, detailsofbank, date1, place) VALUES ($id, $membership_no, $cat, $head, $refcode, $post, $image, $name, $date_of_birth, $gender, $profession, $nationality, $education, $familydetails1, $familydetails2, $address1, $address2, $telephoner, $telephoneo, $mobile, $email, $policestation, $municipalityoffice, $detailsofbank, $date1, $place)"; $result = mysql_query ($sql) or die (mysql_error()); header ("Location: member-list.php"); exit; ?> It gives an error message "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 ' bvvbvbn, dfgfg, sdfggf, 24234, ' at line 40" hey guys, please help me
  19. hey guys!! The table is already created only the problem is the data is not inserting in the table.
  20. i have modified the code what your replied then also there is no error message and data is not inserted in the table
  21. ya i have added after that code $result = mysql_query ($sql) or die ("Err, Problem with the database....".mysql_error()); then also its not showing an error message and data is not inserting in the table
  22. $sql = "INSERT INTO member( membership_no, cat, head, refcode, post, name, date_of_birth, Gender, profession, nationality, education, familydetails1, familydetails2, address1, address2, telephoner, telephoneo, mobile, email, policestation, municipalityoffice, detailsofbank, date1, place, ) values ( '".d_($membership_no)."', '".d_($cat)."', '".d_($head)."', '".d_($refcode)."', '".d_($post)."', '".d_($name)."', '".d_($date_of_birth)."', '".d_($gender)."' '".d_($profession)."', '".d_($nationality)."', '".d_($education)."', '".d_($familydetails1)."', '".d_($familydetails2)."', '".d_($address1)."', '".d_($address2)."', '".d_($telephoner)."', '".d_($telephoneo)."', '".d_($mobile)."', '".d_($email)."', '".d_($policestation)."', '".d_($municipalityoffice)."', '".d_($detailsofbank)."', '".d_($date1)."', '".d_($place)."' )"; I have tried the above code there is no error message shown but the data is not inserting in the table
  23. I want to insert data into mysql table using php Below coding for creating table member $sql="CREATE TABLE member ( id int(11) NOT NULL auto_increment, membership_no varchar(100) , refcode varchar(100), post varchar(100), photo varchar(100), cat int(11), name varchar(100), head int (11), date_of_birth date, Gender varchar(10), profession varchar(50), nationality varchar(30), education varchar(30), familydetails1 varchar(50), familydetails2 varchar(50), address1 varchar(100), address2 varchar(100), telephoner int , telephoneo int, mobile int, email varchar(80), policestation varchar (70), municipalityoffice varchar(100), detailsofbank varchar(100), date1 date, place varchar(30), PRIMARY KEY (id), KEY `membership_no` (`membership_no`) )"; The table is created. Here is the coding for inserting the insert data into table member but its giving error message “Err, Problem with the database....Column count doesn't match value count at row 1” <?php include_once ("../include/config.php"); include_once ("../include/functions.php"); $id = CleanVar(h_($_POST['id'])); $name = CleanVar(h_($_POST['name'])); $head = CleanVar(h_($_POST['head'])); $membership_no = CleanVar(h_($_POST['membership_no'])); $cat = CleanVar(h_($_POST['cat'])); $mobile = CleanVar(h_($_POST['mobile'])); $telephoner = CleanVar(h_($_POST['telephoner'])); $telephoneo = CleanVar(h_($_POST['telephoneo'])); $refcode = CleanVar(h_($_POST['refcode'])); $education = CleanVar(h_($_POST['education'])); $post = CleanVar(h_($_POST['post'])); $date_of_birth = CleanVar(h_($_POST['date_of_birth'])); $gender = CleanVar(h_($_POST['gender'])); $nationality = CleanVar(h_($_POST['nationality'])); $profession = CleanVar(h_($_POST['profession'])); $policestation = CleanVar(h_($_POST['policestation'])); $address1 = CleanVar(h_($_POST['address1'])); $address2 = CleanVar(h_($_POST['address2'])); $famillydetails1 = CleanVar(h_($_POST['familydetails1'])); $familydetails2 = CleanVar(h_($_POST['familydetails2'])); $municipalityoffice = CleanVar(h_($_POST['muncicipalityoffice'])); $place = CleanVar(h_($_POST['place'])); $detailsofbank = CleanVar(h_($_POST['detailsofbank'])); $date1 = CleanVar(h_($_POST['date1'])); $email = CleanVar(h_($_POST['email'])); $upload_path = "../images/"; // Folder where uploaded file will be stored $allowed_ext = "image/pjpeg"; // Allowed file extension $allowed_ext2 = "image/jpeg"; $allowed_ext3 = "image/gif"; $photo_name = $_FILES['photo_file']['name']; $photo_temp = $_FILES['photo_file']['tmp_name']; $photo_path = $site_path."images/".$photo_name; $small_file_path = $site_path."prod_images/".$small_file_name; $small_allowed_size = "10240"; // Max File size in bytes (10 KB) $small_allowed_size_kb = number_format($small_allowed_size/1024,2); // Allowed File size in KB $small_image_size = $_FILES['image_small_file']['size']; // Current File Size in bytes $small_current_size = number_format($small_image_size/1024,2); // Current Size in KB $small_width = "138"; $small_height = "134"; $error = "N"; if (!$name) $error_name = format_error ("Member Name cannot be left blank !!!"); if (!$mobile) $error_mobile = format_error ("Mobile number cannot be left blank !!!"); if (!$post) $error_name = format_error ("Post Name cannot be left blank !!!"); if (!$gender) $error_gender = format_error ("Gender cannot be left blank !!!"); if (!$profession) $error_profession = format_error ("Profession cannot be left blank !!!"); if (!$date_of_birth) $error_date_of_birth = format_error ("Date of Birth cannot be left blank !!!"); if (!$place) $error_name = format_error ("Place Name cannot be left blank !!!"); if (!$address1) $error_name = format_error ("Residence address cannot be left blank !!!"); if ($_FILES["image_small_file"]["error"] > 0) $error_image_small_file = format_error("Please specify Small Image"); $prod_sql = "SELECT id, membership_no from member WHERE upper(membership_no) = '".d_(strtoupper($membership_no))."'"; $prod_result = mysql_query ($prod_sql); if (mysql_num_rows ($prod_result) > 0) $error_product_code = format_error ("Product Code already exists !!!"); if ($error == "Y"){ include_once ("member-add.php"); exit; } else{ // time to add the stuff... $sql = "INSERT INTO member values ( null, '".d_($membership_no)."', '".d_($cat)."', '".d_($head)."', '".d_($refcode)."', '".d_($post)."', '', '".d_($name)."', '".d_($date_of_birth)."', '".d_($gender)."' '".d_($profession)."', '".d_($nationality)."', '".d_($education)."', '".d_($familydetails1)."', '".d_($familydetails2)."', '".d_($address1)."', '".d_($address2)."', '".d_($telephoner)."', '".d_($telephoneo)."', '".d_($email)."', '".d_($mobile)."', '".d_($policestation)."', '".d_($municipalityoffice)."', '".d_($detailsofbank)."', '".d_($date1)."', '".d_($place)."' )"; $result = mysql_query ($sql) or die ("Err, Problem with the database....".mysql_error()); $prod_id = mysql_insert_id(); if($photo_name && $photo_name != "none"){ // copy small image first $explode_file_name = explode (".",$photo_name); $small_image_name = $prod_id."-small"; $new_small_file_name = $photo_name.".".$explode_file_name[1]; move_uploaded_file($_FILES['image_small_file']['tmp_name'], $upload_path.$new_small_file_name); // generate update string for small image $update_small_image = "image_small = '".d_($new_small_file_name)."',"; } $sql_update = "UPDATE member set $update_small_image WHERE id = '$prod_id'"; //echo $sql_update; $result_update = mysql_query ($sql_update) or die ("Err, Problem with the database....".mysql_error()); header ("Location: member-list.php?cat=$cat&msg=1"); exit; } ?>
×
×
  • 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.