Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //if(!isset($_SESSION)) header("location:../board.php");
- $servername = "localhost";
- $username = "root";
- $password = "pass";
- $dbname = "chat";
- $cto=new PDO("mysql:host=$servername;dbname=$dbname",$username,$password);
- switch($_POST['why']){
- case "gclass":
- $csql=$cto->prepare("SELECT * FROM class");
- $csql->execute();
- $col=[];
- $cls=[];
- while($r=$csql->fetch()){
- $col[]=$r['color'];
- $cls[]=$r['classes'];
- }
- $return=[
- 'color'=>$col,
- "class"=>$cls,
- ];
- echo json_encode($return);
- $cto=null;
- die();
- break;
- }
- ?>>
Add Comment
Please, Sign In to add comment