can anyone give me a code to add a table to mysql database via php file.. my phpmyadmin won't open but mysql is still online..
can anyone give me a code to add a table to mysql database via php file.. my phpmyadmin won't open but mysql is still online..
.:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
.:.: Stand up for what is right, even if you stand alone:.:.
You could drop them in via php, find an installer![]()
i got this
but it gives this error:PHP Code:<?php
// Make a MySQL Connection
mysql_connect("", "", "") or die(mysql_error());
mysql_select_db("") or die(mysql_error());
// Create a MySQL table in the selected database
mysql_query("CREATE TABLE `messages` (
`id` int(11) NOT NULL auto_increment,
`reciever` varchar(25) NOT NULL default '',
`sender` varchar(25) NOT NULL default '',
`subject` text NOT NULL,
`message` longtext NOT NULL,
`recieved` enum('0','1') NOT NULL default '0',
PRIMARY KEY (`id`)")
or die(mysql_error());
echo "Table Created!";
?>
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 8
.:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
.:.: Stand up for what is right, even if you stand alone:.:.
Add this on the end.
) TYPE=MyISAM;
still same error.
.:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
.:.: Stand up for what is right, even if you stand alone:.:.
Try this:
can not say it will work but give it a go.PHP Code:<?php
// Make a MySQL Connection
mysql_connect("", "", "") or die(mysql_error());
mysql_select_db("") or die(mysql_error());
// Create a MySQL table in the selected database
mysql_query("CREATE TABLE messages (
id int unsigned NOT NULL auto_increment,
reciever varchar(25) NOT NULL default '',
sender varchar(25) NOT NULL default '',
subject text NOT NULL,
message longtext NOT NULL,
recieved enum('0','1') NOT NULL default '0',
PRIMARY KEY (id)
) TYPE=MyISAM;")or die(mysql_error());
echo "Table Created!";
?>
rep. it worked.
.:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
.:.: Stand up for what is right, even if you stand alone:.:.
Cool its good that thats works i have not made mysql tables for about 5 weeks![]()
nvm fixed it. missed a session start..
how i get rid of all these errors:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent
also..
I'm using a php navigation
that does ?page=viewmsg
So how do i get viewmsg.php?msg_id=5
to work with that.
Last edited by Colin-Roberts; 13-08-2008 at 12:37 PM.
.:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
.:.: Stand up for what is right, even if you stand alone:.:.
For the session_start() error, make sure session_start() is right at the top of your code.nvm fixed it. missed a session start..
how i get rid of all these errors:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent
also..
I'm using a php navigation
that does ?page=viewmsg
So how do i get viewmsg.php?msg_id=5
to work with that.
Lets set the stage on fire, and hollywood will be jealous.
Want to hide these adverts? Register an account for free!