[Help]Php mysql coding not working menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Troys's Avatar Contributor
    Reputation
    122
    Join Date
    Oct 2006
    Posts
    601
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Help]Php mysql coding not working

    Hello all thanks for reading hopefully this problem can be fixed i made this php mysql script for account registration and for some reason its not working
    it keeps saying
    "Fatal error: Call to undefined function mysql_connect() in C:\Pedregon's 2.4.3 Repack\Server2\htdocs\Insert.php on line 2"

    Here is the code

    Code:
    <?php
    $con = mysql_connect("localhost","root","lichking") or Die ('Could not connect: ' . mysql_error());
    if ($con)
    
    mysql_select_db("logon", $con);
    
    $sql="INSERT INTO accounts (login,password,gm,email,flags)
    VALUES
    ('login','password','0','email','8')";
    
    if (!mysql_query($sql,$con))
      {
      die('Error: ' . mysql_error());
      }
    echo "1 record added";
    
    ($announce = "Account Creation Successfull!");
    
    mysql_close($con);
    
    ?>
    If some1 can point out what i did wrong and gave me a solution to my problem that would be great !!
    Pals 4 Life

    [Help]Php mysql coding not working
  2. #2
    Tanax's Avatar Active Member
    Reputation
    53
    Join Date
    Jan 2007
    Posts
    239
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your error says that the function isn't defined.

    Meaning:

    1. You've made a little error, such as for example forgetting a ' or a ;
    2. Your PHP server doesn't support mysql
    3. You don't have a PHP server on your webhotel/localhost
    Hm.

  3. #3
    Troys's Avatar Contributor
    Reputation
    122
    Join Date
    Oct 2006
    Posts
    601
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yea it says the Mysql_connect wont work but yet all sites i go to says thats how you imput it to connect to mysql db
    Pals 4 Life

  4. #4
    dejavu11's Avatar Contributor
    Reputation
    87
    Join Date
    Apr 2007
    Posts
    257
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Troys View Post
    yea it says the Mysql_connect wont work but yet all sites i go to says thats how you imput it to connect to mysql db
    PHP doesn't come with built in MySQL support. Odds are you don't have MySQL enabled in your php.ini. Google the error: "Call to undefined function mysql_connect" and you'll find all sorts of pages on how to fix it.

  5. #5
    Tanax's Avatar Active Member
    Reputation
    53
    Join Date
    Jan 2007
    Posts
    239
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Troys View Post
    yea it says the Mysql_connect wont work but yet all sites i go to says thats how you imput it to connect to mysql db
    Yes, mysql_connect is indeed the php function used to connect to a mysql database.

    Your script probably AINT wrong. But the server is just not supporting it.

    Try this server, it's free, and is probably one of the best I've found yet(that is free that is). And guess what? It supports databases

    Free Web Hosting with PHP, MySQL and cPanel, No Ads
    Hm.

  6. #6
    Troys's Avatar Contributor
    Reputation
    122
    Join Date
    Oct 2006
    Posts
    601
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the link and for the help i appreciate it !

    Originally Posted by dejavu11 View Post
    PHP doesn't come with built in MySQL support. Odds are you don't have MySQL enabled in your php.ini. Google the error: "Call to undefined function mysql_connect" and you'll find all sorts of pages on how to fix it.
    Its enabled and it works fine with other scrips that connect
    Last edited by Troys; 07-24-2008 at 07:28 PM.
    Pals 4 Life

  7. #7
    Pragma's Avatar Contributor
    Reputation
    261
    Join Date
    Feb 2007
    Posts
    630
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try putting an @ in front of it like this:
    $con = @mysql_connect("localhost","root","lichking")


  8. #8
    dejavu11's Avatar Contributor
    Reputation
    87
    Join Date
    Apr 2007
    Posts
    257
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by insanesk8123 View Post
    try putting an @ in front of it like this:
    = @mysql_connect("localhost","root","lichking")
    That will supress the error from being shown but it's not going to fix the problem.

  9. #9
    Troys's Avatar Contributor
    Reputation
    122
    Join Date
    Oct 2006
    Posts
    601
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by insanesk8123 View Post
    try putting an @ in front of it like this:
    = @mysql_connect("localhost","root","lichking")
    Hey insane long time no see =]

    and as for the code still not working i have edited it so many times to fix it im trying the hosting company see if that will fix it.
    Here is all the code im using for the account creation table .

    This is what im trying to make

    And the code for this is

    Code:
     
    
    <form id="contactForm" name="form2" method="post" action="insert.php">
        
    
    <h2>Account Register</h2><br class="spacer" />
          <label>Username:</label>
          <br class="spacer" />
            <input type="text" name="textfield2" />
            <label>Password:</label><br class="spacer" />
            <input type="text" name="textfield2" />
            <label>Re-type Password:</label>
            <br class="spacer" />
            <input type="text" name="textfield2" />
            <label>Email :</label><br class="spacer" />
                <input type="text" name="textfield2" />
             
          <input type="image" class="submit" src="images/submit_bg.gif" title="submit" />   
       </form>
    Pals 4 Life

  10. #10
    dejavu11's Avatar Contributor
    Reputation
    87
    Join Date
    Apr 2007
    Posts
    257
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Troys View Post
    Thanks for the link and for the help i appreciate it !



    Its enabled and it works fine with other scrips that connect
    You mentioned that you were going to contact "the host" but everything seems to say you are hosting this locally.

    = mysql_connect("localhost","root","lichking")
    I don't know of any hosts that would give you MySQL root access

    C:Pedregon's 2.4.3 RepackServer2htdocsInsert.php
    Odds are they also wouldn't be having an emulation server running on their webserver.

  11. #11
    Troys's Avatar Contributor
    Reputation
    122
    Join Date
    Oct 2006
    Posts
    601
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I fixed that all its being hosted on a free server im trying to see if it works finally /cross fingers
    Pals 4 Life

  12. #12
    dejavu11's Avatar Contributor
    Reputation
    87
    Join Date
    Apr 2007
    Posts
    257
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Troys View Post
    I fixed that all its being hosted on a free server im trying to see if it works finally /cross fingers
    What was the problem in the end?

  13. #13
    Troys's Avatar Contributor
    Reputation
    122
    Join Date
    Oct 2006
    Posts
    601
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well now after i click submit its saying 404 error >.<
    i dont know if its trying to go to insert.php or what all insert is is the php code for the registration its not supposed to be a page =/

    ugh this is the hardest most fustrating code i have ever done ..and also dejavu thanks a ton for helping me
    Pals 4 Life

  14. #14
    dejavu11's Avatar Contributor
    Reputation
    87
    Join Date
    Apr 2007
    Posts
    257
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey I'm just happy to see action in the PHP section. 404 = page not found. If you're using the code you have above it is trying to go to insert.php.

    <form id="contactForm" name="form2" method="post" action="insert.php">
    Do you have an insert.php in the same directory?

  15. #15
    Troys's Avatar Contributor
    Reputation
    122
    Join Date
    Oct 2006
    Posts
    601
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yep its all hosted in 1 place
    Pals 4 Life

Page 1 of 2 12 LastLast

Similar Threads

  1. [Help][PHP/Mysql] LF Tutor
    By Thunderofnl in forum Programming
    Replies: 7
    Last Post: 03-27-2010, 08:45 PM
  2. [Need help] Swapped blp's not working + Changing Skybox
    By Randie in forum WoW ME Questions and Requests
    Replies: 3
    Last Post: 08-23-2008, 03:18 PM
  3. [Help] Text in photoshop not working
    By The Toxic Deer in forum Art & Graphic Design
    Replies: 6
    Last Post: 08-21-2008, 04:18 PM
  4. [Question/Help]My reskin does not work propperly
    By lolister in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 06-03-2008, 09:40 AM
  5. [HELP] Lua boss script not working-solutions?
    By WinKIller0 in forum World of Warcraft Emulator Servers
    Replies: 15
    Last Post: 03-21-2008, 08:19 AM
All times are GMT -5. The time now is 03:03 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search