Page 1 of 1

mysql newbie - need assistance

Posted: Mon Apr 14, 2003 12:43 pm
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

Posted: Mon Apr 14, 2003 12:49 pm
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.

Solved!

Posted: Mon Apr 14, 2003 2:10 pm
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:

Re: Solved!

Posted: Tue Apr 15, 2003 4:12 am
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