Jump to content

pritam79

Members
  • Content Count

    92
  • Joined

  • Last visited

Everything posted by pritam79

  1. I have a php site. I also have images stored in folders to be displayed in those pages. But i wanted to know how do i store those images in mysql and display them in my php pages by extracting them from mysql database. please give some scripts to display those image from mysql by the help of php script.
  2. pritam79

    PHP form

    <?phpsession_start();if(isset($_SESSION['userid'])) { if($_SESSION['level']==1) { echo "<div id='navbar'></div>"; header('Refresh: 5; URL=admin.php'); echo "<div id='content'>"; echo "<p><br>You are already logged-in as admin, and will be re-directed to your home page.</br>"; echo "If your browser doesnot redirect you automatically, <a href='admin.php'>click here</a>.</p>"; include "footer.php"; exit; } if($_SESSION['level']==2) { echo "<div id='navbar'></div>"; header('Refresh: 5; URL=mypage.php'); echo "<d
  3. pritam79

    insert error

    its all working now. just had some problem with the database table structure. Now when I register, I am trying to execute multiple insert queries at the same time as given below. $sql = "INSERT INTO company_com (id_com, idusr_com) VALUES ('', '".$_SESSION['id_usr']."')"; mysql_query($sql, $result) or die(mysql_error($result)); $_SESSION['id_com'] = mysql_insert_id($result); $sql = "INSERT INTO domain_dom (id_dom) VALUES ('')"; mysql_query($sql, $result) or die(mysql_error($result)); $sql = "INSERT INTO location_loc (id_loc) VALUES ('')"; mysql_query($sql, $result) or die(mysq
  4. pritam79

    insert error

    I tried the following for user registration.$sql = "INSERT INTO user_usr (id_usr, username_usr, password_usr, level_usr, email_usr) VALUES ('', '$username', '$password', '1', '$email')"; mysql_query($sql, $result) or die(mysql_error($result)); echo $sql; exit; The user was registered as before with the values getting inserted into MySql as earlier. But on echoing $sql I get this output in the browser window-INSERT INTO user_usr (id_usr, username_usr, password_usr, level_usr, email_usr) VALUES ('', 'User7', 'User7', '1', 'user7@gmail.com')
  5. pritam79

    insert error

    I removed the apostrophes from ‘1’ and ‘2’ (int type) of the two insert queries, but even now only zeros are getting inserted in MySql. But when I echo $_SESSION['level_usr'] on the page where a user is redirected after registration, I get the proper output as 1 or 2 depending on who registered (user or company). Its showing 0 in the table evertime I register be it a user or a company.Also, the length of the email field is varchar(25), but still the problem persists.
  6. pritam79

    insert error

    This is register_company.php<?phpsession_start();if(isset($_SESSION['id_usr'])){ if($_SESSION['level_usr']=1) { header('Location:user/index.php'); exit; } if($_SESSION['level_usr']=2) { header('Location:company/index.php'); exit; }}if($_SERVER['REQUEST_METHOD'] == 'POST'){ if(strlen($_POST['txtusername']) !='' && strlen($_POST['txtpassword']) !='' && strlen($_POST['txtemail']) !='') { require("db-connect.php"); $result = db_connect(); if($result) { $username = mysql_real_escape_string($_POST['txtusername'], $result); $password = mysql_real_escape_s
  7. pritam79

    insert error

    I have two pages ‘register_user.php’ which allows job-applicants to register, and ‘register_company.php’ which allows the companies to register. I am using wamp. A job-applicant or Company gets registered properly, but the only errors I get are- level_usr gets inserted in the tables as 0 in both cases whereas it should have inserted a 1 for an applicant, and 2 for a company. Also, the email field value of the table is inserted as - it begins with some weird character and then the address followed by a dot, but the com after the dot is absent.
  8. pritam79

    insert error

    I have two pages ‘register_user.php’ which allows job-applicants to register, and ‘register_company.php’ which allows the companies to register. I am using wamp. A job-applicant or Company gets registered properly, but the only errors I get are- level_usr gets inserted in the tables as 0 in both cases whereas it should have inserted a 1 for an applicant, and 2 for a company. Also, the email field value of the table is inserted as illustrated in the image. (attachment)
  9. pritam79

    Php Mysql Error

    I created this mysql table using WAMP server's PHPMyAdmin interface- id_com (pk), idusr_com(fk),name_com, address_comAlso there is some PHP code as shown below- require("db-connect.php"); $db = db_connect(); $name_com = mysql_real_escape_string($_POST['txtname_com'], $db); $address_com = mysql_real_escape_string($_POST['txtaddress_com'], $db); if($db) { if(isset($_POST['Add'])) { // insert company name and location in company_com $sql = "INSERT INTO company_com(name_com, address_com) VALUES ('$name_com', '$address_com') WHERE idusr_com = ".$_SESSION[id_
  10. The above script uses sessions to track a user throughout the site. But as I close the browser, the next time the user has to log in again. I want the 'remember me' checkbox to work. That is if a user logs in by checking 'remember me' and then closes the browser, the next time the same user requests the page he need not enter the username and password and is automatically redirected to his home page.
  11. Hi all,I am using the following login script that uses just sessions. Even in the other pages, which a user views after logging in, use sessions. I want to use sessions and cookies together in the login script as well as in all the later pages, which would lessen the server load. I want to include cookies as well, so that the two (cookies+sessions) function together. How can I do so? Please illustrate. Thanks.. <?phpsession_start();if(isset($_SESSION['id_usr'])){ if($_SESSION['level_usr']==1) { include "header.php"; echo "<div id='navbar'></div&
  12. pritam79

    Foreign Keys

    Hi all,I have the following two tables in MySQL. When I insert a record in the ‘user-usr’ table, I want the foreign key ‘idusr_com’ to get inseted in the company_com table accordingly. What is the appropriate SQL statement to do so? Do I need two queries? What happens when I need to insert foreign key values in many tables at a time?1. company_com - to store the company main information. id_com - the primary key for the company table. No two companies can have the same ID. idusr_com - a foreign key to the company's entry in the users table below. Login and access restrictions are s
  13. Hi all, My question is related to both PHP and JavaScript, and as such didn’t know the forum where to post my query.Firstly, I would like to know if JavaScript can be totally done away with from a PHP page. That is, can a site,developed entirely in PHP (minus JavaScript), perform all functions that could otherwise be performed by using JavaScript embedded into the PHP pages? Secondly, what choice does a developer have in case he does not want to include JavaScript at all in a site developed entirely in PHP? Would the exclusion of JavaScript make the site less functional? Is there anything t
  14. pritam79

    PHP login

    I want the scripts to do the following.1. Accept a valid username and password.2. Authenticate the user against the database and serve the ‘authormaster.php’ page if validated.3. If the REMEMBER ME option is selected on the login page, then the next time the user logs-in the server should directly serve the user with ‘authormaster.php’.4. The ‘authormaster.php’ page should allow users to do the following- a) Sign Out – brings the user back to login.php and populates the ‘username’ field with the last username used to login. Change User – allows the user to login as a different user by bring
  15. pritam79

    PHP login

    I got the code in a book. I doubt the code would work but the functioning is such that the user will first login through 'login.php', which will use the script 'setme.php' to verify if the username and password are in the database, and if so will redirect the user to 'authormaster.php'. But the script is not working.
  16. pritam79

    PHP login

    Hi all, I have the following three pages, setme.php, login.php and authormaster.php. This is login.php <?phpif($state == 'cu') { setcookie("login[username]", "", time()-360); setcookie("login[password]", "", time()-360); header('Location:login.php'); exit; }else if($state == 'so') { setcookie("login[password]", "", time()-3600); header('Location:login.php'); exit; }if(isset($_COOKIE['login']['username']) && isset($_COOKIE['login']['password'])) { header('Location:authormaster.php'); }?><html><body><form action="setme.php" method="post" name="frmL
  17. pritam79

    Form

    Hi again I have now included an ‘UPDATE’ link at the end of each displayed record on the ‘BookMasterform.php’ page like <a href="edit.php?id=<?php echo $row['BookID'];?>">EDIT</a>, and when I click any record I am also directed to a different page ‘edit.php’, which provides all the corresponding fields in individual text boxes, so that I can ‘modify’ the records and update them. But how do I proceed? I am ‘passing variables through a URL’ but I am unable to further use this option in the page where I need to modify the records. Which method would be the best, pass the variabl
  18. pritam79

    Form

    Thanks, its working now..
  19. pritam79

    Form

    I have been able to modify my script, and now i just have one problem. The insertion of records, display of records and error detection for erroneous input works well. Even when I select the checkboxes and press delete button the records get deleted.The problem I am having is that in case I do not select any checkboxes and then press the ‘delete’ button, I get the error message which says “Select record(s) to delete” as expected, but I also get this error message at the top of the page which says- “Undefined index: checkbox in C:\wamp\www\MasterPG442\BookMasterform.php on line 135. This is the
  20. pritam79

    Form

    I am done with my insertion error handling. Now I am trying to include error handling for the delete button. When I select the checkboxes corresponding to the records that I need to delete, they get deleted properly from the database as well as from the page where the records are displayed. But in case I donot select any of the checkboxes and click on the delete button, I get an error message which says- Notice: Undefined index: checkbox in C:\wamp\www\BookMasterform.php on line 140.I want an error message which says- "No records selected"..The following is the code for the delete button.<?
  21. pritam79

    Form

    How do I RESET the fields after inserting the data in MySql then?
  22. pritam79

    Form

    I have this form that submits to itself and the data inserted into the fields get displayed on the same page below the form. but I am having problems-When the input boxes are filled with correct data and I click the Save button, the data gets inserted in MySQL, but the form input fields do not get emptied automatically. I have to clear each record from the input fields manually and even the Reset button doesnot work. But the reset button works well only in case the page loads in localhost for the very first time, i.e before submitting any data for the very first time.I don't want to use JavaS
  23. pritam79

    Form

    Hi all, I have a PHP page where I have included two submit buttons. Before processing with the code associated with any of the two submit buttons I have to check as to which one gets clicked. How do I determine as to which one of the two is clicked?Hi all, I have a PHP page where I have included two submit buttons. One is for inserting data into MySQL and one is for deleting data displayed one that same page using checkboxes. With the code that I have the insertion and display of all the data along with checkboxes is working well. But the thing that I am not able to do is the
  24. pritam79

    CS5 vs CS3

    someone plz reply.... :-(
  25. pritam79

    CS5 vs CS3

    I am using flash CS5 now. I am already accustomed to using flash CS3, but I find a lot of difference among the two (as far as finding commands and options in CS5 is concerned). Are there major differences among the two? I also need some tutorial for CS5, because the w3 tutorials here are for the CS3 version I guess, because when I go through the tutorials of w3 and try to implement those in CS5, its difficult to find a counterpart for the CS3 tools in CS5.
×
×
  • Create New...