Re: forms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What is a "connect_db" file?


----- Original Message ----- From: "bigmark" <neretlis@xxxxxxxxxxxxxx>
To: <php-general@xxxxxxxxxxxxx>
Sent: Sunday, October 10, 2004 11:33 PM
Subject: Re: forms



Thanks-- i got that going-GREAT !  now i have a form that creates the
database and tables, any ideas how i can get this info to change the
connect_db file so that it doesnt have to be done manually.



"Minuk Choi" <Choi.Minuk@xxxxxxxxxxx> wrote in message
news:000401c4af3f$858bf940$0200a8c0@xxxxxxxx
try this :

$link = mysql_connect($host, $user, $pass);

Note : No SINGLE quotes.

In PHP, quotations are as follows

$host = 'localhost';
$a = '$host';
$b = "$host";

echo $a;

that prints $host

echo $b;

that prints localhost.

HTH
-Minuk


----- Original Message ----- From: "bigmark" <neretlis@xxxxxxxxxxxxxx> To: <php-general@xxxxxxxxxxxxx> Sent: Sunday, October 10, 2004 10:23 PM Subject: forms/variables/create database


> hi, does anyone know why this is not working, i have married 2 pieces > of
> code together and i have no idea what im doing--any help is > appreciated.
> I get an error that says it cant find the host--$host so obviusly its
not
> passing it from the form.
>
> /////////////////////////////////////////
> <?php
> $host =  $_POST['host'];
> $user =  $_POST['user'];
> $pass =  $_POST['pass'];
> $db_name =  $_POST['db-name'];
>
>
> $link = mysql_connect('$host', '$user', '$pass');
> if (!$link) {
>   die('Could not connect: ' . mysql_error());
> }
>
> if (mysql_create_db('db_name')) {
>   echo "Database created successfully\n";
> } else {
>   echo 'Error creating database: ' . mysql_error() . "\n";
> }
> ?>
> /////////////////////////////////////////////
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux