Jump to content

Recommended Posts

$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.

 

Link to comment
https://forums.phpfreaks.com/topic/156138-oracle-insert-using-php-question/
Share on other sites

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']."'))
";

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);

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

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;

... 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'])."')
";

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.