RE: [PHP-DB] E-mail address verification

2002-06-20 Thread Gary . Every




I do it like this:


if (eregi("^[a-z0-9]+([\.%!][_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$",
$email))
{
  list($user, $host) = explode("@", $email);
  if ( !checkdnsrr($host, "MX") )
  return TRUE;
}
else
{
  return FALSE;
}
  }

As you can see, the email can "look" right, but domain isn't valid. So you
can check DNS record for MX domain.
Next step is to connect to mail server and verify user, but usualy that
takes time and it's better to send some kind of auth code to that mail and
if user conforms it, you can use it...

This worked very well. For any of you out there that are looking for a
simple verification with host dns lookup, here it is!!!

For a more comprehensive "class" check here, thanks to Manuel Lemos

http://www.phpclasses.org/emailvalidation




[PHP-DB] MySQL Query Acting Up

2002-06-20 Thread Martin Clifford

Howdy all,

If someone call tell me why this MySQL query is not working, I'd be VERY thankful.  I 
don't see a damn thing wrong with it, but I could have been looking at it too long.

Here is the query:

$query = "UPDATE articles2 SET title=\"$title", brief=\"$brief\", doclink=\"$doclink\" 
WHERE article_id=\"$id\"";
$result = mysql_query($query, $connect)
 or die(mysql_error());

No errors are produced, yet the query doesn't do anything.  Nothing in the row 
changes.  Any help would be appreciated!

Martin


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




[PHP-DB] Re: MySQL Query Acting Up

2002-06-20 Thread user

in your   SET title=\"$title\",   statement you forgot the second 
backslash before the double quote.  I would start there.

Martin Clifford wrote:

> Howdy all,
> 
> If someone call tell me why this MySQL query is not working, I'd be VERY thankful.  
>I don't see a damn thing wrong with it, but I could have been looking at it too long.
> 
> Here is the query:
> 
> $query = "UPDATE articles2 SET title=\"$title", brief=\"$brief\", 
>doclink=\"$doclink\" WHERE article_id=\"$id\"";
> $result = mysql_query($query, $connect)
>  or die(mysql_error());
> 
> No errors are produced, yet the query doesn't do anything.  Nothing in the row 
>changes.  Any help would be appreciated!
> 
> Martin
> 
> 


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




[PHP-DB] Re: MySQL Query Acting Up

2002-06-20 Thread Seth Yount

in your   SET title=\"$title\",   statement you forgot the second 
backslash before the double quote.  I would start there.


Martin Clifford wrote:

> Howdy all,
> 
> If someone call tell me why this MySQL query is not working, I'd be VERY thankful.  
>I don't see a damn thing wrong with it, but I could have been looking at it too long.
> 
> Here is the query:
> 
> $query = "UPDATE articles2 SET title=\"$title", brief=\"$brief\", 
>doclink=\"$doclink\" WHERE article_id=\"$id\"";
> $result = mysql_query($query, $connect)
>  or die(mysql_error());
> 
> No errors are produced, yet the query doesn't do anything.  Nothing in the row 
>changes.  Any help would be appreciated!
> 
> Martin
> 
> 


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




[PHP-DB] Re: MySQL Query Acting Up

2002-06-20 Thread Martin Clifford

Thanks everyone!  Between all the replies I was able to locate the problem and fix it! 
 It wasn't the missing backslash (that was a typo, which sucks).  I wasn't properly 
passing the article_id field to the query, so MySQL had a problem with WHERE id="".

Thanks again! :o)

Martin


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




[PHP-DB] RE: SQL guru needed: Is this query possible ?

2002-06-20 Thread Max Sullivan

Nick,

Thanks for the response.  I think I understand what you are saying, but
I wanted to try and get this to work with out adding another table if
possible.  I've got some help from the list and below is the query that
seems to work without the need for another table.  I guess that brings
up another question, which is more efficient?  Another table to do the
lookup or the left join approach with less tables?  Anyone have any
idea?


  select DISTINCT procedure.name from procedure
  left join procedure_equipment on procedure.id =
procedure_equipment.procedureid
  left join provider_equipment on procedure_equipment.equipid =
provider_equipment.equipid
  where provider_equipment.providerid = '1'



