[PHP-DB] Sub queries...

2002-05-24 Thread Trond Erling Hundal

I want to run a query to fetch out a navigation menu on a site I am
working on.
I always have paranoia of destroying the db with ineffecient queries...
Now, as I understand it, sub-queries is a bad thing. They are very slow
in MySQL??

This menu I am making will be displayed on each page the user is looking
at, but the query won't be too big.
Only has to loop through 14 - 16 rows In one table sorted by 6 - 8 rows
in another table.


I have a mainmenu table.
--
ID
Title
Url
css
Number -- order on page 
Alignment
--


And a menu table:
--
ID
Title
Url
Css
Number -- order in the sub-menu.
Mainmenu_id -- linkage to the mainmenu table...
modulid
--

Does this sound like a bad idea? Should I reconsider this, maybe putting
everything in one big happy table?
How do you think this would be on a server client serving 1000 pages a
second?

Any thoughts or urls or whatever would be greatly appreciated. :)


Sincerely yours : Trond E. Hundal

And, btw: I am very sorry for the spam post about the virus... Hehe...
Very sorry indeed.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Sub queries in MySQL

2002-05-24 Thread Trond Erling Hundal

I want to run a query to fetch out a navigation menu on a site I am
working on. I always have paranoia of destroying the db with ineffecient
queries... Now, as I understand it, sub-queries is a bad thing. They are
very slow in MySQL??

This menu I am making will be displayed on each page the user is looking
at, but the query won't be too big. Only has to loop through 14 - 16
rows In one table sorted by 6 - 8 rows in another table.


I have a mainmenu table.
--
ID
Title
Url
css
Number -- order on page 
Alignment
--


And a menu table:
--
ID
Title
Url
Css
Number -- order in the sub-menu.
Mainmenu_id -- linkage to the mainmenu table...
modulid
--

Does this sound like a bad idea? Should I reconsider this, maybe putting
everything in one big happy table? How do you think this would be on a
server client serving 1000 pages a second?

Any thoughts or urls or whatever would be greatly appreciated. :)


Sincerely yours : Trond E. Hundal

And, btw: I am very sorry for the spam post about the virus... Hehe...
Very sorry indeed.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Anti-virus alarm! Sulfbnk var inget virus.

2002-05-16 Thread Trond Erling Hundal

Beklager forrige epost, det viser seg at jeg og en god del andre har
blitt lurt.
Her er en webside som forklarer hvordan du reparerer feilen:

http://netsquirrel.com/msconfig/sulf.html

Filen sulfnbk.exe er en fil som gjenoppretter lange filnavn.


English:

Sorry for the last email, it seems, this file sulfnbk.exe only
restores long filenames.
Here's a link to a page that explains how you can restore the file.
http://netsquirrel.com/msconfig/sulf.html


Med vennlig hilsen
Trond Erling Hundal
Daglig leder
Epost: [EMAIL PROTECTED]
Internett: www.innovationmanagement.no
Telefon: 73 54 03 80
Mobil: 918 41 117 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Puzzeling a little...

2002-04-18 Thread Trond Erling Hundal

Hey.
I am making a system to publish newsarticles, send newsletter and 12 -
14 other functions/modules.
I've been working on it for almost two years, therefore some of the code
is pretty old.

Now, I want to create a set of tables controlling what is beeing
displayed in the site's menu and administrationmenu.
I want to make a module system, having all of the info about urls and
menu-titles in the db instead of in html.

This will cause the db to be queried every time the menu or the
adminmenu is displayed... Which is.. All the time.

My question is, do you think this is essentially a bad thing?
It sure makes administration easier, but I am wondering if this will
affect perfomance (alot)?

I figure the menu will consist of 7 - 8 menu categories, each having
three to four links in it...

Just have to ask u guys, instead of just going at it alone, only to
discover I made a big mistake...

Med vennlig hilsen
Trond Erling Hundal
Daglig leder
Epost: [EMAIL PROTECTED]
Internett: www.innovationmanagement.no
Telefon: 73 54 03 80
Mobil: 918 41 117 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] RE: Mysql and memory issue

2002-04-10 Thread Trond Erling Hundal

Thanks Yasuo Ohgaki and Gurhan Ozen.

My system has 256mb of DDR ram, it's a Intel PIII 900Mhz processor.

Ps -aux | grep mysql shows that about all of the mysql connections uses
about 15mb of memory.
Is that too much?
My query fetches 15 records from two tables.

Here is the query:

SELECT article.tittel as title,
article.dato as date,
article.artikkelid as id,
article.picid as pic,
article.ingress as ing,
article.categori as cat,
article.emne as sub,
article.text as text
 FROM article,
  Article_ref
 WHERE article.dato  NOW()
 AND article.categori = 'nyhetsak'
 AND article.artikkelid = Article_ref.artikkelid
 AND Article_ref.portalid = $content // --- Here's a php var
for which page we are on.
 ORDER BY article.dato DESC
 LIMIT 0,15

I read that where statements can be very inefficient. I feel I have a
lot of where conditions in my query.
The output from the EXPLAIN select In the extra field it says:
where used; Using temporary; Using filesort These are three drawbacks
of my query?



 -Original Message-
 From: Yasuo Ohgaki [mailto:[EMAIL PROTECTED]] 
 Sent: 9. april 2002 17:14
 To: Trond Erling Hundal
 Subject: Re: Mysql and memory issue
 
 
 Trond Erling Hundal wrote:
  Hi, maybe this list isn't the best place to ask for this but...
 
 This is the right place.
 
  I keep getting memory exhausted errors from mysql, on a system 
  running as mail/mysql/apache+php server. (rh7.1) Is it my 
 queries that 
  are inefficient? Is it my modelling-scheme that sucks or 
 could it be 
  that mysql is leaking memory in some way? Would it help to 
 move mysql 
  to a separate machine?
 
 If you do normal query, mysql store whole result in memory!
 You can avoid that. It's in the manual.
 
 --
 Yasuo Ohgaki
 
 
 
 
 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Mysql and memory issue

2002-04-09 Thread Trond Erling Hundal

Hi, maybe this list isn't the best place to ask for this but...
I keep getting memory exhausted errors from mysql, on a system running
as mail/mysql/apache+php server. (rh7.1)
Is it my queries that are inefficient? Is it my modelling-scheme that
sucks or could it be that mysql is leaking memory in some way?
Would it help to move mysql to a separate machine?



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




SV: [PHP-DB] The file '/tmp/phpxw2cJS' must be in the database directory or be readable by all

2002-01-03 Thread Trond Erling Hundal

Looks like an uploaded file...
(Did you make a page that lets you upload the file then run it into your
table?)

Upload the file manually, chmod it to 777 or whatever...
But when you uploaded it, the file has your default read/write permissions
that should work within mysql.
Then you should be able to load it within mysql, only from the new location.
If your chrooted ftp enviroment is /home/hayan/
And you uploaded your file there, then you would do something like:
LOAD DATA LOCAL INFILE /home/hayan/nameoftxtfile.txt INTO TABLE tblname ;

 -Opprinnelig melding-
 Fra: Bogdan Stancescu [mailto:[EMAIL PROTECTED]]
 Sendt: 3. januar 2002 15:40
 Til: [EMAIL PROTECTED]
 Kopi: [EMAIL PROTECTED]
 Emne: Re: [PHP-DB] The file '/tmp/phpxw2cJS' must be in the database
 directory or be readable by all


 Do you have control over where the file to be loaded is located? If so,
 simply create a directory in your user's home, and do what the
 error message
 says :-)

 HTH

 Bogdan

 Hayan Al Mamoun wrote:

  I have this error when I try to execute Load Data Infile .. 
  statement, although temp directory location is set by the
  hosting company, What shall I do???



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




SV: [PHP-DB] Excel to Mysql

2001-11-20 Thread Trond Erling Hundal

I am sure there are several ways of doing this.
What I do, is just save the excel file as a tab-separated txt file...
Then in mysql you call the LOAD DATA local infile /tmp/test.txt into
tabel tablename (columnname1, columnname2) ;

I have made a little upload script for this..
If you want it I can mail it to ya..
msg me off list.

