TheNix Posted April 29, 2009 Share Posted April 29, 2009 $query = "INSERT into 'Users'('lastname','firstname','email','user_type','username', 'password') VALUES('".$_POST['lname']."','".$_POST['fname']."','".$_POST['email']."', 'sell','".$_POST['username']."',md5('".$_POST['password']."'))"; I think I'm doing the quotes or double quotes around the POSTs wrong but I'm not sure. I'm not getting an error but nothing is being recorded to the database. Please help. Quote Link to comment https://forums.phpfreaks.com/topic/156138-oracle-insert-using-php-question/ Share on other sites More sharing options...
Adam Posted April 29, 2009 Share Posted April 29, 2009 Try... $query = " INSERT into Users (lastname, firstname, email, user_type, username, password) VALUES('".$_POST['lname']."', '".$_POST['fname']."', '".$_POST['email']."', 'sell', '".$_POST['username']."', md5('".$_POST['password']."')) "; Quote Link to comment https://forums.phpfreaks.com/topic/156138-oracle-insert-using-php-question/#findComment-821918 Share on other sites More sharing options...
TheNix Posted April 29, 2009 Author Share Posted April 29, 2009 That didn't help, let me put the rest of the code in to see if the problem is there. First I make a connection to the database and only if the connection works does the rest of the code work. $query = "INSERT into 'Users'('lastname','firstname','email','user_type','username','password') VALUES('".$_POST['lname']."','".$_POST['fname']."','".$_POST['email']."', sell','".$_POST['username']."',md5('".$_POST['password']."'))"; $parsed = oci_parse($dbconn, $query); //prepares query for execution oci_execute($parsed); //execute the query header("location:login.php"); oci_close($dbconn); Quote Link to comment https://forums.phpfreaks.com/topic/156138-oracle-insert-using-php-question/#findComment-821929 Share on other sites More sharing options...
Mark Baker Posted April 29, 2009 Share Posted April 29, 2009 INSERT into 'Users' You're using Oracle.... is your table name really case sensitive? Only use quotes around the table name in Oracle if the table name is actually case-sensitive or contains non-alphameric characters (normally they aren't) and you need to get the exact case/characters Note: the same applies to column names Quote Link to comment https://forums.phpfreaks.com/topic/156138-oracle-insert-using-php-question/#findComment-821958 Share on other sites More sharing options...
TheNix Posted April 29, 2009 Author Share Posted April 29, 2009 After doing some error checking it is saying that my md5 is wrong. to be more exact it is saying that md5 is an invalid identifier. I'm not sure what this means. Quote Link to comment https://forums.phpfreaks.com/topic/156138-oracle-insert-using-php-question/#findComment-821965 Share on other sites More sharing options...
Mark Baker Posted April 29, 2009 Share Posted April 29, 2009 And I don't believe MD5 is a valid Oracle function, it's part of the dbms_obfuscation_toolkit. You'd need to define something like: CREATE OR REPLACE FUNCTION md5(v_input_string IN VARCHAR2) RETURN VARCHAR2 IS v_checksum VARCHAR2(32); BEGIN v_checksum := dbms_obfuscation_toolkit.md5(input_string => v_input_string); RETURN v_checksum; END; Quote Link to comment https://forums.phpfreaks.com/topic/156138-oracle-insert-using-php-question/#findComment-821968 Share on other sites More sharing options...
TheNix Posted April 29, 2009 Author Share Posted April 29, 2009 thanks I'll try that out. Quote Link to comment https://forums.phpfreaks.com/topic/156138-oracle-insert-using-php-question/#findComment-821977 Share on other sites More sharing options...
Adam Posted April 30, 2009 Share Posted April 30, 2009 ... Or just use PHP's md5 function?? $query = " INSERT into Users (lastname, firstname, email, user_type, username, password) VALUES('".$_POST['lname']."', '".$_POST['fname']."', '".$_POST['email']."', 'sell', '".$_POST['username']."', '".md5($_POST['password'])."') "; Quote Link to comment https://forums.phpfreaks.com/topic/156138-oracle-insert-using-php-question/#findComment-822483 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.