im using wampserver and i want to put password in the database. i check some video tutorias but when i try it it is not working in my case. can anybody please help me give some ideas. thanks

Password of what? Of a database user? You can use phpMyAdmin. Don't forget to flush priviliges or restart wamp.

You should use POST method for that:

<form method="post" action="process.php">
    <input type="password" name="pass">
    <input type="submit" name="submit" value="Submit password">
</form>

And this is an example of a process.php

<?php
// check if password is set and matches criteria
if(isset($_POST['pass']) && $_POST['pass'] != '') {

    // escape the value to avoid most sql injection attacks
    // use your database driver's function
    // I am using mysqli in this example
    $password = mysqli_real_escape_string($_POST['pass']);

    // hash the pasword using a function of your choice
    $hashedPassword = ...

    // store the hashed password
    $query = "INSERT INTO users (hashedpassword) VALUES ($hashedPassword)";
    ...

    // let the user know
    echo "The password has been stored.";

} else {
    // if password is not set or does not match the criteria notify the user.
    die("Please go back and enter correct password");
}
?>

This is just a basic example. Many things can be improved.

like this one..the there is no password.. $server='localhost'; $user='root';$password='';$database='nohs';$con=mysql_connect ($server,$user,$password);$db = mysql_select_db($database);if (!$con || !$db){die ("Server down be back later!);}but if i place a password on it like $password='12345' how do i do place 12345 for the database like nohs in phpmyadmin... or can i put a password to the database nohs like 12345?

i already created it.my host name is nohs....so how do i use it? in the url do i have to type nohs instead of localhost?

You should have created/edited the host name for the user as localhost to use on the same computer, or % to be able to connect from any computer. If MySQL cannot resolve nohs as a hostname, it won't work.

thanks.i think i need to read more and try it here ..do u have any other links about this?

See the MySQL manual on priviliges.

Are you trying to use http://nohs instead of http://localhost ?

If that is what you aretrying to do, you need to create virtual hosts and edit the local host file

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.