[question] WEB & Querys

10/04/2015 19:45 B13.#1
hello,
is it possible to make a query works throw my website
like if i want to reset all players position to jangan but i don't wanna open my SQL. can it be done throw my website ?
if yes how ?
10/04/2015 21:13 ​Exo#2
I am not so good at web stuff but as far as I remember php had a function called mysqli_query for this purpose.

Edit:: Yes here's a reference from W3Schools

PHP Code:
<?php
$con
=mysqli_connect("localhost","my_user","my_password","my_db");
// Check connection
if (mysqli_connect_errno())
  {
  echo 
"Failed to connect to MySQL: " mysqli_connect_error();
  }

// Perform queries 
mysqli_query($con,"SELECT * FROM Persons");
mysqli_query($con,"INSERT INTO Persons (FirstName,LastName,Age) 
VALUES ('Glenn','Quagmire',33)"
);

mysqli_close($con);
?>
10/04/2015 22:18 B13.#3
can't understand how the query works :/
what if i want the player to be able to reset his own chr position to jangan .
shouldn't be a button for him to press ?
thx for your reply Exo.
still need more explanation..
10/05/2015 01:14 AceSpace#4
Quote:
Originally Posted by B13. View Post
can't understand how the query works :/
what if i want the player to be able to reset his own chr position to jangan .
shouldn't be a button for him to press ?
thx for your reply Exo.
still need more explanation..
Uhm I would use what Exo posted, ps; i have no knowledge when it comes to PHP.

Quote:
PHP Code:
<?php
$con
=mysqli_connect("localhost","my_user","my_password","my_db");
// Check connection
if (mysqli_connect_errno())
  {
  echo 
"Failed to connect to MySQL: " mysqli_connect_error();
  }

// Perform queries 
mysqli_query($con,"UPDATE SRO_VT_SHARD.._Char SET LatestRegion = 25000, PosX = '1021.903', PosY = '-32.60888', PosZ = '489.0886', AppointedTeleport = 2094");
// To reset a single players' position, put where Charname = @charname or whatever
// However the query above will change the position of all the players to a place in jangan, (I randomly chosen one from database).

mysqli_close($con);
?>
10/05/2015 01:28 KoKsPfLaNzE#5
btw sro is mssql, so mysqli_query will not work thats for mysql=)

you have to use mssql_query, or better PDO =)
10/05/2015 23:26 B13.#6
thx all,
but how to execute that query i mean if i just loaded the page it will be executed by it self or what ?