Hi,
Hope you guys can help me out~~ I have a config.php file. I want to
conncet to my own mysql version. When i run the config.php file as
below, i get all successful message. However, when i take a look the
database information in doc environment, I don't see any database or
table created.
<html>
<head><title>Cr eate Database and table</title></head>
<body>
<?php
//connect to the database, write, and execute the query
$linkID = mysql_connect(" localhost", "", "") or die ('I cannot connect
to the
database because: ' . mysql_error());
if (!$_GET['linkID'])
{
print("The connection to the server was made successfully.<b r>");
}
else
{
print("The connection to the server failed.<br>");
}
mysql_close($_G ET['linkID']);
$DBName="Krista ";
$TableName = "Employee";
//connect to the database, write, and execute the query
$Link = mysql_connect(" localhost",""," ");
mysql_select_db ("Krista", $_GET['Link']);
$resultID = mysql_query ("CREATE table Employee(Employ eeID INT
UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
Employee_Name TEXT",$_GET['Link']);
if(!$_GET['resultID']){
print("The query was successfully executed!<BR>\n ");
}
else{
print("The query could not be executed!<BR>\n ");
}
mysql_close($_G ET['Link']);
?>
</body>
</html>
In addition, i change the global_register to on. However, I still need
to use $_GET['username'] like this. I want to use $username instead of
$_GET['xxx'].
Thanks,
Krista 3 3108
Not sure why you're:
* passing variables through GET when you're declaring them within your
script
* making and closing two connections to create one table
Unless you're passing variables through a form or a url, why not just access
the variables directly?
Therefore:
$linkID = mysql_connect(" localhost", "", "") or die ('I cannot connect to
the database because: ' . mysql_error() );
if ($linkID) {
echo "The connection to the server was made successfully<br />";
}
$DBName="Krista ";
$TableName = "Employee";
# create a database if one doesn't exist
mysql_create_db ($DBName);
#select the database you just created
mysql_select_db ($DBName);
#design your query
$resultID = "CREATE TABLE Employee(
EmployeeID int unsigned auto_increment not null,
Employee_Name text,
PRIMARY KEY(EmployeeID) )";
#run the query
$table = mysql_query($re sultID) or die("Create table Error: ". mysql_error()
);
#if table was created, echo a message to the screen
if ($resultID) {
echo "The table $TableName was successfully created";
}
mysql_close($li nkID);
?>
</body>
</html>
"Krista" <yw*****@hotmai l.com> wrote in message
news:eb******** *************** ***@posting.goo gle.com... Hi, Hope you guys can help me out~~ I have a config.php file. I want to conncet to my own mysql version. When i run the config.php file as below, i get all successful message. However, when i take a look the database information in doc environment, I don't see any database or table created.
<html> <head><title>Cr eate Database and table</title></head> <body> <?php
//connect to the database, write, and execute the query $linkID = mysql_connect(" localhost", "", "") or die ('I cannot connect to the database because: ' . mysql_error());
if (!$_GET['linkID'])
{ print("The connection to the server was made successfully.<b r>"); } else { print("The connection to the server failed.<br>"); }
mysql_close($_G ET['linkID']);
$DBName="Krista "; $TableName = "Employee";
//connect to the database, write, and execute the query $Link = mysql_connect(" localhost",""," ");
mysql_select_db ("Krista", $_GET['Link']);
$resultID = mysql_query ("CREATE table Employee(Employ eeID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, Employee_Name TEXT",$_GET['Link']);
if(!$_GET['resultID']){ print("The query was successfully executed!<BR>\n "); } else{ print("The query could not be executed!<BR>\n "); }
mysql_close($_G ET['Link']);
?> </body> </html>
In addition, i change the global_register to on. However, I still need to use $_GET['username'] like this. I want to use $username instead of $_GET['xxx'].
Thanks, Krista
Whoa, I was a little too quick on the submit key. The amended code should
read as follows:
$resultID = "CREATE TABLE $TableName(
EmployeeID int unsigned auto_increment not null,
Employee_Name text,
PRIMARY KEY(EmployeeID) )";
$table = mysql_query($re sultID) or die("Create table Error: ". mysql_error()
);
if ($table) {
echo "The table $TableName was successfully created";
}
"Tom" <ly*****@nospam hotmail.com> wrote in message
news:59iEb.4622 $Fg.4394@lakere ad01... Not sure why you're: * passing variables through GET when you're declaring them within your script * making and closing two connections to create one table
Unless you're passing variables through a form or a url, why not just
access the variables directly?
Therefore: $linkID = mysql_connect(" localhost", "", "") or die ('I cannot connect to the database because: ' . mysql_error() );
if ($linkID) { echo "The connection to the server was made successfully<br />"; }
$DBName="Krista "; $TableName = "Employee";
# create a database if one doesn't exist mysql_create_db ($DBName); #select the database you just created mysql_select_db ($DBName);
#design your query $resultID = "CREATE TABLE Employee( EmployeeID int unsigned auto_increment not null, Employee_Name text, PRIMARY KEY(EmployeeID) )";
#run the query $table = mysql_query($re sultID) or die("Create table Error: ".
mysql_error() );
#if table was created, echo a message to the screen if ($resultID) { echo "The table $TableName was successfully created"; }
mysql_close($li nkID); ?> </body> </html>
"Krista" <yw*****@hotmai l.com> wrote in message news:eb******** *************** ***@posting.goo gle.com... Hi, Hope you guys can help me out~~ I have a config.php file. I want to conncet to my own mysql version. When i run the config.php file as below, i get all successful message. However, when i take a look the database information in doc environment, I don't see any database or table created.
<html> <head><title>Cr eate Database and table</title></head> <body> <?php
//connect to the database, write, and execute the query $linkID = mysql_connect(" localhost", "", "") or die ('I cannot connect to the database because: ' . mysql_error());
if (!$_GET['linkID'])
{ print("The connection to the server was made successfully.<b r>"); } else { print("The connection to the server failed.<br>"); }
mysql_close($_G ET['linkID']);
$DBName="Krista "; $TableName = "Employee";
//connect to the database, write, and execute the query $Link = mysql_connect(" localhost",""," ");
mysql_select_db ("Krista", $_GET['Link']);
$resultID = mysql_query ("CREATE table Employee(Employ eeID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, Employee_Name TEXT",$_GET['Link']);
if(!$_GET['resultID']){ print("The query was successfully executed!<BR>\n "); } else{ print("The query could not be executed!<BR>\n "); }
mysql_close($_G ET['Link']);
?> </body> </html>
In addition, i change the global_register to on. However, I still need to use $_GET['username'] like this. I want to use $username instead of $_GET['xxx'].
Thanks, Krista
"Tom" <ly*****@nospam hotmail.com> wrote in message news:<59iEb.462 2$Fg.4394@laker ead01>... Not sure why you're: * passing variables through GET when you're declaring them within your script * making and closing two connections to create one table
Unless you're passing variables through a form or a url, why not just access the variables directly?
You are right, I want to access the variables directly. However, when
i work as ur code in the following, I cannot display server was made
successfully.
If i do ($_GET['linkID']), i can show the successful message. is it my
config has problem, so i can access the varible directly? But the
global_register is on already. I dont know what is the problem
if ($linkID) {
echo "The connection to the server was made successfully<br />";
Therefore: $linkID = mysql_connect(" localhost", "", "") or die ('I cannot connect to the database because: ' . mysql_error() );
if ($linkID) { echo "The connection to the server was made successfully<br />"; }
$DBName="Krista "; $TableName = "Employee";
# create a database if one doesn't exist mysql_create_db ($DBName); #select the database you just created mysql_select_db ($DBName);
#design your query $resultID = "CREATE TABLE Employee( EmployeeID int unsigned auto_increment not null, Employee_Name text, PRIMARY KEY(EmployeeID) )";
#run the query $table = mysql_query($re sultID) or die("Create table Error: ". mysql_error() );
#if table was created, echo a message to the screen if ($resultID) { echo "The table $TableName was successfully created"; }
mysql_close($li nkID); ?> </body> </html>
When i try your code as above, I still cannot get the result. The IE
seems keeping load the php file.Cannot get it.
"Krista" <yw*****@hotmai l.com> wrote in message news:eb******** *************** ***@posting.goo gle.com... Hi, Hope you guys can help me out~~ I have a config.php file. I want to conncet to my own mysql version. When i run the config.php file as below, i get all successful message. However, when i take a look the database information in doc environment, I don't see any database or table created.
<html> <head><title>Cr eate Database and table</title></head> <body> <?php
//connect to the database, write, and execute the query $linkID = mysql_connect(" localhost", "", "") or die ('I cannot connect to the database because: ' . mysql_error());
if (!$_GET['linkID'])
{ print("The connection to the server was made successfully.<b r>"); } else { print("The connection to the server failed.<br>"); }
mysql_close($_G ET['linkID']);
$DBName="Krista "; $TableName = "Employee";
//connect to the database, write, and execute the query $Link = mysql_connect(" localhost",""," ");
mysql_select_db ("Krista", $_GET['Link']);
$resultID = mysql_query ("CREATE table Employee(Employ eeID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, Employee_Name TEXT",$_GET['Link']);
if(!$_GET['resultID']){ print("The query was successfully executed!<BR>\n "); } else{ print("The query could not be executed!<BR>\n "); }
mysql_close($_G ET['Link']);
?> </body> </html>
In addition, i change the global_register to on. However, I still need to use $_GET['username'] like this. I want to use $username instead of $_GET['xxx'].
Thanks, Krista This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mr Dygi |
last post by:
Hi,
PHP 4.3.4 installed manually from package *.zip and Apache 2. I have a
problem with this simple code:
<?php
$link = mysql_connect("127.0.0.1","","")
or die("Could not connect: " . mysql_error());
echo "Connected successfully";
mysql_close($link);
|
by: atlasyeo |
last post by:
Hi, my first time posting on a newsgroup. anyway, let's cut to the
chase.
I'm trying to migrate mysql database form one server to another server.
So I copied the data from /var/lib/mysql to the other one.. and use
INSERT INTO from the old database to the new one..so the Top level
'mysql' database has all the correct users and password and priviledge.
however, when one of the php website trying to load..it'll say
|
by: Mark Adams |
last post by:
I really need some help with this. MySQL will not start on boot despite
everything I've done to make sure that it is set to do so.
When I start it as root from a terminal with "/usr/bin/mysqld_safe
--skip-grant-tables &" I show several mysqld procs. and one mysqld_safe,
but I can't connect:
# ps -aux| grep mysql
Warning: bad syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
root 3650 0.0 0.1 2276 664 ? S ...
|
by: Denis Labon |
last post by:
I can't connect to mysql server using the mysql-connector-java-3.0.11.
I was able to run the same program when I was running Suse 9.0 but
since I install Suse 9.1, I can't connect.
The error message is:
java.sql.SQLException: Unable to connect to any hosts due to
exception: java.net.ConnectException: Connection refused
I'm using mysql-standard-4.0.14 and able to get in the mysql server by
typing:
bin/mysql -uroot -ptest
|
by: jiing |
last post by:
Now let me describe what I have done and my purpose:
Originally, I want to user ports to install phpBB
But I found that phpBB doesn't support mysql 5.x (but the ports
installed mySQL 5.0.0 alpha)
so I deinstall mysql5-server and mysql5-client
And then I install mysql41-server and mysql41-client on FreeBSD 5.3 by
ports
but now , mysql is not workable
| |
by: Shelly |
last post by:
(also posted to alt.php.sql and comp.databases.mysql)
This is an old problem. I extensively researched the postings on the
internet and have found no solution. So, perhaps someone here can help.
The problem is that from my index.php file I get:
Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock'
|
by: pc |
last post by:
hi everyone,
I am trying to connect to a new mysql installation. I have given root
permission to connect to all databases from anywhere;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'passwd' WITH
GRANT OPTION;
I can log on locally by specifying the host name:
|
by: markodilore |
last post by:
Hey Guys, you helped me once when I tryied to create a database : "Access denied for user ''@'localhost' ". On my Mac OS 10.4, I had no problem creating database and modifying it from the terminal. But I use Dreamweaver 8 to connect to MySQL, with its built-in feature "MySQL Connection" I write this:
Connection Name: con_test001
MySQL Server: localhost
User Name: root
Password: 55555
Database: test001 (which is a database I already...
|
by: swarajtnj |
last post by:
Hi Friends,
I am using MySql 5.0. With the Front end as ASP.NET 2.0.
I am working a small concern.
my company local server to connect the MySql is perfectly working.
But when i Connect to the Client server Ip Address thrown an Error. I Captured the error as follows:
"Cann't connect to MySql sever @ localhost(10061)"
Next one "Access denied for user "saathii"@125.99.195.246' Using Password:YES".
Client ip Add: 63.247.82.34
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |