Member Avatar

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 `` = '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

Recommended Answers

All 3 Replies

Member Avatar
$clientSQL = "SELECT * FROM `tblclients`, `tblcustomfields` AS cf, ` tblcustomfieldsvalues` AS cfv WHERE cf.`id` = 1 AND cfv.`fieldid` = 1 AND cfv.`value` != ''";


Member Avatar

Thanks but it doesn't work :(

Member Avatar

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.