The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

run sql on server problem

Discussion in 'Database Discussions' started by ezryder, May 2, 2004.

  1. ezryder

    ezryder Member

    Joined:
    Apr 30, 2004
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Hi,
    I am trying to run some sql on my webhost. I have connected to the database fine but when I try this code:

    Code:
    $sql = "SELECT TeacherUser FROM teachers                     
                  WHERE TeacherUser='$TeacherUser';";
          $result = mysql_query($sql)
                      or die("Couldn't execute query. $sql");
    
    The result is:

    Couldn't execute query. SELECT TeacherUser FROM teachers WHERE TeacherUser='d';

    I know my sql works because I can run it through cpanel sql screen fine. The only other reason I can think of for it not working is maybe because I developed on windows and am now uploading to a unix server and the mysql_query function needs tweaking in my code???

    If anyone can help I'd appreciate it.
    Thanks

    Sorry this probably should be in the scripting/backend forum:)
     
  2. bamasbest

    bamasbest Well-Known Member

    Joined:
    Jan 10, 2004
    Messages:
    531
    Likes Received:
    0
    Trophy Points:
    16
    What happens when you change:

    $TeacherUser';";

    to

    $TeacherUser'";
     
  3. ezryder

    ezryder Member

    Joined:
    Apr 30, 2004
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Nothing I'm afraid, I started out without the ";" and then added it because I thought maybe a unix server needed it. :(
     
Loading...

Share This Page