TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 08-29-2010, 10:00 AM   #1 (permalink)
The Wanderer
 
shoaibmunir's Avatar
 
Join Date: Jun 2009
Location: Dubai, UAE
Posts: 23
Thanks: 2
shoaibmunir is on a distinguished road
Help PHP Get data from multi table

i'm working on ERP Solutions and want to inform if any one have unread notification and i want send one email daily if anyone not read notification. one email in one day each member who have unread notifications.

My Query

"select n.*, i.* from ew_notifications n, ew_inform i where n.authorid<>i.authorid and i.senddate<>'$todatdate' "


if($resords>0){

insert into ew_inform (authorid, senddate) value('{$resords['authorid']}', '$todatdate')

}


error this my query showing again tha member that exiting in ew_inform table i just want that pplz come who dont exsit in ew_inform table in current date
__________________
==========================================
http://paysha.com/Pakistan/Sialkot/Profiles/100171.html
==========================================
Send a message via MSN to shoaibmunir
shoaibmunir is offline  
Reply With Quote
Old 09-13-2010, 09:12 PM   #2 (permalink)
The Contributor
 
Join Date: Feb 2009
Posts: 65
Thanks: 0
Krik is on a distinguished road
Default

I can't make heads or tales of how the tables you provided are constructed to give you an accurate query, but if you are looking to query 2 tables you usually use a LEFT JOIN.

PHP Code:
$sql "
    SELECT *
    FROM ew_inform
    LEFT JOIN ew_notifications on ew_notifications.authorid = ew_inform.authorid
    WHERE ew_inform.senddate != '" 
$todatdate "'
"

You have to join them on a common identifier.

Now I get the sense that you may be checking if one table doesn't have a particular "authorid" with today's date. If that is the case I believe 2 query will be needed.
Krik is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Injection and mysql_real_escape_string Durux General 61 01-29-2013 12:20 PM
feedback on my class please frostyboy33 Advanced PHP Programming 7 10-22-2012 09:12 AM
Databse structure Village Idiot TalkPHP Developer Team 3 01-16-2009 10:31 PM
This project has begun! Village Idiot TalkPHP Developer Team 40 01-01-2009 04:29 AM
Tips: PHP security Village Idiot Tips & Tricks 22 11-23-2007 11:17 PM


All times are GMT. The time now is 05:59 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design