-Original Message-
From: Nick [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, June 20, 2002 8:43 AM
To: Max Sullivan
Subject: Re: SQL guru needed: Is this query possible ?


Hello Max:
I am not sure about what you are trying to get. But looking at your
tables I relaize you might need to add one more table. In Procedure
tabel, id is primary key and it is a foreign key in Procedure_equipment
In Provider table , id is a primary key and it is a foriegn key in
Provider_equipment Now  you need a nother table to connect
Provider_Equipment and Procedure_equipment would have equipment_Id as
primary key and they are exist in those two tables as foriegn key that
way you got all your tables connected, and would be easy to get any
query Hope it helps,

- Original Message -
From: "Max Sullivan" <[EMAIL PROTECTED]>
Newsgroups: php.db
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 18, 2002 11:28 PM
Subject: SQL guru needed: Is this query possible ?


> I've been racking my brain for too long trying to figure out how to do

> this query, I don't think it should be too hard, but I just can't get 
> it right.  I've searched and read about every type of join I could 
> find to figure out a way of doing this, but I think I'm either 
> overlooking something simple or need a different table structure.  I'm

> trying this in MySQL.
>
> I've got the following tables broken down for simplicity.
>
> procedure
> 
> id name
> 
> 1  abc
> 2  def
>
> provider
> 
> id name
> 
> 1  ghi
> 2  jkl
>
>
> procedure_equipment (each procedure may require more than one equipid)
> -
> id procedureid  equipid
> -
> 1  1 1
> 2  1 2
> 3  2 1
>
>
> provider_equipment (each provider may have more than one eqiupid
> -
> id providerid  equipid
> -
> 1  1 1
> 2  1 2
> 3  2 1
>
>
> What I am trying to do is get procedure.name from procedure where 
> provider.id = say 1 and the equipid's from both the 
> procedure_equipment and provider_equipment tables need to match.  
> Basically I want to get the equipid's from provider_equipment where 
> providerid = 1, then get the procedureid from procedure_equipment 
> where the provider_equipment's equipid's equal that of the 
> procedure_equipments equipid's (1 and 2).
>
> The problem I have is the fact that each equipid will be from their 
> own row and I don't know how to equate provider_equipment.equipid 1 
> AND 2 and procedure_equipment.equpiid 1 AND 2.
>
> At first I tried the following query.  Just to quickly realize that I 
> would of course retrieve procedure.name for each equipid In the db. 
> SELECT procedure.name from procedure, procedure_equipment, 
> provider_equipment WHERE provider_equipment.providerid = '1' AND 
> provider_equipment.equipid = procedure_equipment.equipid.
>
> Although I'd like to do this with one query, I've tried to think of a 
> way to do it with a couple of queries and again found short comings 
> doing it that way as well.  I'm beginning to think that the way I have

> the tables set up won't allow me to query the way I want to and that I

> may need to change the table structure.  Although it seems (to me
> anyway) that I should be able to get this query to work if I can 
> figure out the correct way of running the query.
>
> I'm hoping someone can offer some incite on this, if a query like this

> is possible or not.  I don't normally post to the list as I like to 
> try to figure these things out on my own, but I'm really stumped on 
> this one.  I'm hoping there is a way of joining the tables, in a way I

> don't yet know of or understand,  to get the results I want :)
>
> I'd really appreciate any help you can offer.
>
> Thanks in advance
>
> Max Sullivan
>
>




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




[PHP-DB] Can I be an ASP with PHP?

2002-06-20 Thread René Fournier

I have a question to which I'm pretty sure the answer will be "no", but 
I would like to hope I'm wrong...

I've developed a very simple Content Management tool--called 
"Europa"--that even retarded monkeys can use to change/update text in 
their web site. It's web-based, user-authenticated (sessions), and runs 
with PHP4 and MySQL.

Now, Europa is pretty much plug and play, so long as the web site is 
getting its text from a MySQL database. There's a web agency in town 
that is interested in Europa for their clients. Their clients want to be 
able to easily and quickly update certain elements of their site without 
begging some outside webmaster. They would really benefit from Europa.

Problem: I don't want to "sell" Europa, or even install it on someone's 
web server for a one-time fee. I've spent a long time on this little 
tool, and want to continue to improve it. So, I would rather license it 
to companies. They pay a quarterly subscription fee, and get to use 
Europa as it continues to grow and improve.  I'm just a little worried 
about one thing: If I install Europa on their server, and they pay their 
paltry quarterly subscription fee, and then decide they don't need any 
updates, I'm screwed. The value of Europa is much greater than what I 
want to sell subscriptions to it for (not much--I'm not really greedy), 
but I need some kind of control.

The idea: In order for Joe User to update text on his web site, he comes 
to my "Europa" web site, enters his company name, user ID, password, and 
clicks Login, and--voilà--he sees a handsome list of tables containing 
the text content of his site--which is pulled from a MySQL database 
residing on HIS web site's web host.

And this is the trick: Can PHP somehow fetch MySQL data over the 
Internet? Is this possible? If so, is it necessary for me to resort to 
new, unknown technologies like XML or SOAP, or can I do it with PHP 
alone?

Thanks for your comments.

...Rene

---
René Fournier,
[EMAIL PROTECTED]

Toll-free +1.888.886.2754
Tel +1.403.291.3601
Fax +1.403.250.5228
www.smartslitters.com

SmartSlitters International
#33, 1339 - 40th Ave NE
Calgary AB  T2E 8N6
Canada


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




[PHP-DB] Re: Copy table

2002-06-20 Thread Andy

the easiest way would be if you install myphpadmin which is a awesome free
mysql webadmin tool.

You can get it at http://www.hotscripts.com/Detailed/7180.html

Have fun,

Andy

--

http://www.globosapiens.net
Global Travellers Network!



"Rosen" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]...
> Hi,
> I want to copy data from one table to another ( some fields with same
names)
> with some condition.
>
> How can I do this ?
>
> Thanks,
> Rosen
>
>
>



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




[PHP-DB] Re: Resetting auto_incremented values

2002-06-20 Thread Andy

sorry buddy, as far as I know you can't.
The only thing you can do is to set the counter higher but you can't return
to a value under
the given row.

Please correct me if  I am wrong,

Andy

--

http://www.globosapiens.net
Global Travellers Network!



"Martin Clifford" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]...
Hi all,

I have a table that has ARTICLE_ID as the primary key, auto_incremented.  I
have added three rows to this table, yet I want to delete the third.  Here
it is now:

1 - Item 1
2 - Item 2
3 - Item 3

My question is, how do I delete Item 3, without having the next row's index
becoming 4?

1 - Item 1
2 - Item 2
4 - Item 3

Thanks in advance!

Martin




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




[PHP-DB] Re: Resetting auto_incremented values

2002-06-20 Thread Daniel Brunner

Hello!!

ALTER TABLE $table1 AUTO_INCREMENT = 3


Dan




On Thursday, June 20, 2002, at 01:44 PM, [EMAIL PROTECTED] wrote:

> sorry buddy, as far as I know you can't.
> The only thing you can do is to set the counter higher but you can't 
> return
> to a value under
> the given row.
>
> Please correct me if  I am wrong,
>
> Andy
>
> --
> 
> http://www.globosapiens.net
> Global Travellers Network!
>
>
>
> "Martin Clifford" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> news:[EMAIL PROTECTED]...
> Hi all,
>
> I have a table that has ARTICLE_ID as the primary key, 
> auto_incremented.  I
> have added three rows to this table, yet I want to delete the third.  
> Here
> it is now:
>
> 1 - Item 1
> 2 - Item 2
> 3 - Item 3
>
> My question is, how do I delete Item 3, without having the next row's 
> index
> becoming 4?
>
> 1 - Item 1
> 2 - Item 2
> 4 - Item 3
>
> Thanks in advance!
>
> Martin
>
>
>
>
> --
> 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] String datetime to DateTime

