MySQL Forums
Forum List  »  PHP

Re: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mywebsite/public_html/index.php on line 7
Posted by: Scott Mosman
Date: May 06, 2011 11:26AM

Barry, I FIXED IT! I hope this helps someone else.

Old way...
<?php
// Connect to database
include_once "scripts/connect_to_mysql.php";
// Gather all the members for temporary display
$sql = mysql_query("SELECT 'id', 'firstname', 'lastname' FROM myMembers WHERE email_activated='1' ORDER BY id DESC LIMIT 6");

$MemberDisplayList = '<table border="0" align="center" cellpadding="6">
<tr> ';

while($row = mysql_fetch_array($sql)){

New...

<?php
// Connect to database
include_once "scripts/connect_to_mysql.php";
// Gather all the members for temporary display
$sql = mysql_query("SELECT 'id', 'firstname', 'lastname' FROM myMembers WHERE email='1' ORDER BY id DESC LIMIT 6");

$MemberDisplayList = '<table border="0" align="center" cellpadding="6">
<tr> ';

while($row = mysql_fetch_array($sql)){

I had email_activated. I took out _activated because myMembers table says email.

Thanks, Scott

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.