Hey everyone,

I am trying to develop an addon for my admin area to send a text to my clients.

I am trying to populate a select menu that will list clients that have added their mobile phones.

I am using the following tables.

  • tblclients
  • tblcustomfields
  • tblcustomfieldsvalues

At the moment I am just trying to display the clients who have added their numbers but I get a blank page when using the following code.

$clientSQL = "SELECT * FROM `tblclients`, `tblcustomfields`, ` tblcustomfieldsvalues` WHERE `tblcustomfields.id` = '1' AND `tblcustomfieldsvalues.fieldid` = '1' AND `tblcustomfieldsvalues.value` != ''";
		$clientQ = mysql_query( $clientSQL );
		while( $client = mysql_fetch_assoc( $clientQ ) ) {
			//get mobile phone
			echo $client['firstname'] . ' ' . $client['lastname'] . ' - ' . $client['value'] . '<br />';	

In the table "tblcustomfields" the phone number field ID is 1.

If anyone could help me I would be very grateful.

Thanks in advance

6 Years
Discussion Span
Last Post by diafol
$clientSQL = "SELECT * FROM `tblclients`, `tblcustomfields` AS cf, ` tblcustomfieldsvalues` AS cfv WHERE cf.`id` = 1 AND cfv.`fieldid` = 1 AND cfv.`value` != ''";



Paste the sql into phpmyadmin and see what it says. However, I'd recommend that you use explicit INNER JOIN syntax.

Edited by diafol: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.