Make Call To Database From Menu.tpl

Results 1 to 2 of 2
  1. #1
    Banned tutuyale is offline
    BannedRank
    Sep 2011 Join Date
    119Posts

    happy Make Call To Database From Menu.tpl

    Hi i need help to create one php code for call from menu.tpl to TRUNCATE s1_movement Example: whem the
    table s1_movement have more of 2500 entrys this broke the game and can run normal, its for this, i want create one call from the admin menu.tpl only press example: "Delet All Moves" and the table is truncate or empty entrys to "0" but i want make this from the admin menu and dont like enter to the phpMyadmin, please help me dears friends!

    Thank You =)
    Last edited by tutuyale; 10-04-16 at 07:51 PM.


  2. #2
    Account Upgraded | Title Enabled! ubiByte is offline
    True MemberRank
    Jan 2012 Join Date
    United StatesLocation
    206Posts

    Re: Make Call To Database From Menu.tpl

    Why don't you create a static page for the admin, all you need to do is call the query in that page using PHP. It'll do that for you without having to go into the database to run your query.

    Here's an example

    <?
    $username="username";
    $password="password";
    $database="your_database";

    $first=$_POST['first'];
    $last=$_POST['last'];
    $phone=$_POST['phone'];
    $mobile=$_POST['mobile'];
    $fax=$_POST['fax'];
    $email=$_POST['email'];
    $web=$_POST['web'];

    mysql_connect(localhost,$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");

    $query = "INSERT INTO contacts VALUES ('','$first','$last','$phone','$mobile','$fax','$email','$web')";
    mysql_query($query);

    mysql_close();
    ?>
    See my query example you can just type out your query to truncate the table there, and just put this code into a button for the admin. Once you click that button it will truncate or remove rows whichever is your goal



Advertisement