Re: [PHP-DB] help with preg_replace for http://

2002-03-29 Thread Bill Morrow

On Fri, Mar 29, 2002 at 11:46:24AM -0800, Kevin Won wrote:
> I'm writing a knowledgebase (basically a content management system) application 
>where people are adding text via web forms then viewing this data on the web. 
>standard bread-and-butter kind of stuff.
> 
> of course people want to put in their hyperlinks in the page w/o having to do any 
>sort of html coding. I'm having a hard time getting my regular expression to work 
>correctly to match for anything that starts with http:// and ends with a space 
>character, extracting this as a $string, then formatting the hyperlink as href="$string">$string on the knowledgebase viewing scripts.
> 
> The one I've written matches and replaces only the first instance of http://  in the 
>string. (which solves problems as long as there is only one hyperlink in the page ;-)
> 

Have you considered just using a wiki?

E.g. www.usemod.com, or http://phpwiki.sourceforge.net/


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




Re: [PHP-DB] delete statement question

2002-03-25 Thread Bill Morrow

On Mon, Mar 25, 2002 at 02:42:08PM -0800, Andr?s Felipe Hern?ndez wrote:
> Hi, I hope you can help me with this:
> 
> I have these 3 tables.
> 
> exam (
> exam_id
> )
> 
> questions (
> question_id
> exam_id
> )
> 
> answers (
> answer_id
> question_id
> )
> 
> I am wondering if i can delete all the rows for answers linked to a given
> exam using only one delete statement.
> 
> Thanks in advance,
> 
> andres
> 

delete answers 
where question_id in (select question_id from questions where exam_id=X)

I assume there isn't a one-to-one relationship between questions and
answers? If there is, your database is overnormalized.

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




Re: [PHP-DB] Re: Again Select then update

2002-03-24 Thread Bill Morrow

On Sat, Mar 23, 2002 at 11:46:36PM -0800, Jen Downey wrote:
> Hi all again!
> 
> As Bill Morrow stated (in a private e-mail) I needed to use SET name =
> \"$update\""; instead of SET name = $update";
> It has stopped giving the error but it isn't updating the table. Am I doing
> something wrong?
> line 4 shows print("your name is $name");  The user name is printed to the
> browser but it simply will not update the table.
> 
> $query = "SELECT name FROM users WHERE uid={$session["uid"]}";
> $ret = mysql_query($query);
> while(list($name) = mysql_fetch_row($ret))
> print ("your name is $name");
> 
> $update = "$name";
> 
> $query_update["name"] = "UPDATE my_items SET name = $update";
> $result = mysql_query($query_update["name"])or die("Error: ".mysql_error());
> 

Is this your latest code? You still don't have quotes around $update, if so.

Nothing returned in the .mysql_error()?

Can you run the query by hand?

Bill

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




Re: [PHP-DB] Re: Dynamic Drop Down Box

2002-03-06 Thread Bill Morrow

I haven't actually tried this, but if you use frames, could you submit
from the first dropdown and refresh the second if they are in seperate frames?

Not that I'd like to support that code.

On Wed, Mar 06, 2002 at 10:14:59AM -0800, fls wrote:
> I've got a dynamic dropdown on http://www.northjerseydirectories.com
> I generate the js using php and a MySQL database.  The dropdown does what
> you're looking for.  Since the dropdown is client side you either need to
> go with javascript, an applet, or have the person submit a form that loads
> the second box which is pretty clumsy.
> Fred Steinkopf
> 
> On Wed, 6 Mar 2002, Aron Pilhofer wrote:
> 
> > So, if the user selects "mercedes", then the next box is "500Sl, 300Sc" and
> > so forth. If they select ford, then the second box has completely different
> > values?
> >
> > You'll either have to reload the page after the first select, or use
> > javascript or some other kind of client script. I don't think there is a way
> > to do it with PHP, but maybe someone else has an idea to help you. I hope
> > they do, because I need to do the same sort of thing, and I am trying to
> > avoid js at all costs.
> >
> >
> >
> > "Randy Rankin" <[EMAIL PROTECTED]> wrote in message
> > F3BF649E168BD411A1B700010271F38BB4BD20@SBMAIL">news:F3BF649E168BD411A1B700010271F38BB4BD20@SBMAIL...
> > > Does anyone know how I might populate a drop down box based on the users
> > > selection from a previous drop down box? For example, if I have a table
> > > called 'autos' with 2 fields, 'make' and 'model'. I select distinct 'make'
> > > and populate the first drop down box. Based on the user selection, the 2nd
> > > drop down box would be populated with the distinct 'make' for that model
> > > (ie; if the user selects Ford in the first drop down, the 2nd drop down
> > > would be populated with Explorer, Expedition, Ranger, etc.).
> > >
> > > Thanks,
> > >
> > > Randy Rankin
> > >
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 

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




