Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
mysql_query(): supplied argument is not a valid MySQL-Link resource
Old 05-25-2005, 05:44 AM mysql_query(): supplied argument is not a valid MySQL-Link resource
JimmyV's Avatar
Junior Talker

Posts: 1
Trades: 0
I'm having problems in listing the contents of my database.

Here's the error I get.

Error type: 2
Error description: mysql_query(): supplied argument is not a valid MySQL-Link resource
Error file: /include/dbconnection.php
Error line: 26

First 33 Lines of Code for dbconnection.php

PHP Code:
<?php

function db_connect() 
{
    global 
$host,$user,$pwd,$errstr,$sys_dbname,$port;
    
$strhost=$host;
    if(
$port && $port!=3306)
        
$strhost=$strhost.":".$port;

$conn mysql_connect ("localhost""feud42c_james""vallis") or die ('I cannot connect to the database because: ' mysql_error());
mysql_select_db ("feud42c_mort");
    if (!
$conn|| !mysql_select_db($sys_dbname,$conn)) 
    {
      
trigger_error(mysql_error(), E_USER_ERROR);
    }
    return 
$conn;
}

function 
db_close($conn)
{
  return 
mysql_close($conn);
}

function 
db_query($qstring,$conn
{
    if(!(
$ret=mysql_query($qstring,$conn)))
    {
      
trigger_error(mysql_error(), E_USER_ERROR);
    }
    return 
$ret;
Can anyone help ? Many thanks
JimmyV is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-25-2005, 06:46 AM
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Did you forget to call db_connect() before calling db_query()? Also do you get $conn from db_connect() and pass it correctly to db_query() or just call db_connect() without passing the return?
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 05-25-2005, 10:18 AM
Uche's Avatar
Extreme Talker

Posts: 174
Location: Nigeria/Lagos
Trades: 0
i guess u didn't try to include your DB..

<? php
include ("dbconnect.php"); ---------------> at the very top and again ur query is wrong
__________________
Life is just lyke a school where everybody goes to learn one or two thing. the more u school, the more u learn more about school..The more we live our lifes.. the more we learn more about life.

Please login or register to view this content. Registration is FREE
Uche is offline
Reply With Quote
View Public Profile Visit Uche's homepage!
 
Old 05-25-2005, 10:20 AM Query wrong too
Uche's Avatar
Extreme Talker

Posts: 174
Location: Nigeria/Lagos
Trades: 0
i guess u didn't try to include your DB..

<? php
include ("dbconnection.php"); ---------------> at the very top and again ur query is wrong
__________________
Life is just lyke a school where everybody goes to learn one or two thing. the more u school, the more u learn more about school..The more we live our lifes.. the more we learn more about life.

Please login or register to view this content. Registration is FREE
Uche is offline
Reply With Quote
View Public Profile Visit Uche's homepage!
 
Reply     « Reply to mysql_query(): supplied argument is not a valid MySQL-Link resource
 

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.10333 seconds with 12 queries