LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-04-2003, 11:17 AM   #1
amp2000
Member
 
Registered: Oct 2001
Location: Dublin, Ireland
Distribution: Mandrake 9.0 mostly!
Posts: 303

Rep: Reputation: 30
Question Need help connecting to DB using PHP


Hi
I am unable to connect to any databases using a test PHP script.
I have PHP compiled to work with Mysql so it's not that, I already have about 10 phpNuke sites using MySQL and they all work fine. Also register_globals is turned on in php.ini.

Here is my test script called test.php

~~~~~~~~~Code~~~~~~~~~~~~
<?php
$db = mysql_connect("localhost", "root", "");
{
die ("Didnt Connect");
}
mysql_select_db("Travel_Desk",$db);
{
die ("No connection");
}
$result = mysql_query("SELECT * FROM td_travel",$db);
printf("First Name: %s<br>\n", mysql_result($result,0,"name", ""));
?>
~~~~~End of Code~~~~~~~~~

When I run this from a browser I get the error "Didnt Connect"
I can access the Travel_Desk DB no problem from the command line as root. The DB has one table called td_travel and has 6 fields in it with one of them being called 'name'.

Can someone please give me some idea as to why this isn't working.

Cheers
amp2000
 
Old 03-04-2003, 03:25 PM   #2
amp2000
Member
 
Registered: Oct 2001
Location: Dublin, Ireland
Distribution: Mandrake 9.0 mostly!
Posts: 303

Original Poster
Rep: Reputation: 30
Never mind, I corrupted all my databases, see http://www.linuxquestions.org/questi...threadid=48262
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
php postgres connecting needed help vickr1z Linux - Newbie 2 11-11-2004 03:13 AM
Connecting to Mysql using PHP mahugl Linux - Software 1 01-31-2004 11:20 AM
I need help connecting to mysql with php Pete Dogg Programming 4 06-08-2003 12:52 AM
Connecting to PostgreSQL from PHP Script iaypaa Linux - Software 0 11-02-2002 04:35 AM
connecting mysql by php norbs Linux - Software 1 07-25-2002 01:40 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration