Jump to content

[SOLVED] DB Array


Canman2005

Recommended Posts

Hi all

 

Wondering if anyone can help.

 

I have the following array code

 

  $name_array =  array ('steve', 'jon', 'george', 'admin');

  if (in_array($input, $name_array)) {
    return true;
  }
  else {
    return false;
  }

 

and I want to run a SQL QUERY for the array data using something like

 

$sql = "SELECT * FROM `members`";
$show = @mysql_query($sql,$connection) or die(mysql_error());
while ($row = mysql_fetch_array($show))
{
}

 

which would replace the

 

'steve', 'jon', 'george', 'admin'

 

part of the array with data from the SQL database.

 

Can anyone help? Been on this for 6 hours and im not managing to crack it.

 

Any help would be ace

 

Thanks in advance

 

Dave

Link to comment
Share on other sites

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.