Author Topic: Online Database Reading  (Read 766 times)

Purpose:
The main purpose of this topic is to ask for help on how to create a database online, and be able to post and read from it, in-game.

So Far:
Here is what I have done so far:
1. Created a website on 000webhosts.com
2. Setup an account
3. Created my site and domain
4. Setup a MySQL database

Problems:
1. I have no idea what to do, what functions to use, and can't find tutorials anywhere.
2. There is an error in my PHP script
(SlickSilver gave me a ref to use)

What I could use help with:
Everything... I will post the PHP script I am using [The passwords will be starred out, so don't think I literally put those in]

Current Questions:
How do I connect to the site?
How do I read and post from a MySQL database?

My vocab in this may make no sense to those of you who know what to do, since I'm pretending to know what I'm talking about.

Here is my PHP script:
Code: [Select]
<html>
<body>
Welcome to Lilboarder's Page
<?php
$con 
mysql_connect("mysql12.000webhost.com","********_******","*******");
if(!
$con)
die("Oh no! There seems to be a problem! It is: " mysql_error());
$sql "CREATE TABLE PlayerList
(
Name varchar(15)
BL_ID varchar(15)
)"
;
if(
mysql_query($sql,$con))
echo "Table created.";
mysql_select_db("********_******"$con);
$result mysql_query("SELECT * FROM Table_Name ORDER BY BL_ID");
while(
$row mysql_fetch_array($result))
echo $row['Name'] . " " $row['BL_ID'] . "<br \>";
mysql_close($con);
?>

</body>
</html>

Attached is the file I used as a reference (By that I mean copy and paste then fill in details)

Any and all help is very much appreciated. I have been in want of this information for a while now.

I think you'd be better off going to a PHP forum, this doesn't exactly have anything to do with TorqueScript and there are numerous examples on these forums for using an HTTPObject to connect to a php script.

It has been one of my long term goals to be able to do this, I have succeeded, however without much help from others. It would have been a ton easier if somebody were willing to share their knowledge, however not many people *cough* like to do so.

I am working on a tutorial, I will post it when I am done.

For now, I'd be glad to help you out on IRC or something. I don't want to post what I have right now because, again, I am not finished writing it.

But right now, I'm off to eat dinner.

It has been one of my long term goals to be able to do this, I have succeeded, however without much help from others. It would have been a ton easier if somebody were willing to share their knowledge, however not many people *cough* like to do so.

I am working on a tutorial, I will post it when I am done.

For now, I'd be glad to help you out on IRC or something. I don't want to post what I have right now because, again, I am not finished writing it.

But right now, I'm off to eat dinner.
Awesome, that'd be great! Thanks!

If your using IE you can make the page show every error in a webpage.
Internet Options> Advanced > Display Every Script error.
« Last Edit: September 18, 2009, 06:38:16 PM by Plornt »

If your using IE you can make the page show every error in a webpage.
Internet Options> Advanced > Display Every Script error.

That's for javascript.

PHP already tells you where errors are.
Well, atleast on the host I was using.


6 words.
This is not a PHP forum

6 words.
This is not a PHP forum
I don't know PHP, so I just thought you needed a mySQL database, and then do everything through Torquescript.

No, it's easiest to interface with a MySQL database through PHP.