Page 1 of 1

Help with string

Posted: Thu Feb 23, 2012 11:45 am
by shihan
Hi there,

I'm new in php coding so I need little help.

I need to find way to create table trough php code but with name of table from string. How to write that correct
here is example of my needs

$query ='CREATE TABLE $table_name (
`id` INT( 11 ) NOT NULL AUTO_INCREMENT,
`vis_name` VARCHAR( 50 ) NOT NULL,
`vis_key` VARCHAR( 50 ) NOT NULL,
`date` DATETIME NOT NULL,

PRIMARY KEY ( `id` )
)';

Thank you in advance

Re: Help with string

Posted: Thu Feb 23, 2012 12:18 pm
by Celauran
Variables aren't parsed inside single quotes. Use double quotes and the code you posted should work fine.