Help with syntax error

2002-04-02 Thread jim and lois flaherty

I have a table that recieves raw data form results for an online quiz. The
boss wants to analyse the data , I have it all going to one table for
processing. From that table of Raw Data I pick out what I need. I want to
pick out the test name but I dont want duplicate. I made the column unique
in table phistory ( column testname)

I wanted to write a SQL query for this

select distinct testname from testhistory where testname not in (select
distinct testname in phistory)

but I get a syntax error

Help
Jim


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




What is Returned from a query that a record isnt there

2002-03-21 Thread jim and lois flaherty

Hello , I have a user DB , My perl script on my redhat box scans a drive for
users files , and I want to email, the user to remind them they have a file
that they havent used in months

my problem  when the script comes accrosed a new user I want them to be
added to the DB and send me an email stating so , so I can look up their
email address and provide it. My script querys the DB to see if there is a
record , But I am not getting the right negitive response , to run my if
statement.


My DB :



+-++--+
| owner   | email  | comm |
+-++--+
| t0642k8 | [EMAIL PROTECTED] |  |
+-++--+
1 row in set (0.08 sec)

mysql



my code: please note I trimed it up



#
## ##
##   select distinct owner phase   ##
## ##
#

my $database = shared;
my $data_source = DBI:mysql:$database;
my $username = root;
my $password = elaine;


$dbh = DBI -connect($data_source, $username, $password) or die cant
connect to

 $data_source : my $dbh- errstr\n;

#Select Owner


my $sth= $dbh- prepare(select distinct owner from files);

$sth- execute or die  unable to execute query ;
my $array_ref = $sth-fetchall_arrayref();



open(LOG, /var/www/html/bad/users.txt);


   foreach $row(@$array_ref) {


#
##  dump total bad users to text file
#

 my ($user_n) = @$row;

 print LOG $user_n\n;




#add to users DB





$dbh1 =DBI -connect($data_source, $username, $password) or die cant
connect to

 $data_source : my $dbh- errstr\n;
my $sth1 = $dbh1 - prepare(select owner from users where owner =
'$user_n');
$sth1 - execute or die  unable to execute query ;

# $sth1 - finish;
# $dbh1-disconnect;

my $array_ref = $sth1 - fetchall_arrayref();

  foreach $row(@$array_ref){


my($owner) = @$row;

  if($owner eq ){   ### try NULL next


print Entered bracket \n;

$dbh4 =DBI -connect($data_source, $username, $password) or die cant
connect to

 $data_source : my $dbh- errstr\n;
my $sth2 = $dbh4 - prepare(insert into users(owner)values('$user_n'));
$sth2 - execute or die  unable to execute query ;

}


}


$sth - finished;


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail mysql-unsubscribe-##L=##[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




newbie : Help with C api for mysql

2002-03-18 Thread jim and lois flaherty

I have a Redhat 7.1 box, I want it to connect to its own mysql db . Here is
my code


#include stdio.h;
#include mysql.h;

int main(char **args){

   MYSQL_RES *result;
   MYSQL_ROW row;
   MYSQL *connection, mysql;

   int state;


/*  connect to the mysql db  */

mysql_init(mysql);

connection =
mysql_real_connect(mysql,localhost,root,password,cram,3306,0, 0);


/* check for connection error */






###
it doent compile right , I get




 gcc analysis.c



analysis.c:6:19: warning: extra tokens at end of #include directive
analysis.c:7:19: warning: extra tokens at end of #include directive
/tmp/ccsKk2GG.o: In function `main':
/tmp/ccsKk2GG.o(.text+0x14): undefined reference to `mysql_init'
/tmp/ccsKk2GG.o(.text+0x40): undefined reference to `mysql_real_connect'
collect2: ld returned 1 exit status


What Am I doing Wrong ??


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail mysql-unsubscribe-##L=##[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php