2002-06-20 Thread szii

Hmm...odd.  I guess their %s (yes that was a typo) looks for a space
as a delimiter and not the specified next one.

Easiest workarounds off the cuff...
1)  sscanf() to get the bulk of the data out, then regex out the %s string.
2)  eregi_replace() Jun with the numeric
3)  Dump it as numeric instead of a string month name
4)  eregi_replace() the /'s with spaces then sscanf() it.

'Luck

-Mike

- Original Message - 
From: "Glenn Holden" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 20, 2002 8:48 AM
Subject: Re: [PHP-DB] String datetime to DateTime


> Thanks for the help, Mike.
> Trouble with sscanf...
> 
> Incidentally I changed the $s in the format string to %s, I think that was a
> typo. :-)
> 
> $str = "12/Jun/2002:01:02:26 -0600";
> $newstr = sscanf($str,"%d/%s/%d:%d:%d:%d
> %s",$day,$mon,$year,$hour,$min,$sec,$offset);
> 
> The trouble I'm having is with the first %s.  It doesn't see the next
> delimiter so it puts the remaining text up to the next space into the $mon
> string.
> result:
> $day = 12
> $mon = Jun/2002:01:02:26
> other variables are empty
> 
> Looking at php help online, there was a spanish user comment that seemed to
> be the same problem.  And even though I can't read spanish, it looks like
> only a work around was suggested.
> 
> I can work around this further but does anyone have a solution using sscanf?
> I'm not too clear on the acceptable syntax for the format string. Some
> comments intimate that I could use regular expressions withing there, but it
> doesn't seem to work either.
> 
> Thanks in advance for any thoughts.
> Glenn
> 
> 
> 
> 
> <[EMAIL PROTECTED]> wrote in message
> news:046401c217fb$56310b00$[EMAIL PROTECTED]...
> > DateTime formats are closer to what you have.
> > strtotime() will give you an unsigned integer(ususally long/32bit) for the
> > number of seconds since the unix epoch.
> >
> > Automagically from what you have to mySQL DateTime...nope...not that I can
> think of or find.
> > If you have the Unix timestamp in ulong format, you can use date() to put
> it in the correct format.
> >
> > Obvious workaround...
> >
> > MySQL retrieves and displays DATETIME values in '-MM-DD HH:MM:SS'
> format.
> > The supported range is '1000-01-01 00:00:00' to '-12-31 23:59:59'.
> >
> > $str = "12/Jun/2002:01:02:26 -0600";
> > $newstr = sscanf($str,"%d/%s/%d:%d:%d:%d
> $s",$day,$mon,$year,$hour,$min,$sec,$offset);
> > $newdatestr = 
> >
> > I never noticed that it didn't store the GMT offset before.  heh.
> >
> > 'Luck
> >
> > -Mike
> >
> >
> > - Original Message -
> > From: "Glenn Holden" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, June 19, 2002 3:58 PM
> > Subject: [PHP-DB] String datetime to DateTime
> >
> >
> > > Hello All!
> > >
> > > I have a unix time stamp in string format like this:
> > >
> > > 12/Jun/2002:01:02:26 -0600
> > >
> > > I am trying to turn that back into a mySQL DateTime value.  I've
> > > experimented with strtotime with no luck.  I'm not really sure if that's
> > > what it's for.
> > >
> > > I can, of course, parse the string manually to build a datetime that
> MySQL
> > > will accept, but isn't there a function that handles this?
> > >
> > > How do -you- do this?
> > >
> > > Thanks!
> > > -Glenn
> > >
> > >
> > >
> > > --
> > > 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




[PHP-DB] Innodb and transactions.

2002-06-20 Thread Steve Bradwell

Hi all,

I have just figured out and set up my Innodb on my mysql server so I can use
transactions Begin, commit, rollback. I'm now looking for examples on how to
do this with php. I hit the php site and the best I could find was
fbsql_commit etc... is this what I'm looking for? There's no documentation
yet. I'm using php4 with mysql 3.23.49-max, and my tables are Innodb.

I appologize if my lingo is somewhat confusing or just wrong but I'm pretty
new to this stuff.

Any input or examples would be greatly appreciated.

Thanks,
Steve.


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




[PHP-DB] Populating multi-select list from mysql

2002-06-20 Thread bob

Hi all,

I'm having problems getting my multi-select list populated from a mysql
table. There is a table called categories with 2 columns (id and category).
I want to get all the items (category) and list them in the multi-select
list box.

This is the code I have so far:

$sql = "SELECT category FROM categories";

$result = mysql_query($sql, $connection);

while ($row = mysql_fetch_array($result)) {
   $id = $row['id'];
   $category = $row['category'];
   $category_list .= "$category";
   }
?>




  >





Now, if I echo $category_list to the page I can see I have the correct data,
I just can't get it into the list box. I've seem to hit a wall on any
different ways to try and make this work. What am I doing wrong?

Thanks.

Rob.


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




Re: [PHP-DB] String datetime to DateTime

2002-06-20 Thread Glenn Holden

Thanks for the help
I'm fairly certain a fancy preg_replace could do it all at once...
 (if you sit down and write it some late night, please share...)
I didn't use the exact functions you suggested, not sure what the difference
is (yet).
Here's what I ended up with, it could easily be turned into a function:

Glenn



// get date string from between square brackets
if (preg_match('/\[.*\]/',$RawLine,$M)) {
// parse date: [19/Jun/2002:00:13:13 -0600]
$tm = substr($M[0],1,26);  //  remove brackets
$tm = preg_replace('/\x2F|\x3A/',' ',$tm); // replace '/' and ':' with ' '
$MonthStrings = array('/Jan/','/Feb/','/Mar/','/Apr/','/May/','/Jun/',
  '/Jul/','/Aug/','/Sep/','/Oct/','/Nov/','/Dec/');
$MonthNumbers = array('01','02','03','04','05','06',
  '07','08','09','10','11','12');
$tm = preg_replace($MonthStrings,$MonthNumbers,$tm); // replace Month
Strings with Month Numbers
$a = sscanf($tm,"%d %s %d %d %d %d
%s",&$day,&$mon,&$year,&$hour,&$min,&$sec,&$offset);
$tm = $year.'-'.$mon.'-'.$day.' '.$hour.':'.$min.':'.$sec; // reorganize
unix date time to mySql date time
echo "DateTime: ".$tm.""; // produces=> DateTime: 2002-06-19 0:13:13
}







<[EMAIL PROTECTED]> wrote in message
097901c2188f$a2628230$[EMAIL PROTECTED]">news:097901c2188f$a2628230$[EMAIL PROTECTED]...
> Hmm...odd.  I guess their %s (yes that was a typo) looks for a space
> as a delimiter and not the specified next one.
>
> Easiest workarounds off the cuff...
> 1)  sscanf() to get the bulk of the data out, then regex out the %s
string.
> 2)  eregi_replace() Jun with the numeric
> 3)  Dump it as numeric instead of a string month name
> 4)  eregi_replace() the /'s with spaces then sscanf() it.
>
> 'Luck
>
> -Mike
>
> - Original Message -
> From: "Glenn Holden" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, June 20, 2002 8:48 AM
> Subject: Re: [PHP-DB] String datetime to DateTime
>
>
> > Thanks for the help, Mike.
> > Trouble with sscanf...
> >
> > Incidentally I changed the $s in the format string to %s, I think that
was a
> > typo. :-)
> >
> > $str = "12/Jun/2002:01:02:26 -0600";
> > $newstr = sscanf($str,"%d/%s/%d:%d:%d:%d
> > %s",$day,$mon,$year,$hour,$min,$sec,$offset);
> >
> > The trouble I'm having is with the first %s.  It doesn't see the next
> > delimiter so it puts the remaining text up to the next space into the
$mon
> > string.
> > result:
> > $day = 12
> > $mon = Jun/2002:01:02:26
> > other variables are empty
> >
> > Looking at php help online, there was a spanish user comment that seemed
to
> > be the same problem.  And even though I can't read spanish, it looks
like
> > only a work around was suggested.
> >
> > I can work around this further but does anyone have a solution using
sscanf?
> > I'm not too clear on the acceptable syntax for the format string. Some
> > comments intimate that I could use regular expressions withing there,
but it
> > doesn't seem to work either.
> >
> > Thanks in advance for any thoughts.
> > Glenn
> >
> >
> >
> >
> > <[EMAIL PROTECTED]> wrote in message
> > news:046401c217fb$56310b00$[EMAIL PROTECTED]...
> > > DateTime formats are closer to what you have.
> > > strtotime() will give you an unsigned integer(ususally long/32bit) for
the
> > > number of seconds since the unix epoch.
> > >
> > > Automagically from what you have to mySQL DateTime...nope...not that I
can
> > think of or find.
> > > If you have the Unix timestamp in ulong format, you can use date() to
put
> > it in the correct format.
> > >
> > > Obvious workaround...
> > >
> > > MySQL retrieves and displays DATETIME values in '-MM-DD HH:MM:SS'
> > format.
> > > The supported range is '1000-01-01 00:00:00' to '-12-31 23:59:59'.
> > >
> > > $str = "12/Jun/2002:01:02:26 -0600";
> > > $newstr = sscanf($str,"%d/%s/%d:%d:%d:%d
> > $s",$day,$mon,$year,$hour,$min,$sec,$offset);
> > > $newdatestr = 
> > >
> > > I never noticed that it didn't store the GMT offset before.  heh.
> > >
> > > 'Luck
> > >
> > > -Mike
> > >
> > >
> > > - Original Message -
> > > From: "Glenn Holden" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Wednesday, June 19, 2002 3:58 PM
> > > Subject: [PHP-DB] String datetime to DateTime
> > >
> > >
> > > > Hello All!
> > > >
> > > > I have a unix time stamp in string format like this:
> > > >
> > > > 12/Jun/2002:01:02:26 -0600
> > > >
> > > > I am trying to turn that back into a mySQL DateTime value.  I've
> > > > experimented with strtotime with no luck.  I'm not really sure if
that's
> > > > what it's for.
> > > >
> > > > I can, of course, parse the string manually to build a datetime that
> > MySQL
> > > > will accept, but isn't there a function that handles this?
> > > >
> > > > How do -you- do this?
> > > >
> > > > Thanks!
> > > > -Glenn
> > > >
> > > >
> > > >
> > > > --
> > > > PHP Database Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
> >
> > --
> > PHP Database Mai

[PHP-DB] Re: Can I be an ASP with PHP?

2002-06-20 Thread Glenn Holden

You'll need a table for each web site's connection parameters, but just look
them up based on the user and plug them in to your mysql_connect() and
mysql_select_db() arguments.

As long as their tables match the structure you are expecting everything
else should work.  Voila!

Good luck with your venture.  :-)
Glenn



And this is the trick: Can PHP somehow fetch MySQL data over the
Internet? Is this possible? If so, is it necessary for me to resort to
new, unknown technologies like XML or SOAP, or can I do it with PHP
alone?

Thanks for your comments.

...Rene





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




[PHP-DB] How to Show my Own Error Message Instead of Mysql Error?

2002-06-20 Thread Jack

Dear all
i made a Registration Form for user to input their Data, but i also had some
Field Check before the data can be insert to the Mysql_Database!
I had a question here, sometime the mysql shows the error :
"Duplicate Key for xxx"
I know what is this about, reguarding to my Registration Form, it mean the
Login Name is Duplicated! But i want to show my own message to the user for
this error instead the Mysql Error! It is meanness to show User the Mysql
Error, cause they won't understand it!!!

Could Someone pls tell me how i can do this?


--
Thx a lot!
Jack
[EMAIL PROTECTED]



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




[PHP-DB] RE: [PHP] How to Show my Own Error Message Instead of Mysql Error?

2002-06-20 Thread Martin Towell

what about doing a "select count(*) from table where username = 'foobar'"
then, if ($cnt > 0) { /* display error */ } else { /* insert new username */
}

-Original Message-
From: Jack [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 21, 2002 2:07 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: [PHP] How to Show my Own Error Message Instead of Mysql Error?


Dear all
i made a Registration Form for user to input their Data, but i also had some
Field Check before the data can be insert to the Mysql_Database!
I had a question here, sometime the mysql shows the error :
"Duplicate Key for xxx"
I know what is this about, reguarding to my Registration Form, it mean the
Login Name is Duplicated! But i want to show my own message to the user for
this error instead the Mysql Error! It is meanness to show User the Mysql
Error, cause they won't understand it!!!

Could Someone pls tell me how i can do this?


--
Thx a lot!
Jack
[EMAIL PROTECTED]



-- 
PHP General 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-DB] Converting values from text to numerical

2002-06-20 Thread Matthew Nock

I am about to build a database of products that will store features fore ach
product in a separate table.

I need to be able to store both text and numeric values in this table, but
be able to perform mathmatical functions on the numeric variables.

is it possible to have PHP covert numbers that are stored as text strings
back into values it can calculate with?


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




RE: [PHP-DB] Converting values from text to numerical

2002-06-20 Thread Russ

"is it possible to have PHP covert numbers that are stored as text
strings
back into values it can calculate with?"

Mathew:

You can use PHP to convert these - dependant upon the way you store them
in your DB.
Foe example I sometimes need to store different types of data in the
same field (I suppose you need to do this to, othewise you'd store your
numerical data in another column) like so:

Russ|27|6|Michell (stored as a single string in your table)

This is my first name, age, height, and surname respectively.

You could then just use the explode() function to remove the pipes, and
pick out the values (integers in this case) from the resultant array
that explode() provides you with.

Hope this helps you out some.
Russ

-Original Message-
From: Matthew Nock [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 21, 2002 12:43 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Converting values from text to numerical


I am about to build a database of products that will store features fore
ach
product in a separate table.

I need to be able to store both text and numeric values in this table,
but
be able to perform mathmatical functions on the numeric variables.

is it possible to have PHP covert numbers that are stored as text
strings
back into values it can calculate with?


-- 
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] Converting values from text to numerical

2002-06-20 Thread Matthew Nock

Hi Russ,

Thanks for the reply.

I was looking more along the lines of having one field, that might store
either a text value (such as the words "Not included"), or a numeric value,
such as 10.

The using PHP to determine if the value is numeric, perform a function on it
(such as a calculation) then display the result, otherwise, just display the
text.



-Original Message-
From: Russ [mailto:[EMAIL PROTECTED]]
Sent: Friday, 21 June 2002 2:53 PM
To: Matthew Nock; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Converting values from text to numerical


"is it possible to have PHP covert numbers that are stored as text
strings
back into values it can calculate with?"

Mathew:

You can use PHP to convert these - dependant upon the way you store them
in your DB.
Foe example I sometimes need to store different types of data in the
same field (I suppose you need to do this to, othewise you'd store your
numerical data in another column) like so:

Russ|27|6|Michell (stored as a single string in your table)

This is my first name, age, height, and surname respectively.

You could then just use the explode() function to remove the pipes, and
pick out the values (integers in this case) from the resultant array
that explode() provides you with.

Hope this helps you out some.
Russ

-Original Message-
From: Matthew Nock [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 21, 2002 12:43 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Converting values from text to numerical


I am about to build a database of products that will store features fore
ach
product in a separate table.

I need to be able to store both text and numeric values in this table,
but
be able to perform mathmatical functions on the numeric variables.

is it possible to have PHP covert numbers that are stored as text
strings
back into values it can calculate with?


--
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] Converting values from text to numerical

2002-06-20 Thread Russ

Matthew:

um how about using the is_int() function to decide if the value from
your DB is a number or not?

http://www.php.net/manual/en/function.is-int.php

//Do DB extraction stuff to get $val/$vals from DB

if(is_int($val))
{
echo "This is a number so do numbery type things with it..";
}
else
{
echo "This aint a number so it must be a string, so do stringy
things with it...";
}

Any good?
Russ

-Original Message-
From: Matthew Nock [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 21, 2002 1:00 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Converting values from text to numerical


Hi Russ,

Thanks for the reply.

I was looking more along the lines of having one field, that might store
either a text value (such as the words "Not included"), or a numeric
value,
such as 10.

The using PHP to determine if the value is numeric, perform a function
on it
(such as a calculation) then display the result, otherwise, just display
the
text.



-Original Message-
From: Russ [mailto:[EMAIL PROTECTED]]
Sent: Friday, 21 June 2002 2:53 PM
To: Matthew Nock; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Converting values from text to numerical


"is it possible to have PHP covert numbers that are stored as text
strings
back into values it can calculate with?"

Mathew:

You can use PHP to convert these - dependant upon the way you store them
in your DB.
Foe example I sometimes need to store different types of data in the
same field (I suppose you need to do this to, othewise you'd store your
numerical data in another column) like so:

Russ|27|6|Michell (stored as a single string in your table)

This is my first name, age, height, and surname respectively.

You could then just use the explode() function to remove the pipes, and
pick out the values (integers in this case) from the resultant array
that explode() provides you with.

Hope this helps you out some.
Russ

-Original Message-
From: Matthew Nock [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 21, 2002 12:43 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Converting values from text to numerical


I am about to build a database of products that will store features fore
ach
product in a separate table.

I need to be able to store both text and numeric values in this table,
but
be able to perform mathmatical functions on the numeric variables.

is it possible to have PHP covert numbers that are stored as text
strings
back into values it can calculate with?


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



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




RE: [PHP-DB] Converting values from text to numerical

2002-06-20 Thread Matthew Nock

Hi Russ,

thanks for the reply ...  if that will evaluate whether a (in this case) a
text string is an integer or not, then its exactly what I need! :)

if it doesnt work, I will post a more detailed example to the list and see
what we can come up with! :)

-Original Message-
From: Russ [mailto:[EMAIL PROTECTED]]
Sent: Friday, 21 June 2002 3:04 PM
To: Matthew Nock; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Converting values from text to numerical


Matthew:

um how about using the is_int() function to decide if the value from
your DB is a number or not?

http://www.php.net/manual/en/function.is-int.php

//Do DB extraction stuff to get $val/$vals from DB

if(is_int($val))
{
echo "This is a number so do numbery type things with it..";
}
else
{
echo "This aint a number so it must be a string, so do stringy
things with it...";
}

Any good?
Russ

-Original Message-
From: Matthew Nock [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 21, 2002 1:00 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Converting values from text to numerical


Hi Russ,

Thanks for the reply.

I was looking more along the lines of having one field, that might store
either a text value (such as the words "Not included"), or a numeric
value,
such as 10.

The using PHP to determine if the value is numeric, perform a function
on it
(such as a calculation) then display the result, otherwise, just display
the
text.



-Original Message-
From: Russ [mailto:[EMAIL PROTECTED]]
Sent: Friday, 21 June 2002 2:53 PM
To: Matthew Nock; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Converting values from text to numerical


"is it possible to have PHP covert numbers that are stored as text
strings
back into values it can calculate with?"

Mathew:

You can use PHP to convert these - dependant upon the way you store them
in your DB.
Foe example I sometimes need to store different types of data in the
same field (I suppose you need to do this to, othewise you'd store your
numerical data in another column) like so:

Russ|27|6|Michell (stored as a single string in your table)

This is my first name, age, height, and surname respectively.

You could then just use the explode() function to remove the pipes, and
pick out the values (integers in this case) from the resultant array
that explode() provides you with.

Hope this helps you out some.
Russ

-Original Message-
From: Matthew Nock [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 21, 2002 12:43 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Converting values from text to numerical


I am about to build a database of products that will store features fore
ach
product in a separate table.

I need to be able to store both text and numeric values in this table,
but
be able to perform mathmatical functions on the numeric variables.

is it possible to have PHP covert numbers that are stored as text
strings
back into values it can calculate with?


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



--
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] Converting values from text to numerical

2002-06-20 Thread Russ

sweet-as

Russ

-Original Message-
From: Matthew Nock [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 21, 2002 1:15 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Converting values from text to numerical


Hi Russ,

thanks for the reply ...  if that will evaluate whether a (in this case)
a
text string is an integer or not, then its exactly what I need! :)

if it doesnt work, I will post a more detailed example to the list and
see
what we can come up with! :)

-Original Message-
From: Russ [mailto:[EMAIL PROTECTED]]
Sent: Friday, 21 June 2002 3:04 PM
To: Matthew Nock; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Converting values from text to numerical


Matthew:

um how about using the is_int() function to decide if the value from
your DB is a number or not?

http://www.php.net/manual/en/function.is-int.php

//Do DB extraction stuff to get $val/$vals from DB

if(is_int($val))
{
echo "This is a number so do numbery type things with it..";
}
else
{
echo "This aint a number so it must be a string, so do stringy
things with it...";
}

Any good?
Russ

-Original Message-
From: Matthew Nock [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 21, 2002 1:00 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Converting values from text to numerical


Hi Russ,

Thanks for the reply.

I was looking more along the lines of having one field, that might store
either a text value (such as the words "Not included"), or a numeric
value,
such as 10.

The using PHP to determine if the value is numeric, perform a function
on it
(such as a calculation) then display the result, otherwise, just display
the
text.



-Original Message-
From: Russ [mailto:[EMAIL PROTECTED]]
Sent: Friday, 21 June 2002 2:53 PM
To: Matthew Nock; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Converting values from text to numerical


"is it possible to have PHP covert numbers that are stored as text
strings
back into values it can calculate with?"

Mathew:

You can use PHP to convert these - dependant upon the way you store them
in your DB.
Foe example I sometimes need to store different types of data in the
same field (I suppose you need to do this to, othewise you'd store your
numerical data in another column) like so:

Russ|27|6|Michell (stored as a single string in your table)

This is my first name, age, height, and surname respectively.

You could then just use the explode() function to remove the pipes, and
pick out the values (integers in this case) from the resultant array
that explode() provides you with.

Hope this helps you out some.
Russ

-Original Message-
From: Matthew Nock [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 21, 2002 12:43 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Converting values from text to numerical


I am about to build a database of products that will store features fore
ach
product in a separate table.

I need to be able to store both text and numeric values in this table,
but
be able to perform mathmatical functions on the numeric variables.

is it possible to have PHP covert numbers that are stored as text
strings
back into values it can calculate with?


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



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




[PHP-DB] Re: Converting values from text to numerical

2002-06-20 Thread Andy

yes you can switch the type of var for examle with:

$number = (integer)$textvar;

But if you do store it as a textfield you want be able to do some special
sql stuff directly in mysql.

For example if you store the date as text in the db you want be able to
filter out entries which are between x and y.

Good luck,

Andy

--

http://www.globosapiens.net
Global Travellers Network!



"Matthew Nock" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am about to build a database of products that will store features fore
ach
> product in a separate table.
>
> I need to be able to store both text and numeric values in this table, but
> be able to perform mathmatical functions on the numeric variables.
>
> is it possible to have PHP covert numbers that are stored as text strings
> back into values it can calculate with?
>



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




RE: [PHP-DB] Re: Converting values from text to numerical

2002-06-20 Thread Matthew Nock

Hi All,

upon looking at the link Russ gave me earlier... the PHP site recommends the
use of is_numeric() function.

This does exactly what I want..  there will only be numbers of text in the
field.

I can quickly run this returned result from the record through this
function..  and if it is numeric, then I do one thing (the calc), if its
just text, I just echo it to screen.

I will be keeping any dates etc in separate fields.

So, the is_numeric() does what i need :)

Thanks everyone :)


-Original Message-
From: Andy [mailto:[EMAIL PROTECTED]]
Sent: Friday, 21 June 2002 4:22 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: Converting values from text to numerical


yes you can switch the type of var for examle with:

$number = (integer)$textvar;

But if you do store it as a textfield you want be able to do some special
sql stuff directly in mysql.

For example if you store the date as text in the db you want be able to
filter out entries which are between x and y.

Good luck,

Andy

--

http://www.globosapiens.net
Global Travellers Network!



"Matthew Nock" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am about to build a database of products that will store features fore
ach
> product in a separate table.
>
> I need to be able to store both text and numeric values in this table, but
> be able to perform mathmatical functions on the numeric variables.
>
> is it possible to have PHP covert numbers that are stored as text strings
> back into values it can calculate with?
>



--
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] Innodb and transactions.

