Webpage wont connect do Database..

Newbie Spellweaver
Joined
Oct 1, 2006
Messages
5
Reaction score
0
Hi Guys...

i try now 24h to fix the problem... -.- but it wont work, ... show on screen and tell me whats wrong -.-

zEx1337 - Webpage wont connect do Database.. - RaGEZONE Forums


zEx1337 - Webpage wont connect do Database.. - RaGEZONE Forums


i dont know what to do...

can any1 tell me how i can fix that problem ? ...


i use:
Xampp
SQL 2000

... please
 
use sql2005
i cant be bothered to tell you more


BRING BACK THE HELP THREAD THIS HAS BEEN ANSERED B4 MANY TIMES

$server address = "127.0.0.1";
.
 
Upvote 0
Damn. If i install Sql 2005 i get another error when i add the database ... -.-
because in MSSQL '05 you can't use "localhost" anymore :P it have a other name


anyway I don't like '05 xD I miss the query search function :/ Or I just didn't find it yet :P
(example: Players->Open Table->Query->PID: 80)
 
Upvote 0
Firstly it would be helpful to show us ur Index.php

but im presuming that you have a problem with remote inclusions, try summin like.

include("http://www.youpage.com/blah.php";);
Or
include($_SERVER['DOCUMENT_ROOT']."/blah.php");

then the scripts should work
 
Upvote 0
I realised after writing this that they don't use mysql...
Anyway, i hope this is of any help to someone anyway :)





Allright, if you ask me, the "commands" seem to be wrong, ill just post a script i did for my old website and explain a bit.
Ill explain what each part does in detail.




PHP:
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="password"; // Mysql password

mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("users")or die("cannot select DB");

