Name a MySQL table

Hello

How should I name a MySQL table with a variable to an HTML form?

I enclose the code I have so far to this message.

Thank you

John

ArizonaJohn wrote:
> How should I name a MySQL table with a variable to an HTML form?

It is not a very good idea, because you don't know if the value
entered in the form is a legal table name, or even if it exists.
However, the code that you have does not work due to syntax errors.

If you really want to go ahead, try this:

<>
If (isset($_POST['name']) &! empty($_POST['name'])) {}
mysql_connect ("hostaddress", "username", "password") or
Die (mysql_error ());
@mysql_select_db ("sand2") or die (mysql_error ());

$table = mysql_real_escape_string($_POST['name']);

$query = "CREATE TABLE '$table' (VARCHAR (50)) of the site ';"
$result = mysql_query ($query) or die (mysql_error ());
}

?>

--
Adobe Community Expert David Powers
Author, "The Essential Guide to Dreamweaver CS4",
"PHP Solutions" & "PHP Object-Oriented Solutions.
http://foundationphp.com/

Tags: Dreamweaver

Similar Questions

  • The research of MySQL table names

    Hello

    I would like to find all the names of tables in a MySQL database using a simple HTML and PHP form. I'm stuck. I enclose the code I have so far. How can I request the search of all the names of the tables in the database?

    Thanks in advance,

    John

    The game, February 12, 2009 01:51:54 + 0000 (UTC), "ArizonaJohn".
    wrote:

    > Thanks for the help. When I try the code that you suggested, it gives me this error:
    >
    > Parse error: syntax error, unexpected T_FOREACH
    >
    > Looks like the loop "foreach" does not work. Any ideas?

    Well, I told you that it is not tested. ;-) He was missing a semicolon at the
    end of the line that precedes the inner foreach. I had also neglected print
    the opening

    tag. It has been tested and works:

    $result = mysql_query ("SHOW TABLES FROM sand2 LIKE ' % $find %'") ")
    or die (mysql_error ());
    {if (mysql_num_rows ($result) > 0)}
    {while ($table = mysql_fetch_row ($result))}
    print '.

    Table: $table [0]

    \n » ;
    $r = mysql_query ("SELECT * FROM ' $table [0]'");
    print '.
    \n » ;
    {while ($Row = mysql_fetch_row ($r))}
    print '.";
    {foreach ($row as $field)
    print '.";
    }
    print '.\n » ;
    }
    print '.
    $field
    \n » ;
    }
    } else {}
    Print "nothing found";
    }

    Gary

  • maximum length of the name of the table.

    Hi all

    I think that the maximum length of the array and the name of column in oracle 11g is 30 characters.
    I want to increase the limit I want to import a mysql database that is to have more big names in the table.
    I can set the length of the name and the table column name?

    Thanx.

    Before the migration, you can rename your tablename in MYSQL
    http://docs.Oracle.com/CD/E12151_01/doc.150/e12155/oracle_mysql_compared.htm

    You can't increase and change the length of the table

  • Can I use a username of the php session to select a mysql table?

    In my site, I have a situation where

    $_SESSION ['MM_Username"]

    will be the same name as a MYSQL table prepared.

    (There will be a limited number of users and tables)

    Instead of writing a long series of "else if" to deal with each user of each page, I want to use the $_SESSION ['MM_Username'] to point to the correct MSQL table.

    For example

    <? PHP $query_rstPalabs = "SELECT * FROM patricia WHERE YesNo > = 1";  ? >

    How can I replace the $_SESSION ['MM_Username'] for 'patricia' here in a way that the SQL would choose the table 'patricia '?

    Please be aware that I am not a professional designer and wading in the shallows of PHP/MSQL.  I use DW2004MX to help.
    Thank you.

    Smiffy47,

    Assign a variable with $_SESSION ['MM_Username"]. Call the variable in your query:

    Example:

    $user = $_SESSION ['MM_Username"];

    $user WHERE yesno >= 1" ; =""?>

    Be sure to use session_start at the beginning of your page so that you are allowed to call session variables in your application.

    This should be added before your declaration DOCTYPE (the very beginning of your page).

    -ST

  • Joining MySQL Tables

    I have a MySQL table that contains two user, each a different user id. I want to make a query that joins the table containing the table user to retrieve user names corresponding to these two user id how is this possible?

    "AngryCloud" wrote in message
    News:fgg691$1JT$1@forums. Macromedia.com...
    > Sorry, I do not think that my question I explained that well. Let me rephrase:
    >
    > I have a MySQL table that contains two user id, each other
    > user.
    > Each of the id is in another column. I want to make a query that
    > joins
    > user table that contains the table to retrieve the corresponding user names to the
    > time
    > user
    >
    > Lets say I have a table called Messages. A record in the salons of tables the
    > ID recipient is 26 'and the sender ID is 14'. I want to create a query
    > who
    > joins the table of Messages containing the data of the user table to get the names of users of
    > each
    > these users.
    >
    > Just for possible yet understand, let me show you an example query
    > who
    > doesn't make any sense, but it might be useful to describe what I'm trying
    > reach.
    >
    > 'SELECT messages.recipient_id, messages.sender_id, messages.message,
    > user_data.username
    > MESSAGES
    > User_data LEFT JOIN ON messages.recipient_id = user_data.id
    ' > User_data LEFT JOIN ON messages.sender_id = user_data.id.

    in fact it makes sense, but you must apply aliases for tables
    and columns

    SELECT messages.recipient_id, messages.sender_id, messages.message,
    recipient_data. UserName as beneficiary, sender_data.username as sender
    ((MESSAGES
    User_data LEFT JOIN AS recipient_data ON messages.recipient_id =
    USER_DATA.ID)
    User_data LEFT JOIN AS sender_data ON messages.sender_id = user_data.id)

  • Impossible to change the name of the Table in figures

    I'm unable to change the title of a table, when I change the title name and press on enter it reverts to the original title. I tried to click away and save the document, but both go back to the original title. The only way to work is, it seems if the option a table a few times then start trying a new title.

    This can happen when you have a table with the same name on the same sheet.  Numbers of refuses to accept the name "double".  Check the names of the tables on the al sheet again.  One way to do that is to click the right part of the tab "" at the top with the sheet and inspect the table names in the drop-down menu that appears.

    SG

  • The name of the Table may be 2 lines

    Can the name of the Table "numbers be 2 lines?

    I don't seem to be able to make a table name two lines.  You can use a box of text instead, while hiding the name of the table:

    Disable the table name in the Table formatter (lower-right)

    Add a text box

  • What is the name of the table that has the name of the custom in the Oracle database Section?

    What is the name of the table that has the name of the custom in the Oracle database Section?

    Thank you

    Nefertari

    The names of the custom Sections are stored in commonExtendedAttributeML, the extended attribute table.

  • Using the name of the table to Insert variable

    Hello

    I'm trying to use a variable as the name of table to do an insert.

    The name of the table where my datas have to be inserted is EVV_ + the Ref_var of data.

    My code will be more explicit:

    SELECT 'EVV_ ' | Ref_Equip

    IN v_Ref_Equip

    OF user.c_equip

    WHERE clef_equip = v_clef_equip;

    INSERT INTO 'user '. || v_Ref_Equip (Clef_var, Date1, value)

    VALUES (v_clef_var, 18 May 01 ', 49, 156');

    I can't find the proper syntax for inclusion in. I tried a lot of syntax, but not good.

    So, how can I concatenate 'user.' + my v_Ref_Equip variable?

    Thanks for the help

    Have a look at this immediate execution method

    SQL> set serveroutput on;
    SQL> declare
      2  v_tab_name varchar2(20) := 'temp';
      3  begin
      4      execute immediate 'create table temp(id number)';
      5      execute immediate 'insert into '||v_tab_name||' values (1)';
      6      commit;
      7  end;
      8  /
    
    PL/SQL procedure successfully completed.
    
    SQL> select * from temp;
    
            ID
    ----------
             1
    
    SQL>
    
  • Need names of underlying tables RCMP

    Hi all

    Is it possible to find on standard objects (supplied by Oracle) details of TCG as the name of the table, the columns available... etc?

    The reasong because it is, once I have all the details on a standard, I can create those customized for information not mentioned in the standard.

    I have tried searching in all tables of RCMP owner, but I couldn't get a table with the information I'm looking for.

    Any help in this is much appreicated


    Kind regards

    Suresh

    Hi Suresh,

    Hope the following query helps your snippet.

    SQL > select sess_no, def_txt from snp_sess_task, where lower (task_name2) as

    more low ('TCG_INTR__') arrested by sess_no desc;

    Thank you

    Naveen

  • name of the table in the EM repository to return the State of the database

    Hi, I would like to know the name of the table in MS repository on which I can query for the status of the database. I've tired to search in the target of $ mgmt and did not find the status of the db

    Please take a look at the AVAILABILITY_CURRENT view of $ MGMT.

    http://docs.Oracle.com/CD/E24628_01/doc.121/e57277/ch19_monview.htm#EMVWS12346

    Kind regards

    -Loc

  • SQL how to use a variable and use the result as a reference for the name of the table

    Hi all

    I have new in the declaration of Oracle, sorry in advance if something is easy for you all. BTW, I have this scenario:

    I have a table OL structured in this way:

    Date - it contains dates, for example 11/01/2015

    TableName - it contains strings, for example, OL1, OL2, OL3 and so on...

    Then I have a different table, the name of these tables are of the same name in the table of the OL, so I have table table, OL1, OL2, OL3 table and so on. The structure of these tables is the same. And Yes.

    table OL1

    ---------------------------------------------------------------

    ID LAST NAME FIRST NAME PHONE

    ---------------------------------------------------------------

    1 JOHN DOE 12345679

    2 PAUL 111111122 TIBBS

    table OL2

    ---------------------------------------------------------------

    ID LAST NAME FIRST NAME PHONE

    ---------------------------------------------------------------

    1 ANNA KRAIG (NULL)

    NATHAN FRESHMANN 111111133 2

    If the scenario is clear, I would like to retrieve the value (null), research in all the OL * tables by using the value of the OL table (tablename) max.

    If I'm going to do these simple steps, I got the result:

    Select max (TableName) OL

    the result will be OL2

    # I know not how to use the option set to avoid changing the table name in the sql statement all the time.

    set mytable = 'OL2.

    Select Name, family name

    of & mytable

    When the phone is null

    Any idea?

    Thank you very much in advance.

    Hello

    run immediately "select dt.log_id, obj.presentation_name, dl.begin_time

    bulk collect into v_result_set

    of ' | v_ol |' dt join internal ol_object obj on

    DT.object_type_id = obj.object_type_id

    inner join ol_chunk_log dl on

    DT.log_id = DL.log_id

    where dt.data_value is null';

    dbms_output.put_line (v_ol);

    end;

    Correct the code such as:

    run immediately "select dt.log_id, obj.presentation_name, dl.begin_time

    of ' | v_ol |' dt join internal ol_object obj on

    DT.object_type_id = obj.object_type_id

    inner join ol_chunk_log dl on

    DT.log_id = DL.log_id

    where dt.data_value is null' bulk collect into v_result_set;


    for i in v_result_set.first ... v_result_set. Last

    loop

    dbms_output.put_line ('LOG ID: ' | ) ( v_result_set.log_id (i)) ;

    dbms_output.put_line (' NAME CLOSELY: ' |) v_result_set.presentation_name (i));

    dbms_output.put_line (' START TIME: ' |) ( v_result_set.begin_time (i)) ;

    end loop;

    end;

    Kind regards.

  • RICs when MergeTable using with the names of multiple tables

    Hello world!

    I just saw, as v11 OWM MergeTable media with the names of multiple tables. As I couldn't find anything in the documentation, here's a question:

    It also means, that RICs are automatically taken into account regarding the order of INSERTS/CHANGES/DELETES?

    That would actually really great and simplify the merge of our application mechanism a lot.

    Kind regards

    Andreas

    Hi Andreas,

    This feature works the same MergeWorkspace, but with a smaller set of tables.  Tables will always be merged into the order of the child table first, then the parent tables.  However, foreign key constraints are not validated until all tables have been merged.  This would prevent a mistake to be triggered when the child table merging before the parent merging table data in the parent workspace.

    Kind regards

    Ben

  • Find the name and the table constraint type based on the name of the field

    I have a field name or a column with me... I want to find the name of the table is a primary key... Any request to make this work so that the running costs are low...

    Currently, I mix dba_constraints and ALL_TAB_COLUMNS to get this... is possible to extract the data of a process cost effective single table/any other is appreciated

    You must include the USER/ALL_CONSTRAINTS with USER/ALL_CONS_COLUMNS to achieve your desired results. For your specific condition, you can try this query.

    Select constraint_name

    column_name

    de)

    Select c.constraint_name

    cc.column_name

    count on column_count (c.constraint_name score) (cc.column_name)

    from user_constraints c

    Join user_cons_columns cc

    on c.constraint_name = cc.constraint_name

    where constraint_type = 'P '.

    )

    where column_name = 'EMPNO '.

    and column_count = 1;

    I used USER_CONSTRAINTS and USER_CONS_COLUMNS. If you use ALL or DBA dictionary table add join OWNER condition as well.

  • Look for the name of the table of choice in stock or manufacturing


    What is the name of the table in the inventory which is used to store information in list of choice?

    To make my question clear, here are the steps:

    (1) connect to Oracle EBS (R12) with responsibility for the inventory.

    2) go to settings

    (3) go in the research - you see the screen named "manufacturing research."

    4) click on your flashlight to select the value for the Type.

    (5) for example, select MTL_CONVERSION_TYPE - you'll see the Code values and columns meaning listed below:

    Meaning of the code

    1 specific item

    2 standard

    3 standard and specific item

    Question:

    What is the name of the table that contains the values above?

    Hello

    I finally found the name of the table. The name is "FND_LOOKUP_VALUES".

    Thank you

