Jump to content

Only pull certain data from sql.


marketboy

Recommended Posts

I need to be able to pull only certain fields from my database.  Instead of pulling all data from field "x" I need to pull or exclude data to certain items. 

 

$sqlDealers="SELECT id, CONCAT(first_name,' ',last_name) AS name FROM ".$db_prefix."dealers ORDER BY name";

$rsDealers=@mysql_query($sqlDealers) or trigger_error('Error on executing '.$sqlDealers, E_USER_ERROR);

 

 

It's selecting the id field, but I need to either make it show only some of the items, or exclude others.  Any input would be apreciated!

Link to comment
Share on other sites

Ok, I've tried a variation of ways, but keep getting a fatal error:

 

Fatal error: Error on executing SELECT id, WHERE id='33' CONCAT(first_name,' ',last_name) AS name FROM free_listings_dealers ORDER BY name in /home/content/m/a/r/marketmy1/html/index1-15.php on line 55

 

I changed the code to this:

 

$sqlDealers="SELECT id, WHERE id='33' CONCAT(first_name,' ',last_name) AS name FROM ".$db_prefix."dealers ORDER BY name";

$rsDealers=@mysql_query($sqlDealers) or trigger_error('Error on executing '.$sqlDealers, E_USER_ERROR);

 

 

Anything?

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.