Jump to content

[SOLVED] Pulling Info


SkyRanger

Recommended Posts

I am having a problem pulling info from mysql.

 

Not sure if I need multiple select statements or if I can use 1

 

Here is what I I am trying to do.

 

select * from table where fname='fname' order by 'time_sent' desc <-- This works

what I am trying to do is:
select * from table where fname='fname'  and opened='y' and opened='n' and opened='r' order by 'time_sent' desc <-- This doesn't work 

the entries in opened are

y, n, r, a

 

I only want it to pull y,n,r and list them where fname='$fname' only

 

I tried googling for a solution with very little luck.  Anybody have any ideas how I can accomplish this?

Link to comment
https://forums.phpfreaks.com/topic/48494-solved-pulling-info/
Share on other sites

could you do something like..

 

$sql = "select * from table where fname='fname'  and opened= 'y' order by 'time_sent' desc";
$sql .= "select * from table where fname='fname'  and opened= 'n' order by 'time_sent' desc";
$sql .= "select * from table where fname='fname'  and opened= 'r' order by 'time_sent' desc";

$result = mysql_query($sql);

 

not sure if it would work

Link to comment
https://forums.phpfreaks.com/topic/48494-solved-pulling-info/#findComment-237191
Share on other sites

ok,

do

select * from table where fname='$fname' order by 'time_sent' desc

 

and do

 

print_r($row);

 

i assume the data your pulling is $row['fname']; is its not $row then use what you use, the part i need is the array thats printed

 

~or~

 

can you post the code that does the displaying..

 

Link to comment
https://forums.phpfreaks.com/topic/48494-solved-pulling-info/#findComment-237229
Share on other sites

Here you go:

 

Array ( [0] => 17 [pmid] => 17 [1] => Dave Ellis [to_name] => Dave Ellis [2] => frname [from_name] => frname [3] => 24 Apr 07 12:20 [time_sent] => 24 Apr 07 12:20 [4] => I still ... [subject] => I still ... [5] => ... msg. [message] => ... msg. [6] => y [opened] => y [7] => [time_opened] => ) Array ( [0] => 16 [pmid] => 16 [1] => Dave Ellis [to_name] => Dave Ellis [2] => frname [from_name] => frname [3] => 24 Apr 07 11:10 [time_sent] => 24 Apr 07 11:10 [4] => subj [subject] => subj [5] => msg.  [message] => msg.  [6] => r [opened] => r [7] => [time_opened] => ) Array ( [0] => 1 [pmid] => 1 [1] => Dave Ellis [to_name] => Dave Ellis [2] => SkyRanger [from_name] => SkyRanger [3] => 23 Apr 07 18:03 [time_sent] => 23 Apr 07 18:03 [4] => This is a test PM [subject] => This is a test PM [5] => msg [message] => msg [6] => a [opened] => a [7] => [time_opened] => ) Array ( [0] => 7 [pmid] => 7 [1] => toname [to_name] => toname [2] => frname [from_name] => frname [3] => 23 Apr 07 17:26 [time_sent] => 23 Apr 07 17:26 [4] => subj [subject] => subj [5] => msg. [message] => msg. [6] => y [opened] => y [7] => [time_opened] => ) Array ( [0] => 5 [pmid] => 5 [1] => toname [to_name] => toname [2] => frname [from_name] => frname [3] => 23 Apr 07 17:24 [time_sent] => 23 Apr 07 17:24 [4] => subj [subject] => subj [5] => msg.  [message] => msg.  [6] => r [opened] => r [7] => [time_opened] => ) Array ( [0] => 3 [pmid] => 3 [1] => toname [to_name] => toname [2] => frname [from_name] => frname [3] => 23 Apr 07 17:18 [time_sent] => 23 Apr 07 17:18 [4] => Testing [subject] => Testing [5] => msg [message] => msg [6] => r [opened] => r [7] => [time_opened] => )

 

Output modified due to user/clients privacy issues...lol

Link to comment
https://forums.phpfreaks.com/topic/48494-solved-pulling-info/#findComment-237245
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.