Jump to content

clarkson

Members
  • Posts

    7
  • Joined

  • Last visited

clarkson's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. I have a table called employee in which there's a field called birth_date. Iwant to get the output in the format of Jan-01-2013.My sql is $sql="SELECT emp_name,emp_address,salary,DATE_FORMAT(birth_date,'%b,%d,%Y') AS birth_date FROM employee";$query=mysql_query($sql,$connect); But the query is not succesful. What have I done wrong?Any help to correct this please
  2. I learnt that there are 5 type of selectors. Id selector class selector grouped selector context selector, element selector In grouped selector is it possible to use only ELEMENTS seperated with comma. Can this code be considered as a grouped selector. {#form input,#form textarea{border:2px solid blue;} Also what's the difference of context selector and grouped selector?
  3. I typed if (!mysqli_query($connect,$sql )) { printf("Errormessage: %s\n", mysqli_error($connect));} and entered dummy values for mu form.then It gets printed this thing,Errormessage: Duplicate entry 'pgh-fth@gmail.com' for key 2
  4. Sorry what's MYSQL errors?When I try to use my safe function with mysql_real_escape_string() I get error as Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\new\root\functions\safe.phpon line 3.But that's not elated to the radio button problem
  5. In the localhost database when I check my users table no data for gender field(which is the radio button) doesn't get inserted
  6. Yes I tried var_dump($_POST);Then I get this printedarray(5) { ["username"]=> string(3) "der" ["email"]=> string(15) "dfg@hotmail.com" ["password1"]=> string(3) "dse" ["password2"]=> string(3) "dse" ["gender"]=> string(4) "male" }That means my script receives button data right?
  7. This is my php page where form data is sent to and data is added to database.With this I radio button data doesn't get inserted.Also I tried to modify this using mysqli_real escape(). with the function <?phpfunction safe($value){ return mysql_real_escape_string($value);}?> and in code as$username = safe($_POST["username"]); $password = safe($_POST["password"]); But then no data gets inserted to database and errors occur.I am completely new to this so any help please? This is my code.Why doesn't radio button data get inserted? <?phpsession_start();// If user is logged in, header them awayif(isset($_SESSION["username"])){exit();}$connect=mysqli_connect("localhost","root","","cs1");//check cnnectionif (mysqli_connect_errno($connect)){echo "Failed to connect database".mysqli_connect_error();exit();}$username=$_POST["username"];$password1=$_POST["password1"];$password2=$_POST["password2"];$gender=$_POST["gender"];$sql="INSERT INTO users (username,email,password1,password2,gender) VALUES ('$username','$_POST[email]','$password1','$password2','$gender' )";$query = mysqli_query($connect, $sql);
×
×
  • Create New...