Forum Moderators: coopster

Message Too Old, No Replies

not a valid MySQL-Link resource?

         

emptiness

2:56 pm on Jun 30, 2004 (gmt 0)

10+ Year Member



I finished the webpages and they work fine in my PC (with IIS and MySQL). But when I uploaded them into the hosting server I got this message with some PHP pages:

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/getbalan/public_html/suscribete.php on line 66

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/getbalan/public_html/suscribete.php on line 68

I have no idea what it could be.

This is the code of those lines (from 66 to 70)

[php]
mysql_select_db($database_MySQL, $MySQL);
$query_Sexos = "SELECT * FROM wlu_sexo";
$Sexos = mysql_query($query_Sexos, $MySQL) or die(mysql_error());
$row_Sexos = mysql_fetch_assoc($Sexos);
$totalRows_Sexos = mysql_num_rows($Sexos);
?>
[/php]

Just a few lines above, in lines 51-52, there's a very similar code and it doesn't seem to have any problem:

[php]
mysql_select_db($database_MySQL, $MySQL);
$Result1 = mysql_query($insertSQL, $MySQL) or die(mysql_error());
?>
[/php]

Please help me out with this one. I'm really clueless.

Birdman

3:29 pm on Jun 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello,

Welcome to WebmasterWorld!

I think you're missing one important function in your script:

mysql_connect [php.net]();

That goes before mysql_select_db().

Birdman

emptiness

3:42 pm on Jun 30, 2004 (gmt 0)

10+ Year Member



I am supposed to put the database/user/password with that function. Sorry, but I'm very new to PHP and MySQL. I'll read and try that function and let you know if it worked.

But when I generate the code with dreamweaver it doesn't use that function:

<php>
<?php require_once('Connections/MySQL.php');?>
<?php
mysql_select_db($database_MySQL, $MySQL);
$query_Recordset1 = "SELECT * FROM wlu_nuprograma";
$Recordset1 = mysql_query($query_Recordset1, $MySQL) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
</php>

What really confuses me is that all the pages work fine in my server, but when I upload them all the problems come in to view.

emptiness

3:44 pm on Jun 30, 2004 (gmt 0)

10+ Year Member



almost forget....

Thank you

Birdman

3:52 pm on Jun 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok, nevermind my previous answer. Now that you posted the whole thing I see that the mysql_connect is already there. It's in another file, which is being included into the script.

<?php require_once('Connections/MySQL.php');?>

What you need to do is, 1) Make sure the above file is uploaded 2) Make sure the path to the file is correct 3) Make sure the login info is correct in the file.

The safest way is to use this:

require_once($_SERVER["DOCUMENT_ROOT"] . "/Connections/MySQL.php");

That assumes there is a /Connections/ folder sitting in the public root folder.

emptiness

4:24 pm on Jun 30, 2004 (gmt 0)

10+ Year Member



yesss.... trying to apply your previous answer I created a new file and finally ended editing that other file: MySQL.php.

I screw some data there when renaming the file. Everithing is working fine now.

Thanks A LOT for been there my friend.