Maybe you are looking for

  • RDS Setup error - Server R2 Standard 2012

    Hello! I try to install RDS on Server R2 2012. His failure to get and when I checked the events connects it shows the error " the Remote Desktop Management service depends on the following service: MSSQL$ MICROSOFT # was this service cannot be instal

  • Help me! Downgrading from Vista to Win XP ERROR NEED to ADMIN PASSWORD

    Good, so I'm downgrading and when I installed my XP CD and XP starts it says ERROR. Then I went to recovery and he asked me the Admin password. When I put it in it says it is incorrect when it is my password. What the? Please help me! I deleted every

  • Problems upgrading to Windows 10 Windows 7

    During the upgrade to Windows 10 Windows 7 form, I came to "what needs your attention", it asked me to uninstall McAfee, which I've tried to do through programs and features, I'm stuck at: Can someone help me to manually uninstall this annoying softw

  • VMware Performance event triggers use case issues.

    1) can event Performance adapter CPO VMware triggers and their Attributes of the SAMPLE SIZE, INTERVAL and CONDITIONS be configured for the following use cases? (2) event VMWare Performance triggers may be CORRELATED?  and if so it would take to sati

  • VAAI - what I mean... and what don't get me?

    So I am running vSphere 5.5, and my data stores reside on a HP 3PAR 7200, using the 10Gb iSCSI Protocol. In order to recover space on my thinly provisioned volumes, I run "esxcli storage vmfs unmap-l < name >". It seems free storage for allows me to