0 Favourites

Guys, PHP+MySQL question

  • 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:

    $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: *');[/p] header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");[/p] header("Content-Type: text/html; charset=UTF-8");[/p] $link = mysql_connect ($host, $login, $pass);[/p] mysql_select_db ($dbname , $link) or die("FUUUCK");[/p] mysql_query ("CREATE TABLE $user (id int not null auto_increment,pole1 varchar(10) not null,PRIMARY KEY(id))");[/p] ?>[/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

  • wht O_o

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

    GREAT!!!

    Explain please, how you do that??

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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)