Guys, PHP+MySQL question

0 favourites
  • 7 posts
From the Asset Store
Plinko MYSQL Online
$210 USD
30% off
Plinko MYSQL Online Full Game Casino Construct 3 Game Html5
  • Guys, i have a big problem. i need to create separate table for each user i my database by sending user name via C2 project (meaning ajax POST), please, no question what for, just need this.

    So, can enyone explain me whre i have mistake?

    And here is the code:

    <?php

    $host = "xxx.mysql.com";

    $login = "u33678";

    $pass = "123456";

    $dbname = "u33678";

    $user = $_POST['user'];

    Header('Access-Control-Allow-Origin: *');

    Header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");

    Header("Content-Type: text/html; charset=UTF-8");

    $link = mysql_connect ($host, $login, $pass);

    mysql_select_db ($dbname , $link) or die("FUUUCK");

    mysql_query ("CREATE TABLE .$user. (id int not null auto_increment,pole1 varchar(10) not null,PRIMARY KEY(id))");

    ?>

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • try:

    $user = $_GET['user'];

    also.. remove dots from $user - mysql_query ("CREATE TABLE .$user. (

    mysql_query ("CREATE TABLE $user (

    this should work..

    <?php
    $host = "xxx.mysql.com";
    $login = "u33678";
    $pass = "123456";
    $dbname = "u33678";
    $user = $_GET['user']; 
    
    @header('Access-Control-Allow-Origin: *');
    @header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
    @header("Content-Type: text/html; charset=UTF-8");
    $link = mysql_connect ($host, $login, $pass);
    mysql_select_db ($dbname , $link) or die("FUUUCK");
    mysql_query ("CREATE TABLE  $user (id int not null auto_increment,pole1 varchar(10) not null,PRIMARY KEY(id))");
    ?>[/code:i4cv1kig]
  • no, was trying this. MySQL create table $user. name "$user" and that's all =(

    and i needed, that name of table will be variable and user will chose it's name by himself =(

  • i need to create for each user his own table with name, that user will post via ajax =/

  • exactly...

    if ajax POST then php GET variable..

    and you create new table

  • whpiv@t O_o

    How you do that? It's works!!! =)

    GREAT!!!

    Explain please, how you do that??

  • my mistake was to send DATA -> textbox.text and URL ->just address of php script.

    and you add URL ->"xxxxxxx.?user="URLEncode(Textbox.text)

    can you teach me?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)