webdevRefinery Forum: renewaltopics - Viewing Profile - webdevRefinery Forum

Jump to content

Reputation: 0 Neutral
Group:
Members
Active Posts:
53 (0.13 per day)
Most Active In:
Databases (31 posts)
Joined:
25-March 12
Profile Views:
955
Last Active:
User is offline Aug 08 2012 02:58 PM
Currently:
Offline

My Information

Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Not Telling Not Telling
Expertise:
HTML
PHP
Javascript
SQL

Contact Information

E-mail:
Click here to e-mail me

Topics I've Started

  1. Can somebody check my PHP-SQL code?

    29 July 2012 - 02:19 PM

    I get a blank PHP page in my browser, so that means a code error because it only prints "Hi" when i take away the $ query = UPDATE part. so is that where
    theres an error?



    <?php

    $con = mysql_connect("localhost","register","mysql");

    if (!$con)

    {
    die("Could not connect: " . mysql_error());
    }

    mysql_select_db("users");


    $query = "UPDATE users SET Email= $_POST["email"]
    WHERE Password = 'farts';";

    $result= mysql_query($query);

    mysql_close($con);

    echo "Hi";

    ?>
  2. Is there something wrong with my Javacript form validations?

    29 July 2012 - 11:11 AM

    Hi, i have an update page with 4 fields, each field = 1 form. Form 1 is for firstname and form 2 is for last name and form 3 is for email
    and form 4 is for password. each form has an update button. so i added javascript validations. javascript validation 1 is for form 1, javascript
    validation 2 is for form 2, validation3 is for form 3, and finally, validation 4 is for form 4. but when i submit a null form 1(firstname,validation1)
    it gives a successful alert message but then doesent return false, but i told it to return false after the meesage. can someone tell me the error in my code? here it is and thanks:



    <!DOCTYPE HTML>
    <HTML>
    <title>
    C.T. -- Account Settings
    </title>
    <HTML>

    <div align = "center">

    <img src = "http://--.---.---.---:--\seemytalent.jpg" alt="The Congress of Talent">

    <h1> Account Settings </h1>

    <form name= "update1" onclick="validate1()" action = "manage1.php" method="POST">

    First Name: <input type= "text" name="fname" maxlength="20">

    <input type= "submit" value="Update">

    </form>

    <form name= "update2" action = "manage2.php" onclick="validate2()" method="POST">

    <p> Last Name: <input type= "text" name = "lname" maxlength="20">

    <input type= "submit" value="Update">

    </form>

    <form name= "update3" action = "manage3.php" onclick="validate3()" method="POST">

    <p> E-mail Address: <input type= "text" name = "email" maxlength="40">

    <input type= "submit" value="Update">

    </form>

    <form name= "update4" action = "manage4.php" onclick="validate4()" method="POST">

    <p> Choose a Password: <input type= "password" name="password1" maxlength="60">

    <p> Confirm Password: <input type="password" name="password2" maxlength="60">

    <input type= "submit" value="Update">

    </form>

    <script type = "text/javascript">
    function validate1()
    {

    var a=document.forms["update1"]["fname"].value;

    if (a==null || a=="" || a.length > 20)
    {
    alert("Please enter your first name");
    return false;
    }
    }
    </script>

    <script type = "text/javascript">
    function validate2()
    {
    var b=document.forms["update2"]["lname"].value;

    if (b==null || b=="" || b.length > 20)
    {
    alert("Please enter your last name");
    return false;
    }
    }
    </script>


    <script type = "text/javascript">
    function validate3()
    {
    var c=document.forms["update3"]["email"].value;

    if (c==null || c=="" || c.length > 40 || c.length < 10)
    {
    alert("Please enter your valid E-mail Address");
    return false;
    }
    }
    </script>

    <script type = "text/javascript">

    function validate4()
    {
    var d=document.forms["update4"]["password1"].value;
    var e=document.forms["update4"]["password2"].value;
    if (d! = e)
    {
    alert("Please re-enter the password you entered above");
    return false;
    }
    }


    </script>
  3. How to make a PHP variable out of the value of the SQL SELECT statement?

    27 July 2012 - 08:14 PM

    Hi, how do I do something like this?

    $value="SELECT FirstName from Members WHERE E-mail=$_SESSION["email"]";

    it doesnt work, but how do i get the value of the SELECT query in the $value variable?


    Thanks
  4. How to create dynamic <a href tags that change with PHP Sessions

    26 July 2012 - 01:44 PM

    Hi. What i mean is, when a session is destroyed a webpage has a login button which directs to login.php. When the person logs in, a session
    is created and is then brought back to the home page. But now, instead of saying login, it has an a href tag saying logout. how do i make
    a tag change text and its header with sessions?
  5. Can someone check my SQL code?

    14 July 2012 - 07:06 PM

    Hi, I've created a database in the MySQL command line called "users". Ive then created a table in the users database called "users".
    So heres the code i have on my .php file:

    <?php

    $con = mysql_connect("localhost","register","mysql") or die(mysql_error());
    echo "Connected to MySQL<br />";

    mysql_select_db("users, $con") or die("Could not find database");

    mysql_query("INSERT INTO users (FirstName, LastName, Email, Password) VALUES ('$_POST[fname]','$_POST[lname]','$_POST[email]','$_POST[password1]')");


    mysql_close($con);
    ?>

    Now heres the problem: When I submit to this page, the database isnt getting any data via "INSERT INTO" above. Is there some code im missing? or did i do everything wrong? thanks

Friends

renewaltopics hasn't added any friends yet.

Comments

renewaltopics has no profile comments yet. Why not say hello?


Enter your sign in name and password


Sign in options
  Or sign in with these services