mgtm3
asked on
what is wrong with this command
i am tring to make a new table and the table dose not get created and i dont get any error
<?php
include 'link.php';
$fname="sffesd";
$sql = 'CREATE TABLE $fname (
`id` INT( 200 ) UNSIGNED NOT NULL AUTO_INCREMENT,
`sname` VARCHAR( 150 ) NOT NULL,
`sadas` VARCHAR( 150 ) NOT NULL,
`sdst` VARCHAR( 150 ) NOT NULL,
`info` VARCHAR( 150 ) NOT NULL,
`link` VARCHAR( 150 ) NOT NULL,
PRIMARY KEY ( `id` )
)';
mysqli_query( $link, $sql );
?>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
nope dose not work
i get this error
Warning: mysqli_query() expects parameter 1 to be mysqli, string given in C:\wamp\www\movie\uploader .php on line 20
i get this error
Warning: mysqli_query() expects parameter 1 to be mysqli, string given in C:\wamp\www\movie\uploader
Though I did leave a spurious comma in my amendment... corrected below.
<?php
include 'link.php';
$fname="sffesd";
$sql = 'CREATE TABLE $fname (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
sname VARCHAR(150) NOT NULL,
sadas VARCHAR(150) NOT NULL,
sdst VARCHAR(150) NOT NULL,
info VARCHAR(150) NOT NULL,
link VARCHAR(150) NOT NULL)';
mysqli_query( $link, $sql );
ASKER
o.k i did what purplepomegranite told me and i got "$fname" as the name of the table and not sffesd
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks
Thanks for the points, though I am left wondering why they were split between a solution and an incorrect statement...
ASKER
because he tried to solve the proplem
and i only give him 50 points
and i only give him 50 points
Open in new window