Re: [PHP-DB] Difficult count statement. Need some sql advice

2002-03-02 Thread Bill Morrow

On Sat, Mar 02, 2002 at 05:36:41PM +0100, Andy wrote:
> Hi there,
> 
> I would like to querry my db for following result
> 
> - Count the number of topics listed in the table fo_topics,
> but only the topics where the belonging forum is not in the archive  mode
> ( this is when table fo_forums field archive is 1)
> 
> I tryed following querry but this is for sure wrong:
> 
> SELECT COUNT(t.*) AS c, f.archive, f.forum_id
> FROM fo_topics t, fo_forums f
> WHERE f.archive != 1
> 
> Can this be that difficult?
> 
> Thanx for any help
> 
> Andy

You need to join the two tables together:

select count(t.*) as c, f.archive, f.forum_id
from fo_topics t, fo_forums f
where t.forum_id = f.forum_id and f.archive != 1

might work. I assume you have a foreign key in fo_topics linking to fo_forums.

Bill

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




Re: [PHP-DB] Question about advanced SQL

2002-02-27 Thread Bill Morrow

select * from tblCd
where cdId not in (select distinct cdId from tblOrders);

On Thu, Feb 28, 2002 at 12:37:49PM +1000, Adam Royle wrote:
> Hi.
> 
> I need some guidance for writing an effective query (instead of processing
> through PHP).
> 
> I lets says I have two tables, tblCDs and tblOrders.
> 
> tblCD
> 
> cdID  |  cdTitle  |  cdArtist
> --
> 1 |  Great Hits   |  Bon Jovi
> 2 |  Forever Young|  The Youngsters
> 3 |  Now and Then |  Beach Boys
> 4 |  Cheesy Name  |  Two Tones
> 
> 
> tblOrders
> 
> orderID   |  cdID_FK  |  ordererID
> --
> 1 |  1|  442
> 2 |  3|  233
> 3 |  1|  233
> 
> 
> Now, I want to select all the records from tblCD where the cdID does not
> appear in any row of tblOrders.cdID_FK
> 
> This means that it selects all the CDs that have not been ordered.
> 
> The results of the query should be
> 
> 
> cdID  |  cdTitle  |  cdArtist
> --
> 2 |  Forever Young|  The Youngsters
> 4 |  Cheesy Name  |  Two Tones
> 
> 
> I know how I can do this in PHP (two queries - put all cdID_FK in an array,
> and on displaying the other query, check if it is in the array, and display
> if not) but there HAS to be an easier way.
> 
> Adam.
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 

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




Re: [PHP-DB] sending bulk emails

2001-11-02 Thread Bill Morrow

You should sort the addressees by domain first too, to give the MTA
a chance to opimize your spam delivery.

On Fri, Nov 02, 2001 at 04:44:06PM +, Shane Wright wrote:
> Hi
> 
> I find that the best way to do it is with a script having a long/unlimited 
> timeout, but limiting it to only a few hundred mails per execution in the SQL 
> '... LIMIT 500'.
> 
> IMO better this way than a short-timeout script - sending one email can 
> sometimes take ages (long DNS lookup, slow connection to the host, etc...)
> 
> Shane
> 
> 
> On Friday 02 November 2001 4:18 pm, Jonathan Hilgeman wrote:
> > 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
> >
> > #---#
> 
> -- 
> Shane
> 
> -- 
> 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]




Re: [PHP-DB] MySQL: Alphabetizing title results in library format

2001-11-01 Thread Bill Morrow

On Thu, Nov 01, 2001 at 04:43:00AM -0500, Ian Evans wrote:
> Cami wrote:
> 
> > Try this:
> > mysql> select *,(case when title like '%The%' then substring (title, 5, 255)
> > when title like '%A%' then substring (title, 3, 255) when title like '%An%'
> > then substring (title, 4, 255) else title end) as sort_col from titles order
> > by sort_col;
> 
> Argh, that still produces the same syntax error. Our hosting company is 
> using MySQL 3.22.32 if that's any help.
> 
> -- 
> Ian Evans
> Digital Hit Entertainment - News and Information
> http://www.digitalhit.com
> 

I would do this in the php layer.

-- 
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]