2002-06-20 Thread Michael Bretterklieber

Hi,

you have to do something like this:

mysql_query('SET AUTOCOMMIT=0');

mysql_query('COMMIT'); or mysql_query('ROLLBACK');
mysql_query('SET AUTOCOMMIT=1');

bye,

Steve Bradwell schrieb:
> Hi all,
> 
> I have just figured out and set up my Innodb on my mysql server so I can use
> transactions Begin, commit, rollback. I'm now looking for examples on how to
> do this with php. I hit the php site and the best I could find was
> fbsql_commit etc... is this what I'm looking for? There's no documentation
> yet. I'm using php4 with mysql 3.23.49-max, and my tables are Innodb.
> 
> I appologize if my lingo is somewhat confusing or just wrong but I'm pretty
> new to this stuff.
> 
> Any input or examples would be greatly appreciated.
> 
> Thanks,
> Steve.
> 
> 


-- 
--
Michael Bretterklieber
LCP
JAWA Management Software GmbH
Liebenauer Hauptstr. 200
A-8041 GRAZ
Tel: ++43-(0)316-403274-12
Fax: ++43-(0)316-403274-10
GSM: ++43-(0)676-93 96 698
[EMAIL PROTECTED]
homepage: http://www.jawa.at
- privat ---
E-mail:   [EMAIL PROTECTED]
homepage: http://www.inode.at/mbretter
--
"...the number of UNIX installations has grown to 10, with more expected..."
   - Dennis Ritchie and Ken Thompson, June 1972


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




[PHP-DB] a "back" include script

2002-06-20 Thread Dib, Walid (MED, Stagiaire GEMS)



Hello,

I want to create a file include .inc which by calling it in almost all the
pages which I use, will return me to the previous page, thus this script
should have the same function as the back the button of the navigator,
somebody has an idea of the script???. Thank you in advance. Sorry for my
english!

 Walid 

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