-- trond --

 -Opprinnelig melding-
 Fra: Daniel Berwig [mailto:[EMAIL PROTECTED]]
 Sendt: 20. november 2001 19:25
 Til: [EMAIL PROTECTED]
 Emne: [PHP-DB] Excel to Mysql


 Is it possible to migrate data into a table in MS Excel to MySQL?

 Thanks in advance.

 Daniel Berwig



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




SV: [PHP-DB] Re: php/mysql error

2001-11-20 Thread Trond Erling Hundal


I agree with mr. Torrent here...
you are not logged on to your mysql server when you issue the query!
Check your password/username...

 -Opprinnelig melding-
 Fra: torrentUK [mailto:[EMAIL PROTECTED]]
 Sendt: 20. november 2001 18:35
 Til: [EMAIL PROTECTED]
 Emne: [PHP-DB] Re: php/mysql error


 I think you can get this error when you sql query fails.
 Try copy and pasting the $sql query to the mysql command line and see what
 response you get (it looks as though this would work though unless you
 haven't got a table called test).
 I guess it might be that you are not successfully logging on (although I
 can't recall whether that would then generate this error when you try and
 issue a query or not). You should set up a die error path as
 well to help
 you see if you fail to log in.

 -torrent



 Jon [EMAIL PROTECTED] wrote in message Usenet.ipsiitnr@localhost">news:Usenet.ipsiitnr@localhost...
  please review my script
 
  I have already had it said that the script is fine, please check.  IF
  it is then I have a set up proiblem which I would also like help to
  solve. BUT mysql outside of apache works fine.
 
  I started with an already set up apache so I don't know if mysql was
  installed in right, but the staements before the error seem to work so
  I would think so.
 
  I running my web server under red hat 7.0, I am new to apache/php and
  mysql.
 
  Thanks
 
  
 
  I get an error when it hits the line
 
  while ($row = mysql_fetch_row($rs)) {}
 
  I know it won't do anything, just checking each command.
 
  For a moment I thought this means that the mysql wan't compiled in but -
  then how comes the other mysql_ statements don't error.
 
  anyway the error I get is this
  Supplied argument is not a valid MySQL result resource ...
 
  Now I am a C++ programmer so I am estimating here, it sounds like $row -
  is wrong, do I need to set this up as an array (I believe that is what -
  it is supposed to be)
 
  The $rs is right I am pretty sure and the command should do what I want-
  it to do.
 
 
 
 
 



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




SV: [PHP-DB] COPY files = Warning permission denyed

2001-11-09 Thread Trond Erling Hundal

This is a problem in your server.
Not apache, but the OS itself...

Linux gives user access based on certain values...
php normally runs as the user nobody, so what you have to do is to make
sure
user nobody has the right to read/write in your temp folder (defined in
php.ini)
Or else...


 -Opprinnelig melding-
 Fra: Ivo [mailto:[EMAIL PROTECTED]]
 Sendt: 9. november 2001 17:53
 Til: [EMAIL PROTECTED]
 Emne: [PHP-DB] COPY files = Warning permission denyed


 When I try to copy some files from my local PC to the server
 there  appears
 a message 
 Warning: Unable to create '/xxx.gif': Permission denied in /xxx.php3 on
 line xx

 Where should I search the problem. In the apache server, php or linux.



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




SV: RE: [PHP-DB] sending bulk emails

2001-11-02 Thread Trond Erling Hundal

I say. Help those who want to be helped. Or else, don't bother.
And if they complain, format their harddrive.
eh...

Come on guys.. don't you remember the first time you made a
spam-script/newsletter-script??
...the feeling you felt when all those mail streamed out of the server...
it IS special.
Don't ruin this poor guy's experience.

 -Opprinnelig melding-
 Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]Pa vegne av Russ
 Michell
 Sendt: 2. november 2001 14:34
 Til: Rick Emery
 Kopi: PHP DB list
 Emne: Re: RE: [PHP-DB] sending bulk emails


 Hmmm this is true - but as someone once wrote on this list:

 If someone want's to build a car with 4 reverse gears, we can
 tell them it's not a very good idea,
 but we can also show them how to do it.

 Granted though - spam is a little different than cars!
 Cheers.

 Russ
 On Fri, 2 Nov 2001 07:26:15 -0600  Rick Emery [EMAIL PROTECTED] wrote:

  Opswe've just armed a potential spammer...
 
  -Original Message-
  From: Russ Michell [mailto:[EMAIL PROTECTED]]
  Sent: Friday, November 02, 2001 6:20 AM
  To: Cami
  Cc: PHP DB list
  Subject: Re: [PHP-DB] sending bulk emails
 
 
   Does anybody know how to send bulk emails using php?
  Don't do it!!
 
  But of you must - I guess you could build an array containing email
  addresses, names, etc - taken
  from form input or a database or whatever and then loop the
 arrays mailing
  people...
 
  $mail = mail(;
  for($i=0; $i$email_array_name;$i++( {
  $mail .= $values,;
  }
  $mail .= \$subject\,\$body\,\From: $from\);;
 
  Something like that anyway (that's just off the top of my head)
  Regards.
 
  Russ
 
  On Fri, 2 Nov 2001 11:26:22 - Cami [EMAIL PROTECTED] wrote:
 
   Hi guys,
   Does anybody know how to send bulk emails using php?
   Thanks,
   Cami
  
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
  
 
  #---#
 
Believe nothing - consider everything
 
Russ Michell
Anglia Polytechnic University Webteam
Room 1C 'The Eastings' East Road, Cambridge
 
e: [EMAIL PROTECTED]
w: www.apu.ac.uk/webteam
 
www.theruss.com
 
  #---#
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 

 #---#

   Believe nothing - consider everything

   Russ Michell
   Anglia Polytechnic University Webteam
   Room 1C 'The Eastings' East Road, Cambridge

   e: [EMAIL PROTECTED]
   w: www.apu.ac.uk/webteam

   www.theruss.com

 #---#


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




SV: [PHP-DB] sending bulk emails

2001-11-02 Thread Trond Erling Hundal

Come on ppl!
You can't seriously say that we have become evil creatures luring idees on
the list..?
come on man!

 -Opprinnelig melding-
 Fra: Rick Emery [mailto:[EMAIL PROTECTED]]
 Sendt: 2. november 2001 17:05
 Til: PHP DB list
 Emne: RE: [PHP-DB] sending bulk emails


 my comment was humor.  we've already explored and killed this thread.

 -Original Message-
 From: Robert Klinkenberg [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 02, 2001 9:44 AM
 To: 'Rick Emery'; PHP DB list
 Subject: RE: [PHP-DB] sending bulk emails


 Interesting, instead of blocking access to programming tricks because the
 company wants to protect its investments (or the government
 doesn't like us
 using it (think PGP)) we are now not telling people how to make good
 software because somebody might use it to do something we (or some people)
 don't like.

 Robert Klinkenberg

 -Oorspronkelijk bericht-
 Van: Rick Emery [mailto:[EMAIL PROTECTED]]
 Verzonden: Friday, November 02, 2001 2:26 PM
 Aan: PHP DB list
 Onderwerp: RE: [PHP-DB] sending bulk emails


 Opswe've just armed a potential spammer...



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




SV: [PHP-DB] sending bulk emails

2001-11-02 Thread Trond Erling Hundal

Yes, you will get a timeout.
I made a script that wrote a * on the page for each sent mail.
This way your script won't time out, and the sending process looks REALLY
cool.. hehe

Here's a sample snippet:
?
while ($adr = mysql_fetch_array($query_sender)) {
$to = $adr[epost] ;
$postid = $adr[postid] ;

echo *; // Her is the * printed.
flush(); // Flush, to continously update page..



// Sending the mail

$send = mail($to,$subject,$topp\n\n$sak\n\n$bunn,From: Havneavisen
[EMAIL PROTECTED]\nContent-Type: text/plain;
charset=iso-8859-1\nContent-Transfer-Encoding: 8bit\nReply-To: Havneavisen
[EMAIL PROTECTED]\nReturn-Path:
[EMAIL PROTECTED]\nX-Sender:
[EMAIL PROTECTED]\nX-Mailer: PHP\nSender:
[EMAIL PROTECTED]\n) ;


if (!$send) {

   # Legg inn i databasen eller fil! 
   $table = deadmail ;
   $dead_entry = insert into deadmail (id, epost, base) VALUES
(\$postid\,\$to\,\$base_1\) ;
   mysql_query($dead_entry) or die (Could not store the bad mail) ;
   echo Problemer med å sende til $tobr  ;
   continue ;
 }



// Log
   $go_add = INSERT INTO maillogg (epost, dato, type) VALUES (\$to\,
NOW(), \$base_1\) ;
   $add_em = @mysql_query($go_add) ;
   if (!$add_em) {
   echo ERROR could not update:  $to - $go_addbr  ;
   }
} end of while...

?

 -Opprinnelig melding-
 Fra: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]]
 Sendt: 2. november 2001 17:19
 Til: '[EMAIL PROTECTED]'; Cami
 Kopi: PHP DB list
 Emne: RE: [PHP-DB] sending bulk emails


 Interesting that this should come up. The company I work for needs to send
 out an e-mail to 95k of their subscribers. Now, this is the first
 time in 2
 years, so you can imagine that we'll be getting 94k of bounced e-mail
 addresses. So I'm writing a script that will handle sending out
 the e-mails
 and handling incoming bounced e-mail addresses. In any case, I would think
 that my PHP script would time out before sending 95k e-mails. I
 know it has
 timed out at 30 seconds before, but I can't remember if the faulty script
 had an endless loop for 30 seconds or if there was any data
 getting sent or
 received in that time. Anyone know beforehand whether I will get a timeout
 with sending these e-mails, and if so, how to work around it?

 - Jonathan

 -Original Message-
 From: Russ Michell [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 02, 2001 4:20 AM
 To: Cami
 Cc: PHP DB list
 Subject: Re: [PHP-DB] sending bulk emails


  Does anybody know how to send bulk emails using php?
 Don't do it!!

 But of you must - I guess you could build an array containing email
 addresses, names, etc - taken
 from form input or a database or whatever and then loop the arrays mailing
 people...

 $mail = mail(;
 for($i=0; $i$email_array_name;$i++( {
   $mail .= $values,;
   }
 $mail .= \$subject\,\$body\,\From: $from\);;

 Something like that anyway (that's just off the top of my head)
 Regards.

 Russ

 On Fri, 2 Nov 2001 11:26:22 - Cami [EMAIL PROTECTED] wrote:

  Hi guys,
  Does anybody know how to send bulk emails using php?
  Thanks,
  Cami
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 

 #---#

   Believe nothing - consider everything

   Russ Michell
   Anglia Polytechnic University Webteam
   Room 1C 'The Eastings' East Road, Cambridge

   e: [EMAIL PROTECTED]
   w: www.apu.ac.uk/webteam

   www.theruss.com

 #---#


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




SV: [PHP-DB] wildcard in mysql search with php

2001-10-18 Thread Trond Erling Hundal

The % can be empty space or 'n' characthers. The LIKE command in mysql also
make the query very dynamic.
- trond

 -Opprinnelig melding-
 Fra: Dave Watkinson [mailto:[EMAIL PROTECTED]]
 Sendt: 18. oktober 2001 14:50
 Til: [EMAIL PROTECTED]
 Emne: RE: [PHP-DB] wildcard in mysql search with php


 select columnlist from tablename where columnname like
 '%searchword%'


 RTFM!!!



 -Original Message-
 From: Thomas omega Henning [mailto:[EMAIL PROTECTED]]
 Sent: 18 October 2001 14:58
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] wildcard in mysql search with php


 Hello all,

 Is there a way to use wildcards in search in a mySQL db?
 e.g. I have a dbase of over 24000 records and i can only search exact
 matches is there a way to search something like this : *admin* in mySQL?
 Or
 i have to do it by hand in PHP?

 Thanks
 Sir Thomas omega Henning



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] If`s in MySQL.... Having some trouble here...

2001-03-16 Thread Trond Erling Hundal

Hi there...
I want to query two tables in my db. One containing a list of numbers
ranging from 1 - 10200, the other table is storing information that is
relative to some of the numbers:

Eks:
Table1.record1:  number=1

Table2.record1:  number=1 name=John

Now I want to query these to tables to show a table that has one column with
the numbers, and if there is a name stored in the other table for this
number, I want to display this.
(

So.

I have been doodling with an "if" thingy in MySQL, but I am having trouble
getting result I need.

select
table1.number,
IF(table1.number = table2.number AND table2.name = NULL,
'No name registered',
table2.name)
FROM table1,
 table2

LIMIT 0,30


What am I doing wrong here... It only displays the first name stored in the
table...?


- Trond -


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] mysql_fetch_array problem...!

2001-03-05 Thread Trond Erling Hundal

I want to run a query to my db, fetching different fields from three
different tables.
In order to recognise the individual fields I give them names:

select portal.portal as portal, portal.portalid as id... etc etc


How can I refer to one specific row in this query..?
What I mean is, how can i refer to result row number 4...?

If I only selected rows from one table I could do something like this:

$i = mysql_fetch_array($sql) ;

echo "$i[4]" ;




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Setting cookies that are valid for two or more domains

2001-02-21 Thread Trond Erling Hundal

Hey there...
I need to set a cookie with variables that will be valid for two domains
with different names.
In reality these two domains are on the same server, and even in the same
dir

we use: php4, apache, Linux


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Query qizzle quackarooney! :|

2001-02-13 Thread Trond Erling Hundal

Hey there fellow querieres
I summon your power! (eh..)

well.. enough with the nonsense :)

I have a littlebit of problem:

I am displaying 15 different newsarticles on a page.
The articles are displayed in three different tables.

First there`s one article (the main-top-story) that is shown in the top of
the page.
Then there is an ad.
And then. Below this ad, there are two columns, each displaying 7 articles
each.

To avoid running multiple queries I do a $i = 0, and a $i++ before I end the
while statement...
($i increments for each time the while loops)

The articles can be divided into two distinct groups.
smallnews, and news, and this is stored in the article table in a field
named Kategory!

Here is the thingy:
I can`t have any smallnews desplaying their ugly faces in the first four
while loops...
That is: smallnes cannot be shown before 4 "real" newsarticles has been
displayed.

How do I go about this without having to write a huge bunch of if/elses (I`m
not sure if that would even work).

 some notes below to give you an idea of how I am thinking 

while (.) {

if (($i  4)  ($kategory == "smallnews")) {
$i == $i
continue ;
} // Go around another time.

if (($i == 0)  ($kategory == "newsarticle")) {
echo "trtd etc etc..." ;
} // End writing if it is the first article

Just some scribling here

if ($kategory == "smallnews")
continue ;
 }
}




What do YOU think?



-Trond


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Which Virus was it?

2001-01-30 Thread Trond Erling Hundal

Hey there ppl!
What was the name of the virus that was sent to this list???

-Trond?


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] This query makes never gets done... and it keeps a thread open in the processlist for a long time!!! Very annoying!

2001-01-24 Thread Trond Erling Hundal

This query can sometimes draw back the whole database causing some, or all,
data that is extracted from the database to not show.

Can u experts scan through this for me?

I really need some help!
SQL-
--
SELECT DISTINCT $this-artikkeltbl.artikkelid as artikkelid,
$this-artikkeltbl.tittel as tittel,
$this-artikkeltbl.hovedingress as hovedingress,
$this-artikkeltbl.dato as dato
# Selects different parts of newsarticles: id field, date, title, toptext
and main text

FROM $this-artikkeltbl, $this-relasjonstbl
# from two different tables the article table and the relation table

WHERE $this-artikkeltbl.tittel LIKE '%$sqlx%'
OR $this-artikkeltbl.ingress LIKE '%$sqlx%'
OR $this-artikkeltbl.hovedingress LIKE '%$sqlx%'
OR $this-artikkeltbl.brodtekst LIKE '%$sqlx%'
# var $sqlx is the search string varying from page to page.

AND $this-artikkeltbl.artikkelid = $this-relasjonstbl.artikkelid
# Relation to the relation table

AND $this-relasjonstbl.portalid = $portalid
# Only selects articles within a spesific category.

ORDER by artikler.dato DESC LIMIT $x2,$x1
# u know...
SQL-
--

I have divided the website into different portions, and assigned them with
unique id`s ($portalid).
I am trying to search through articles that are only assosciated with that
spescific portalid.

What am I doing wrong?

This is meant to be a simple search utility on the page.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]