a query is inserted from PHPMYAdmin but not from PHP

Posted by iyad al aqel on Stack Overflow See other posts from Stack Overflow or by iyad al aqel
Published on 2011-01-13T11:45:28Z Indexed on 2011/01/13 11:53 UTC
Read the original article Hit count: 230

Filed under:
|
|
|

i'm writing a php code to insert form values in a forum values

$dbServer = mysql_connect("localhost" , "root", "") ; 
if(!$dbServer) die ("Unable to connect");
mysql_select_db("kfumWonder");
$name= $_POST['name'] ; 
$password= md5($_POST['password']); 
$email= $_POST['email'] ; 
$major= $_POST['major'] ; 
$dateOfBirth=$_POST['dateOfBirth'] ; 
$webSite = $_POST['website']; 
$joinDate= date("Y m d") ;

$query = "INSERT INTO user (name, password, email, major, dob, website, join_date)
          Values ('$name', '$password', '$email', '$major', '$dateOfBirth',
                  '$webSite' , '$joinDate')" ; 

//echo $query ; 
$result = mysql_query($query) ;

if (! $result ) 
 echo " no results "  ;

this works perfectly fine when i took the printed query and run it in PHPMyAdmin but when i run this code nothing happens , any ideas !?

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql