Jump to content

sql advice.


xyn

Recommended Posts

I'f you're trying to create an array then NO because $emaillz will only contain the last record selected from the table, you would need this

[code]include "db.php";
$zql = mysql_query("SELECT mem_mail FROM accounts WHERE id='$act'");
while( $data = mysql_fetch_array($zql)){
$emaillz[] = $data['mem_mail'];
}[/code]

Then to echo out all the record further down the page you would need to use somthing like this..

[code]foreach ($emaillz as $email) {
echo('Email Address: '.$email);
}[/code]

If there is only 1 record to be returned then might as well just use

[code]$zql = mysql_query("SELECT mem_mail FROM accounts WHERE id='$act'");
$data = mysql_fetch_array($zql);
$emaillz = $data['mem_mail'];

As you don't need to loop thru the data as only 1 record will ever be returned.

[/code]
Regards
Liam
Link to comment
https://forums.phpfreaks.com/topic/14574-sql-advice/#findComment-57857
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.