Avatar billede basicq Nybegynder
24. marts 2001 - 10:50 Der er 5 kommentarer og
1 løsning

fejl 1049 med mysql

Jeg har lige installered mysql og ved ikke noget om mysql overhovedet.
Jeg får denne fejl når jeg kører et php script der bruger mysql..

Database error: cannot use database sendcard
MySQL Error: 1049 (Unknown database \'sendcard\')
Session halted.

Jeg mangler lidt viden om hvordan jeg sætter et php script op. hvad med feks de har linier hvad skal der stå i dem.
$dbhost    = \"localhost?\";
$dbdatabase = \"sendcard?\";
$dbuser    = \"root?\";
$dbpass = \"?\";
i scriptet bruges sendcard som en database, skal jeg så oprette en mappe som hedder sendcard et sted!
Avatar billede limemedia Nybegynder
24. marts 2001 - 11:06 #1
http://www.mysql.com/docs kan nok sætte dig igang :)
Avatar billede basicq Nybegynder
24. marts 2001 - 11:08 #2
ok nu får jeg en anden fejl.
--------------------------------------------------
Database error: Invalid SQL: INSERT INTO sendcard (image, caption, bgcolor, towho, to_email, fromwho, from_email, fontcolor, fontface, message, music, id, notify, emailsent) VALUES (\'sponsor.gif\', \'\', \'#FFFFFF\', \'asedf\', \'a@m.dk\', \'asldkjf\', \'a@s.com\', \'#000000\', \'\', \'aklsjdfæklajsdfælkj\', \'\', \'985428557\', \'1\', \'1\')
MySQL Error: 1146 (Table \'sendcard.sendcard\' doesn\'t exist)
Session halted.
------------------------------------------------
table sendcard.sendcard dowsn´t exit hvad skal det nu betyde..
Avatar billede limemedia Nybegynder
24. marts 2001 - 11:14 #3
din database tabel findes ikke... du skal oprette din tabel før du kan benytte den
Avatar billede basicq Nybegynder
24. marts 2001 - 11:18 #4
Jeg har en tabel som hedder tabel.php og den ser således ud.
--------------------------------------------------
<?#!/usr/bin/php

// Variable details:                                //
// $image : Image name                              //
// $caption : The caption which goes under the image //
// $to : Name of recipient                          //
// $to_email : Recipient\'s email address            //
// $from : Name of sender                            //
// $from_email : Sender\'s email address              //
// $message : The card\'s message                    //
//                                                  //
// Note that any \" must be escaped like \\\"          //
// so $var = \"...said \"Oh!\" and groaned\"; should be  //
//  $var = \"...said \\\"Oh!\\\" and groaned\";            //
///////////////////////////////////////////////////////


// Choose your database file
// $dbfile = \"db_ibsql.php\"; // Interbase
// $dbfile = \"db_msql.php\"; // MSQL
// $dbfile = \"db_mssql.php\"; // Microsoft SQL
$dbfile = \"db_mysql.php\"; // MySQL
// $dbfile = \"db_oci8.php\"; // Oracle/OCI8
// $dbfile = \"db_odbc.php\"; // ODBC
// $dbfile = \"db_oracle.php\"; // Oracle
// $dbfile = \"db_pgsql.php\"; // PostgreSQL
// $dbfile = \"db_sybase.php\"; // Sybase


// Enter your database details
$dbhost    = \"localhost\";
$dbdatabase = \"sendcard\";
$dbuser    = \"root\";
$dbpass = \"\";

// Name of the table the postcards are stored in
$tbl_name = \"sendcard\";

// The subject of the message sent to the receipient
$youhavecard_subject = \"$from har sendt dig et postkort!\";

// This is the message sent to the recipient of the card.
//It can span multiple lines.  You must leave sendcard.php?view=1&id=$id in the url!
$youhavecard = \"Hello $to, $from her sendt dig et postkort!\";

// The subject of the message sent to the sender

$cardreceived_subject = \"Tak fordi du sendte et postkort her fra.\";

// This is the message sent to the sender to notify him that the card
// has been received.  It can span multiple lines.

$cardreceived = \"Hello $from, Tak for de du sendte et postkort. $to læste kortet den $date. Kom snart igen\";

// How long you want the postcard kept for in seconds e.g. 1209600 = 14 days!
// You can work it out using the following formula:
// {num of days} x 24 x 3600 = num of seconds. 
// So 21 days is: 21 x 24 x 3600 = 1814400

$kept = 1209600;  // This is 14 days!
// $kept = 1814400;  // This is 21 days!
// $kept = 3600;  // This is one hour! (Use for testing only)

// Message to appear at the bottom of the received card
$view_message = \"To send a postcard, please visit <a href=\\\"http://www.zico.dk\\\">sendcard</a>\";


// Message shown when the card has been sent
$thankyou = \"Tak fordi du sendte et postkort $to.  For at sende et til <a href=\\\"index.php\\\">Tryk her</a>.\";

// If you want to use the feature that allows a visitor to send a card on an advance date, set this variable to 1.  Otherwise, set it to 0.  Remember to remove the \"Send the card when?:\" message from form.tpl :-)
$use_adv_date = \"1\";
$use_fontface = \"1\";
$use_fontcolor = \"1\";
$use_bgcolor = \"1\";
$use_music = \"1\";

///////////////////////////////////////////////////////////////////
//                                                              //
//      You shouldn\'t need to edit the variables below!        //
//          Only do so if you know what you\'re doing.            //
//                                                              //
///////////////////////////////////////////////////////////////////

// The code for the send button
$send_button = \"        <form method=\\\"post\\\" action=\\\"sendcard.php\\\">
        <input type=\\\"hidden\\\" name=\\\"image\\\" value=\\\"$image\\\">
        <input type=\\\"hidden\\\" name=\\\"caption\\\" value=\\\"$caption\\\">
        <input type=\\\"hidden\\\" name=\\\"bgcolor\\\" value=\\\"$bgcolor\\\">
        <input type=\\\"hidden\\\" name=\\\"to\\\" value=\\\"$to\\\">
        <input type=\\\"hidden\\\" name=\\\"to_email\\\" value=\\\"$to_email\\\">
        <input type=\\\"hidden\\\" name=\\\"from\\\" value=\\\"$from\\\">
        <input type=\\\"hidden\\\" name=\\\"from_email\\\" value=\\\"$from_email\\\">
        <input type=\\\"hidden\\\" name=\\\"fontface\\\" value=\\\"$fontface\\\">
        <input type=\\\"hidden\\\" name=\\\"fontcolor\\\" value=\\\"$fontcolor\\\">
        <input type=\\\"hidden\\\" name=\\\"message\\\" value=\\\"$message\\\">
        <input type=\\\"hidden\\\" name=\\\"music\\\" value=\\\"$music\\\">
        <input type=\\\"hidden\\\" name=\\\"notify\\\" value=\\\"$notify\\\">
        <input type=\\\"hidden\\\" name=\\\"id\\\" value=\\\"$id\\\">
        <input type=\\\"submit\\\" name=\\\"send\\\" value=\\\"Send Card\\\">
        </form>\";

$email_error = \'<tr><td width=\"100%\" colspan=\"2\"><font color=\"#FF0033\" size=\"+1\"><b>Indtast en rigtig E-mail</b></font></td></tr>\';

?>
--------------------------------------------------
så den skulle være der. Men jeg ved ikke rigtigt om den ligge det rigtige sted..
Avatar billede basicq Nybegynder
24. marts 2001 - 11:23 #5
ok det var vist ikke lige den, her er min tabel.
--------------------------------------------------
<?php

include (\"sendcard_setup.php\");
include (\"include/\".$dbfile);
include (\"functions.php\");

if ($make_tbl){

$db = new DB_Sendcard;
$sql=\"CREATE TABLE $tbl_name ( image varchar(150), caption text, bgcolor varchar(7), towho varchar(50), to_email varchar(50), fromwho varchar(50), from_email varchar(50), fontcolor varchar(7), fontface varchar(100), message text, music varchar(50), id varchar(10) NOT NULL, notify char(1), emailsent char(1) DEFAULT \'1\', PRIMARY KEY (id))\";
$db->query($sql);

echo(\"Table created!\");

}else{
?>

<form method=\"post\" action=\"<?php echo (\"http://\".$HTTP_HOST.$PHP_SELF); ?>\">
  <p>Now we\'ll create sendcard\'s database table. This only needs to be done once.
    You have chosen to name the main table <i><?php echo ($tbl_name); ?></i>. If you
    want to change this name you need to open the file sendcard_setup.php and
    change the <i>$tbl_name</i> variable. Otherwise all you need to do is to push the
    button below to create the table.</p>
  <p>
    <input type=\"hidden\" name=\"tbl_name\" value=\"<?php echo ($tbl_name); ?>\">
    <br>
    <input type=\"submit\" name=\"make_tbl\" value=\"Let\'s create the table\">
    <br>
  </p>
</form>
<?php
}
?>
Avatar billede basicq Nybegynder
24. marts 2001 - 11:30 #6
Ok så spiller det tabel lavet og virker men du skal aligevel have lidt gotter så her er de så.
Håber jeg kan drage nytte af din viden en anden gagan.
tak for det
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Computerworld tilbyder specialiserede kurser i database-management

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester