User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion

Reply
Thread Tools Display Modes
Unread 29 Mar 2006, 13:24   #1
Flying Monkey
mokes
 
Join Date: Dec 2004
Location: uk
Posts: 43
Flying Monkey has a spectacular aura aboutFlying Monkey has a spectacular aura aboutFlying Monkey has a spectacular aura about
Getting MySQL to work

I'm really stuck with this. I've never done anything like this before and now for uni we have to do 2 projects using MySQL and php. I've installed apache, php and MySQL on my computer and the apache and php seem to work but I've no idea how to use the SQL

I copied a php script from a book that is just supposed to connect to the sql and show a message saying that its connected but it just shows a blank page which I take it to mean that its not connecting properly.

Code:
<?php $user = "username";

$conn = mysql_connect( "localhost", $user, "password" );
if($conn){
$msg="Congratulations $user, you connected to MySQL"; }
?>

<html><head><title>Connecting user</title></head>
<body><h3> <?php echo($msg); ?> </h3></body></html>
Also what is the $user supposed to be? Does it have to have a specific value? Any help would be grately apprieciated (in language for someone whos crap with computers to understand ), I've been trying to get it to work all day
__________________
I like colours

Rd 13-16
Veneratio | VGN | Subh
Flying Monkey is offline   Reply With Quote
Unread 29 Mar 2006, 14:07   #2
NEWSBOT3
NEWSBOT
 
Join Date: Dec 2000
Location: The enby cave!
Posts: 4,872
NEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriend
Re: Getting MySQL to work

Quote:
Originally Posted by Flying Monkey
I'm really stuck with this. I've never done anything like this before and now for uni we have to do 2 projects using MySQL and php. I've installed apache, php and MySQL on my computer and the apache and php seem to work but I've no idea how to use the SQL

I copied a php script from a book that is just supposed to connect to the sql and show a message saying that its connected but it just shows a blank page which I take it to mean that its not connecting properly.

Code:
<?php $user = "username";

$conn = mysql_connect( "localhost", $user, "password" );
if($conn){
$msg="Congratulations $user, you connected to MySQL"; }
?>

<html><head><title>Connecting user</title></head>
<body><h3> <?php echo($msg); ?> </h3></body></html>
Also what is the $user supposed to be? Does it have to have a specific value? Any help would be grately apprieciated (in language for someone whos crap with computers to understand ), I've been trying to get it to work all day
$ = variable in php
thats not going to work because your sql password and username are probably not right
try setting it like

Code:
$user="NB3SQL";
$password="NB3letmein";

$conn = mysql_connect( "localhost", $user, "password" );
if($conn){

etc
those are the username and password for the mysql server.
assuming you've got that setup and running.
__________________
[20:27:47] <nodrog-aawy> **** i think my housemate just caught me masturbating
[11:25:32] <idimmu> you are a little piggy arent you
[13:17:00] <KaneED> i'm so closet i'm like narnia
__________________
Pretty parks and funky scrap metal things here
NEWSBOT3 is offline   Reply With Quote
Unread 29 Mar 2006, 15:32   #3
Flying Monkey
mokes
 
Join Date: Dec 2004
Location: uk
Posts: 43
Flying Monkey has a spectacular aura aboutFlying Monkey has a spectacular aura aboutFlying Monkey has a spectacular aura about
Re: Getting MySQL to work

Still doesn't work, its doing all strange things that no one I've talked to knows why. Including saying the MySQL.dll file doesn't exist when I can see it on the screen I think something must have gone wrong with the installation and its gonna be a case of waiting till I'm back at uni and getting someone round to fix it for me
__________________
I like colours

Rd 13-16
Veneratio | VGN | Subh
Flying Monkey is offline   Reply With Quote
Unread 29 Mar 2006, 16:43   #4
Phil^
Insomniac
 
Phil^'s Avatar
 
Join Date: May 2003
Posts: 3,583
Phil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus would
Re: Getting MySQL to work

have you copied libmysql.dll from /path/to/mysql/bin to /path/to/apache or /path/to/php or something?
php_mysql.dll needs to be in there too
__________________
Phil^
Phil^ is offline   Reply With Quote
Unread 1 Apr 2006, 07:53   #5
Doorsdown
Aria's TeddyBear :p
 
Doorsdown's Avatar
 
Join Date: Apr 2002
Location: Rhode Island, USA
Posts: 516
Doorsdown is just really niceDoorsdown is just really niceDoorsdown is just really niceDoorsdown is just really nice
Re: Getting MySQL to work

try doing this

Code:
<? phpinfo(); ?>
and see if php is configured to use mysql

and if it is

Code:
<?

$host = "localhost";
$user = "your_users";
$password = "your_pass";

$conn = mysql_connect($host,$user,$password) or die(mysql_error());
//the rest of the code
?>
__________________
Proud to be have been Fyre, NewDawn, NoS - The Illuminati, [1up]

R3 [Acid] peon
R4 - R7 [Fyre] HC
R7 - R8 [ND] HC
R8 - R13 [NoS] MC
R14 - R16 [1up] MO
R17 Retired
Doorsdown is offline   Reply With Quote
Unread 4 Apr 2006, 15:29   #6
Shyne
Flash in the PAN
 
Join Date: Aug 2005
Location: Birmingham, Romania
Posts: 554
Shyne has much to be proud ofShyne has much to be proud ofShyne has much to be proud ofShyne has much to be proud ofShyne has much to be proud ofShyne has much to be proud ofShyne has much to be proud ofShyne has much to be proud of
Re: Getting MySQL to work

FlyingMonkey, contact me on IRC and I'll fix you up
Shyne is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Forum Jump


All times are GMT +1. The time now is 00:58.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018