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 07-23-2011, 01:25 PM   #1 (permalink)
Shonir IT Solutions
 
shonir's Avatar
 
Join Date: Jul 2011
Location: Sialkot, Pakistan
Posts: 10
Thanks: 0
shonir is on a distinguished road
Help fetching record from multipul tables

im going to fetch records from 4 table in one query just getting error in "not equal" oprater "<>" i dont why its not working i also try to use "!=" but same result. please check and let me know if there is something worng or how to im able to fix problem.

_____________________
select en.*, nt.*, mt.*, nl.*, en.id as en_id, en.title as en_title, mt.id as mt_id from {tbl}expiration_notice en, {tbl}noticetype nt, {tbl}mailtemp mt, {tbl}noticelogs nl where en.type=nt.id and nt.id=mt.parentid and en.expirytime<($shonirvartime+(".(60*60*24)."*mt.d ays)) and nl.noticeid<>en.id and nl.mailid<>mt.id
____________________________

thanks in advance for your consideration
Send a message via MSN to shonir Send a message via Yahoo to shonir Send a message via Skype™ to shonir
shonir is offline  
Reply With Quote
Old 07-23-2011, 02:04 PM   #2 (permalink)
The Wanderer
 
Join Date: May 2010
Posts: 19
Thanks: 1
core1024 is on a distinguished road
Default

I would suggest you try assigning this query into a variable and just echo it inside a <pre> HTML tag. At the last line there is a space between "*mt.d" and "ays", but not sure if it is same in your code. Also I am not sure if "{tbl}" expression is correct but the echo will show the truth.
core1024 is offline  
Reply With Quote
Old 07-25-2011, 01:44 PM   #3 (permalink)
The Acquainted
 
Join Date: Nov 2009
Location: nr Stratford-Upon-Avon
Posts: 137
Thanks: 3
maeltar is on a distinguished road
Default

Can you post the exact error message please, as it usually says "near", and you may be looking at the wrong place..

Also, are the datatypes the same, if not use CAST..

Is
Code:
select en.*, nt.*, mt.*, nl.*
Correct ?

If I understand this correctly where you have "en.id" this is not "field.table" but it is a field name alone.

Is this for MySQL ?
__________________
Thanks... Simon

Sex, Drugs & Linux Rules
Send a message via MSN to maeltar
maeltar is offline  
Reply With Quote
Old 07-29-2011, 05:00 PM   #4 (permalink)
Shonir IT Solutions
 
shonir's Avatar
 
Join Date: Jul 2011
Location: Sialkot, Pakistan
Posts: 10
Thanks: 0
shonir is on a distinguished road
Default

im working a online php software for domain management system.

now below is all information for exactly what i can do

1) table
tbl_expiration_notice

all domains stores in this table with expiration date.

-------fields
id = 5
title = sarking.com
type = 3
expirytime = 1315797147
_________________

2) table

{tbl}noticetype

all domain notification type mean some domains only register with us and some domain have hosting also with us and some domains only hosted

1)hosting
2)domain
3)domain+hosting

-------fields
id = 3
title = domain+hosting
_______________________

3)table
{tbl}mailtemp

all notice type have multi templates like one domain is going expire client will received 3 email.

-------fields
id = 1
parentid = 3
days = 60
subject = domain expire notice
message = your domain will be expire soon
________________________

4)table

{tbl}noticelogs

in this table we will store all sent mail notice so next time we will not repeat email.

-------fields
id = 10
noticeid = 5
mailid = 1
___________________________

my code


$shonirresult = $sm->shonirqueryfnc("select en.*, nt.*, mt.*, nl.*, en.id as en_id, en.title as en_title, mt.id as mt_id from {tbl}expiration_notice en, {tbl}noticetype nt, {tbl}mailtemp mt, {tbl}noticelogs nl where en.type=nt.id and nt.id=mt.parentid and en.expirytime<($shonirvartime+(".(60*60*24)."*mt.d ays)) and (nl.noticeid<>en.id and nl.mailid<>mt.id ) ", 'Get Expiration Notice Result');
$shonirrows = $sm->shonirrowsfnc($shonirresult, 'Get Expiration Notice Rows');
if($shonirrows>0){
$shonirrecords = $sm->shonirrecordsfnc($shonirresult, 'Get Expiration Notice Records');

echo date("m/d/Y", ($shonirvartime)).'<br/>' ;

echo $shonirrecords['en_title'].'<br/>';

$sm->shonirqueryfnc("insert into {tbl}noticelogs (noticeid, mailid, addtime) value({$shonirrecords['en_id']}, {$shonirrecords['mt_id']}, $shonirvartime) ", 'Insert Notice Log Record');

}
Send a message via MSN to shonir Send a message via Yahoo to shonir Send a message via Skype™ to shonir
shonir is offline  
Reply With Quote
Old 07-29-2011, 05:03 PM   #5 (permalink)
Shonir IT Solutions
 
shonir's Avatar
 
Join Date: Jul 2011
Location: Sialkot, Pakistan
Posts: 10
Thanks: 0
shonir is on a distinguished road
Default

problems is function show sarking.com again even i add there function if not exit in noicelog table then show.

(nl.noticeid<>en.id and nl.mailid<>mt.id )

i dont know why its not working
Send a message via MSN to shonir Send a message via Yahoo to shonir Send a message via Skype™ to shonir
shonir 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
Join Tables with Distance Calculation oceanrockn Advanced PHP Programming 1 10-11-2010 04:56 PM
Display mysql tables unitechy Absolute Beginners 3 02-28-2010 07:42 PM
i'm happy to say im going back with designing with some tables sarmenhb XHTML, HTML, CSS 39 04-01-2009 12:40 PM
Tables joining other Tables? Orc MySQL & Databases 6 02-09-2008 09:42 PM
Get data from 4 different tables Ultimatum MySQL & Databases 7 01-16-2008 12:34 PM


All times are GMT. The time now is 03:13 AM.

 
     

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