$sql = mysql_query ("INSERT INTO `notices`
					(`info`, `username`)
				Values 	('$notice', 'admin')") or die (mysql_error());



So, ill do it line by line.

PHP:
$host="localhost"; // Host name
This line gives the variable $host the value "localhost" wich, means the same as 127.0.0.1 (the local machine)


Next line(username):
PHP:
$username="root"; // Mysql username
This line is just as the line above, and gives the variable $username the value "root"
This is the username we are going to log into the database with.

Next line(password):
PHP:
$password="password"; // Mysql password
This line gives $password the value "password". We use this to connect to the database aswell.


Now we got that out of the way. Some people use more variables to also set table name etc, but i preffer to set that manually in the query (wich i will cover in a sec).


Then comes this line:
PHP:
mysql_connect("$host", "$username", "$password")or die("cannot connect");
Well, you can hear what it does, it connects to the mysql database with:
$host (wich we set to localhost)
$username (wich we set to root)
$password (wich we set to "password")


Now, you are connected to mysql.

That wasn't too hard was it? But you are not yet ready. You need to select the right database.

You use this line for that:
PHP:
mysql_select_db("users")or die("cannot select DB");
As you can see, i put the database name to "users" wich, is the name of the database i used then.
So it connects to the database Users (examples on that is: kal_auth etc).



Then comes the query part:
PHP:
$sql = mysql_query ("INSERT INTO `notices`
					(`info`, `username`)
				Values 	('$notice', 'admin')") or die (mysql_error());

Allright, i will not explain this, since i do not have time to do so. It prolly has errors too since i haven't used it for ages, aswell as it is not protected by real escape string, or any other injection protection so ill just leave it there, thats where the Query go. If you want me to explain how to use one, ill post a link to a other thread i explained this question in, yesterday.


Good luck! And i hope this was not too confusing ^^

Flamers that think im a moron and don't know shit about anything, go to hell since i don't care, just try to help ppl :)

Best Wishes// Justei
 
Upvote 0
<?
// Start

// Webseite

$seitentitel = "Kalserver";

// Kalserver

$serveradress = "srvname";
$serverport = "srvport";

// Datenbank

$dbserveradress = "localhost";
$db = "kal_auth";
$db = "kal_db";
$dbserveruser = "sa";
$dbserverpasswort = "password";

// Gallerypic

$piczahlmin = 1; // 0 is deactivating the gallery
$piczahlmax = 15; // 15 is the highest attribut you can use. if you take it higher the gallery will crashes
$pfad = "gallery/";
$filename = "bild (";
$dateiendung = ").jpg";
$h
 
Upvote 0
i used the following page:

WORKING FEATURES AT TIME:

- Join
- Serverstatus (Online/Ofline)
- Castleowner
- Lightbox 2 Gallery
- Top20
- Passwordchange
- AdminCP with: - Usermanager
- Itemeditor
- Charactereditor (only GM rights)

-- DOWNLOAD IT ! -- : http://www.megaupload.com/?d=97D4H56L

zEx1337 - Webpage wont connect do Database.. - RaGEZONE Forums



I AM WORKING AT THIS TIME ON :

- A LOGGIN SESSION
- A MEMBERPANNEL WITH: - Changepassword
- Itemviewer
- Profileviewer
- Online Store
- GUILDADMINISTRATION for LEADER of GUILDS

- MSSQL DATABASE for ALL INFORMATIONS
- CONTENT MANAGEMENT SYSTEM

and much MORE .....

I WILL WE HAPPY ABOUT HELP from SOME DEVOLPERS :

- HTML SCRIPTER
- PHP & MSSQL PROGRAMMER
- MSSQL Specialists
- GRAFIK DESIGNER
- FLASH DESIGNER
- TRANSLATORS

and all poeple they have some experience in programming or scripting



You have to DO:

- EDIT config/config.php with your DATABASE LOGIN DATA
- EDIT config/config.php with your adminpassword


HOW TO:

1. ---------------------------- SITES -----------------------------------
1.1 ------------------------- ADD SITES ---------------------------------

To add a new Site you have to add a new Line in Index.php
where you can find the other Links. Add a new line like :
<li><a href="index.php?seite=nameofnewsite">→ HOME</a></li> this.
Then you have to create a new file in the directory sites.
The filename have to be like the seite=nameofwebseite ^^ in the link.
Also for example:

If you want to create a new Site in your Sidebar:

1. Create a file in the sites directory: filename.txt (sites/filename.txt)
2. Open the filename.txt and edit with Syntax: $ueberschrift='yourheaderinhtml'; $text='yourtextinhtml';
3. Go into the Index PHP and look for:

<li><a href="index.php?seite=home#">→ HOME</a></li>
<li><a href="index.php?seite=ranking&function=ranking#">→ RANKING</a></li>
<li><a href="index.php?seite=download#">→ DOWNLOAD</a></li>
<li><a href="index.php?seite=join&function=join#">→ JOIN</a></li>
<li><a href="index.php?seite=changepw&function=changepw#">→ PWC</a></li>
<li><a href="index.php?seite=gallery&function=gallery#">→ GALLERY</a></li>

4. Add a new Line with the same Syntax: <li><a href="index.php?seite=filename">→ The Name of the Site you want Show</a></li>

1.2 ------------------------- Modify SITES ------------------------------

To modify sites like News or Home go into the sites directory and change
the text. the variable for the header is $ueberschrift=''; and the
variable to safe the text is $text='';
For Example:

If you want to change the News text:

1. Go into sites directory and open the news.txt
2. Change the text behind the characters $text = " and before ";
3. You must be carefully because if the Syntax of the variable is like: $text=""; you have to use this character: ' for html tags else if the syntax is like $text=''; you have to use " in html tags
4. Safe the File and finished

!IMPORTANT! :

1. Look for the characters behind the "=" - character. - If it is ' use " in Html Tags else if is it " use '

For example :

$text="<a href='link'></a>";

or

$text='<a href="link"></a>';

2. $ueberschrift is for the headertext
3. $text is for the text in the site

2. ------------------------- Change downloads ------------------------------

To change downloads open the follow file: sites/downloads.txt
Use following Syntax for a new Line: <tr><td></td><td></td><td></td></tr>

For Example:

If you want to add a new Link:

1. Open the file sites/downloads.txt
2. Look for the <!-- Downloadlinks --> XXXXX <!-- Downloadlinks -->
3. Add between the <!-- Downloadlinks --><!-- Downloadlinks --> following line: <tr><td>Name of the LINK</td><td> Size of the Link </td><td><a href="LINK TO FILE">Mirror 1 <img src="style/DL.gif" width="10" height="10"></a></td></tr>

To delete or change Lines is the same way, if youre a lil bit intellegent you will understand

3. ------------------------- Add Functions ----------------------------------

If you want to Add functions you have to be a devolper also you know what
you have to do. so i havent to write a tutorial for this. Only to things to
say:

Look for scripts/functions.php and write all scripts there

also $function = $_GET["function"];

all scripts are in a "else if ($function == "nameoffunction")" routine safed and they will all be run,

if you tell them with the post function
 
Upvote 0
<?
// Start

// Webseite

$seitentitel = "Kalserver";

// Kalserver

$serveradress = "srvname";
$serverport = "srvport";

// Datenbank

$dbserveradress = "localhost";
$db = "kal_auth";
$db = "kal_db";
$dbserveruser = "sa";
$dbserverpasswort = "password";

// Gallerypic

$piczahlmin = 1; // 0 is deactivating the gallery
$piczahlmax = 15; // 15 is the highest attribut you can use. if you take it higher the gallery will crashes
$pfad = "gallery/";
$filename = "bild (";
$dateiendung = ").jpg";
$h
 
Upvote 0
Damn. If i install Sql 2005 i get another error when i add the database ... -.-
because you need to rename the files you restore
to kal_auth.bak and kal_db.bak for 2005 to reconize them



ansered befor plenty of times

install 2005 and name the instance
then when setting up odbc instead of putting (local)
you put
YOURPCNAME/YOURSQLINSTANCENAME
or
YOURPCNAME\YOURSQLINSTANCENAME

cant be bothered to check



.
 
Upvote 0
Back