SitePoint Sponsor

User Tag List

Results 1 to 12 of 12

Thread: query problem

  1. #1
    SitePoint Member
    Join Date
    May 2003
    Location
    holland
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    query problem

    hi all,

    I have a problem with my code. After messing around with it for 2 days now i can't fix it. When i run the script it just says that query11 doesn't work. But i suspect that there are more things wrong with it. Can someone take a look?

    Thank you very much.
    Here's my code.

    PHP Code:
    <HEAD>
    <TITLE>ADD USER</TITLE>
    </HEAD>
    <BODY>
    <CENTER><BR><BR>
    <?
    $vaancp_root 
    "./../";
    require(
    $vaancp_root 'include/db.php');
    if (
    $sent){
    print (
    "<CENTER><BR><BR><BR><BR><BR><B></B><BR><BR><TABLE><TR><TD><FONT SIZE=2><BR>Your new reseller is now ready to go.<BR> You can sent him a mail.</TD></TR></TABLE>");
    } else {
    print (
    "<BR><FONT SIZE=2>
    <CENTER>Here you can setup new resellers.<BR>

    <FORM ACTION=addreseller.php METHOD=post>

    Username: <BR><INPUT TYPE=TEXT NAME=username class=button><BR>
    Password: <BR><INPUT TYPE=password NAME=password class=button><BR>
    email adress:<BR></TD></TD><INPUT TYPE=text NAME=email class=button><BR>
    Fullname: <BR></TD><TD><BR><INPUT TYPE=text NAME=name class=button><BR>
    Name host :<BR></TD> <INPUT TYPE=Text NAME=host class=button><BR>
    Webspace:<BR></TD><TD> <INPUT TYPE=Text NAME=webspace class=button><BR>
    Max users:<BR></TD><TD> <INPUT TYPE=Text NAME=users class=button><BR>
    enable email: <BR><select name=mail>
    <option value=on>on</option>
    <option value=off>off</option>
    </select> <BR>
    enable php:<BR><BR> <select name=php>
    <option value=on>on</option>
    <option value=off>off</option>
    </select> <BR>
    enable cgi: <BR> <select name=cgi>
    <option value=on>on</option>
    <option value=off>off</option>
    </select> <BR>
    enable mysql: <BR><select name=mysql>
    <option value=on>on</option>
    <option value=off>off</option>
    </select> <BR>

    <INPUT TYPE=SUBMIT VALUE=SUBMIT NAME=sent class=button></FORM><BR><BR>"
    );}
    if (
    $sent){
    $server "$host"
    $mysql_user "$user"
    $mysql_password "$pass"
    $database "$db"

    // Connecting to mysql 
    $link mysql_connect($server$mysql_user$mysql_password
        or die(
    "Could not connect to mysql!<br />mysql error: " mysql_error()); 

    // Selecting databse 
    mysql_select_db ($database$link
        or die(
    "Could not select db!<br />mysql error: " mysql_error());

    $table "CREATE TABLE $host (
    ID INT PRIMARY KEY AUTO_INCREMENT,
    webspace VARCHAR(100),
    leftweb VARCHAR(100),
    users VARCHAR(100),
    leftusers VARCHAR(100),
    fullname VARCHAR(100),
    email VARCHAR(100),
    php VARCHAR(100),
    mail VARCHAR(100),
    mysql VARCHAR(100),
    cgi VARCHAR(100),
    name VARCHAR(100));"
    ;

    mysql_query($table);
    mysql_close();
    }
    if (
    $sent){
        
    $server "$host"
    $mysql_user "$user"
    $mysql_password "$pass"
    $database "$db"

    // Connecting to mysql 
    $link mysql_connect($server$mysql_user$mysql_password
        or die(
    "Could not connect to mysql!<br />mysql error: " mysql_error()); 

    // Selecting databse 
    mysql_select_db ($database$link
        or die(
    "Could not select db!<br />mysql error: " mysql_error());


        
    $sql1 "INSERT INTO $host (webspace, users, email, fullname, php, mail, mysql, cgi, name) VALUES ('$webspace', '$users', '$email', '$fullname, '$php', '$mail', '$mysql', '$mysql', '$cgi', '$name');";

        
    $result mysql_query($sql1)
            or die(
    "Couldn't execute query.11");

        
    $sql "INSERT INTO user (userid, password, fullname, email, userlevel) VALUES ('$username', '$password', '$email', '$name', '$package');";

        
    $result mysql_query($sql)

            or die(
    "Couldn't execute query.121");
    print (
    "Username : $username <BR> Password : $password <BR>");
    }
    ?>
    </BODY></HTML>

  2. #2
    SitePoint Guru
    Join Date
    Aug 2001
    Location
    Amsterdam
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK first of all ...
    use mysql_error() in your or die ..
    example:
    PHP Code:
     
    mysql_query
    ($q11) or die ("problem in query 11"mysql_error()); 
    This way the error description will be given..

    second ...

    You can't update stuff into your host..

    change the host part to your table name!!!

    Greets

    Peanuts
    the neigbours (free) WIFI makes it just a little more fun

  3. #3
    SitePoint Member
    Join Date
    May 2003
    Location
    holland
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes but the host part is a variable set by the hostname.. So what i try to reach is that is sets up a table that has the name of the host just entered in the input field. And that it later adds some stuff to it. And it displayed the error

    problem in query 11You have an error in your SQL syntax near 'on', 'on', 'on', 'on', 'on', 'asdfasd')' at line 1 so what does this mean. i can't find any errors there

  4. #4
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Why do you define 9 fields yet 10 data values for query 11?
    Ian Anderson
    www.siteguru.co.uk

  5. #5
    SitePoint Member
    Join Date
    May 2003
    Location
    holland
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks i had never seen that!!
    but it still doesn't work (still the same problem)
    But it still doesn't create the table though
    Last edited by vaan; Jun 19, 2003 at 04:00.

  6. #6
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    Kampala Uganda
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try being more neat and organised! HOW? i mean having the iff and else is enough on the page i Mean:-
    PHP Code:
    if($sent){
    print 
    ".......";
    server "$host"
    $mysql_user "$user"
    $mysql_password "$pass"
    $database "$db"

    // Connecting to mysql 
    $link mysql_connect($server$mysql_user$mysql_password
        or die(
    "Could not connect to mysql!<br />mysql error: " mysql_error()); 

    ......
    //Instead of TWO if($sents). since all depend on $sent!


    Which is addreseller.php? the same page? This is poor database design! does it mean each time some body signs in! a table is created? Why not have one table but many entries!...is it a big problem? i could help you later! gota go now! remind me if you dont mind!
    And we know that all things work together for good
    To them that love God, to them who are the called
    According to his purpose. Romans 8:28

  7. #7
    SitePoint Member
    Join Date
    May 2003
    Location
    holland
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks i think it just was a little bit strange to add fore every reseller 1 table......
    But only admin's can create a new reseller.
    Thanks.
    Last edited by vaan; Jun 19, 2003 at 08:13.

  8. #8
    SitePoint Member
    Join Date
    May 2003
    Location
    holland
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hum i think i have things oke now. But it gives a mysql error.

    problem in query 112Duplicate entry 'rick' for key 2

    where rick is my username

    Here is the insert part.
    PHP Code:
    $sql1 "INSERT INTO resellers (webspace, users, fullname, email, php, mail, mysql, cgi, name) VALUES ('$webspace', '$users', '$name', '$email', '$php', '$mail', '$mysql', '$cgi', '$name');";

        
    $result mysql_query($sql1)
             or die (
    "problem in query 112"mysql_error()); 
        
    $sql1213 "INSERT INTO user (userid, password, email, userlevel) VALUES ('$username', '$password1', '$email', 'reseller');";

        
    $result mysql_query($sql1213)
            or die (
    "problem in query 112"mysql_error()); 
    And here is the html part for putting the variables.
    PHP Code:

    print ("<BR><FONT SIZE=2>
    <CENTER>Here you can setup new resellers.<BR>

    <FORM ACTION=addreseller.php METHOD=post>

    Username: <BR><INPUT TYPE=TEXT NAME=username class=button><BR>
    Username: <BR><INPUT TYPE=password NAME=password1 class=button><BR>
    email adress:<BR></TD></TD><INPUT TYPE=text NAME=email class=button><BR>
    Fullname: <BR></TD><TD><BR><INPUT TYPE=text NAME=name class=button><BR>
    Name host :<BR></TD> <INPUT TYPE=Text NAME=host12 class=button><BR>
    Webspace:<BR></TD><TD> <INPUT TYPE=Text NAME=webspace class=button><BR>
    Max users:<BR></TD><TD> <INPUT TYPE=Text NAME=users class=button><BR>
    enable email: <BR><select name=mail>
    <option value=on>on</option>
    <option value=off>off</option>
    </select> <BR>
    enable php:<BR><BR> <select name=php>
    <option value=on>on</option>
    <option value=off>off</option>
    </select> <BR>
    enable cgi: <BR> <select name=cgi>
    <option value=on>on</option>
    <option value=off>off</option>
    </select> <BR>
    enable mysql: <BR><select name=mysql>
    <option value=on>on</option>
    <option value=off>off</option>
    </select> <BR>

    <INPUT TYPE=SUBMIT VALUE=SUBMIT NAME=sent class=button></FORM><BR><BR>"
    ); 
    Can any one see the problem.. THANKS
    i am trying to create my on webhosting control panel... WHOOT

  9. #9
    SitePoint Member
    Join Date
    May 2003
    Location
    holland
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh never mind i allready found out. I forgot to implant the feature that a username allready existed.

    THANKS every one who helped me..
    i am trying to create my on webhosting control panel... WHOOT

  10. #10
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    Kampala Uganda
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok
    And we know that all things work together for good
    To them that love God, to them who are the called
    According to his purpose. Romans 8:28

  11. #11
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    semantics question...

    do your resellers customize their plans or are they all the same plans, in essence. Would it make more sense to just simply have a plan table and relate the plan id to the reseller?
    Aaron Brazell
    Technosailor



  12. #12
    SitePoint Member
    Join Date
    May 2003
    Location
    holland
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    they have all their own plan. There for i made a table resellers in my script. And this contains their name and all sort of things and the max allow users+webspace.
    i am trying to create my on webhosting control panel... WHOOT


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •