mysql newbie - need assistance

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
natty
Forum Newbie
Posts: 2
Joined: Mon Apr 14, 2003 12:43 pm

mysql newbie - need assistance

Post by natty »

Hello everybody. Have an issue that I cannot figure out. I installed mysql yesterday on an NT box, and everything apparently works. I have been able to query tables, add databases, and the like via the command prompt. Also, I have php installed on this NT box.

What I am trying to accomplish is the ability to pull data out of a table and display it on-screen. This is just a simple test. My error I keep receiving is mysql_fetch_array(): supplied argument is not a valid MySQL result resource in 'file location + name'.

Is this because I have not updated my php.ini file for some reason? I didn't think this is the case, sense my version of php (version 4.x.x) comes with the mysql extensions already built-in. Also, I am wondering if I need to setup a system DSN for this database? I come from a SQL Server and Oracle background and that is usually how I setup my database connections for web applications.

One final point is that I do have mysql setup and running as a service.

I am lost. Does anyone have any ideas? Bueller? Bueller?


:D
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

mysql_error() is your friend when it comes to debugging, e.g.

Code: Select all

$dbConn = mysql_connect($dbHost,$dbUser, $dbPass) or die(mysql_error());
mysql_select_db($dbName, $dbConn) or die(mysql_error());

$query = 'SELECT count(*) FROM myTable';
$result = mysql_query($query, $dbConn) or die($query. ': '.mysql_error());
maybe you don't want to show users the complete error output but for debugging it's fine.
natty
Forum Newbie
Posts: 2
Joined: Mon Apr 14, 2003 12:43 pm

Solved!

Post by natty »

Thanks, but it was something I didn't do yet setting up the system.

I needed to install myODBC drivers which I didn't.




Thanks anyways...... :idea:
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Re: Solved!

Post by twigletmac »

natty wrote:I needed to install myODBC drivers which I didn't.
You shouldn't need to do that - you don't need ODBC drivers to use MySQL with PHP and you don't need DSNs or anything like that.

Mac
Post Reply