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..
Printable View
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..
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
Add this on the end.
) TYPE=MyISAM;
still same error.
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.
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.