Jump to content

Recommended Posts

Hello-

 

I get the resource id #6 when executing the following statement.  Here is my code:

 

$sql = "SELECT usr.* FROM ml_users usr INNER JOIN ml_subscriptions mls " .

"ON usr.user_id = mls.user_id WHERE mls.pending = 0";

 

if($_POST['ml_id'] != 'all')

{

$sql .= " AND mls.ml_id = " . $_POST['ml_id'];

}

 

$result = mysql_query($sql) or die('Could not get list of email addresses. ' . mysql_error());

 

$headers = "FROM: "  . ADMIN_EMAIL . "\r\n";

 

while ($row = mysql_fetch_array($result))

{

echo $row['user_email'];

}

 

any suggestions would be appreciated.

 

 

Link to comment
https://forums.phpfreaks.com/topic/70785-solved-resource-id-6-message/
Share on other sites

OK.  Here are my tables:

 

Table - ml_users

user_id int(11) NOT NULL auto_increment,

user_fname varchar(32) NOT NULL,

user_lname varchar(32) NOT NULL,

user_email varchar(255) NOT NULL,

PRIMARY KEY (user_id)

--------------------------------------

Table - ml_subscriptions

ml_id int(11) NOT NULL default '0',

user_id int(11) NOT NULL default '0',

pending tinyint(1) NOT NULL default '1',

PRIMARY KEY (ml_id, user_id)

----------------------------------------

Table - ml_lists

ml_id int(11) NOT NULL auto_increment,

listname varchar(255) NOT NULL,

PRIMARY KEY (ml_id)

 

I changed my query to:

$sql = "SELECT ml_users.user_email FROM ml_users, ml_subscriptions, ml_lists WHERE ml_users.user_id = ml_subscriptions.user_id AND ml_subscriptions.ml_id = ml_lists.ml_id AND ml_subscriptions.pending = 0 AND ml_lists.ml_id = " . $_POST['ml_id'];

 

$result = mysql_query($sql);

$num = mysql_num_rows($result);

 

I echo $num and returns 0.  I know there is 4 records there using the count method.  I should have 4 email addressed returned.  Any suggestion is much appreciated.  TY

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.