Re: [PHP-DB] Sybase: Adaptive Server Anywhere 8 on Linux: problem with cp1215

2002-03-29 Thread gory

SQL Anywhere docs says :
Collation label Type   Description
1251CYR  ANSI  Code Page 1251, Windows Cyrillic

same DB and scripts works fine on windows
i think it is a ODBC problem on Linux

Andrey Hristov [EMAIL PROTECTED] wrote in message
00c801c1d651$47e06d70$0b01a8c0@ANDreY">news:00c801c1d651$47e06d70$0b01a8c0@ANDreY...
 This seems a unicode problem to me.
 Here we have similar problem when PHP connects to Access 2000 and receives
???s. No problems with Access 97. Are you sure that the
 data is 1 byte not unicode format?

 Andrey
 - Original Message -
 From: Igor Georgiev [EMAIL PROTECTED]
 To: Andrey Hristov [EMAIL PROTECTED]
 Sent: Thursday, March 28, 2002 2:20 PM
 Subject: Re: [PHP-DB] Sybase: Adaptive Server Anywhere 8 on Linux: problem
with cp1215


  I recive this
  PHP   -  
  in DB - îÏÒÍÁÔÉ×ÎÁ ÕÒÅÄÂÁ
  - Original Message -
  From: Andrey Hristov [EMAIL PROTECTED]
  To: Igor Georgiev [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Sent: Thursday, March 28, 2002 12:09 PM
  Subject: Re: [PHP-DB] Sybase: Adaptive Server Anywhere 8 on Linux:
problem
  with cp1215
 
 
   Do you receive ???s ?
  
   Regards,
   Andrey
  
  
   - Original Message -
   From: Igor Georgiev [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Wednesday, March 27, 2002 7:11 PM
   Subject: [PHP-DB] Sybase: Adaptive Server Anywhere 8 on Linux: problem
  with cp1215
  
  
   PHP 4.1.2
   Apache 1.3.23
   Slackware 7.1
   Sybase: Adaptive Server Anywhere 8
   iODBC - libiodbc-3.0.5
  
   database created with 1251CYR collation
   work fine with cyrillic strings trough windows app (ODBC)
   but with PHP on linux trough iODBC  Adaptive Server Anywhere ODBC
driver
  8.0.x not
  
    ODBC.INI-
   [ODBC Data Sources]
   aaa=Adaptive Server Anywhere ODBC driver 8.0.x
  
   [aaa]
   Driver=/usr/local/sybase/SYBSsa8/lib/dbodbc8.so
   ServerName=alpha
   CommLinks=tcpip
   CS=cp1251
  
   
   tried also
   CS=1251CYR
   CS=Charset=cp1251;CollationLabel=1251CYR
   Charset=cp1251
   CollationLabel=1251CYR
  
   Any help be welcome 10x
  
  
 
 




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




Re: [PHP-DB] Images on MySQL

2002-03-29 Thread Cannis

In my experience storing images on disk is simpler, easier and not
messy.

I wouldn't think of storing binaries in a MySQL table...It just doesn't seem
right, but then again I have never tested this, only relied on my peers
telling me It's not right ;)

-Lasse

- Original Message -
From: Clever [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, March 28, 2002 12:35 PM
Subject: [PHP-DB] Images on MySQL


 Hi,
 I'm designing a site and I have to store a lot of images.
 Which is the best for speed?
 1) Store all images on a MySQL table?
 2) Save them on disk like normal files and only have pointers to them on
the
 database?
 Thanks a lot
 Clever Anjos



 --
 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] Images on MySQL

2002-03-29 Thread Jason Wong

On Thursday 28 March 2002 19:35, Clever wrote:
 Hi,
 I'm designing a site and I have to store a lot of images.
 Which is the best for speed?
 1) Store all images on a MySQL table?
 2) Save them on disk like normal files and only have pointers to them on
 the database?

2)


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
The only difference in the game of love over the last few thousand years
is that they've changed trumps from clubs to diamonds.
-- The Indianapolis Star
*/

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




[PHP-DB] Return the last record on database

2002-03-29 Thread Ron

My database has several records an ID is the primary key

I want to diplay output using PHP to a table (no biggy)

The problem for me is I just want the record of the database to be
displayed!!!



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




RE: [PHP-DB] Return the last record on database

2002-03-29 Thread Rick Emery

SELECT * FROM mytable ORDER BY some_field DESC LIMIT 1;

-Original Message-
From: Ron [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 7:39 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Return the last record on database


My database has several records an ID is the primary key

I want to diplay output using PHP to a table (no biggy)

The problem for me is I just want the record of the database to be
displayed!!!



-- 
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] Insert into command - PHP

2002-03-29 Thread Ethan J. Mings

Crafted from The Desk on location in the Quality Lab.
Hello PHP,
--

I'm using the mysql_query() function.
I have 61 fields (e.g, '$fname','$lname'etc) to insert into the data
table.

No matter what I do, the data is not loaded into the table.

I've tried smaller tables with less than 11 fields and the data is
loaded correctly.

Question:
[1] Does PHP have a limit on the number of fields?
[2] How does one stop the line from running to the right. \n does
not appear to work.


Any insights would be extremely helpful. If you can point me to a
direct resource on the web, I'm glad to do the homework.

Thanks.
-- 
Best regards,
Ethan J. Mings
mailto:[EMAIL PROTECTED]


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




[PHP-DB] I LOVE PHP

2002-03-29 Thread Ron

I just wanted to say to everybody...I DO LOVE PHP AND
MYSQLSWEETNESS!!!



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




[PHP-DB] displaying info in a form

2002-03-29 Thread Natividad Castro

Hi to all,
I'm trying to display data in a form, but for some reason I can display the
entire value of every field that has more than two words in the text box.
For example, if I want to display the name CASTRO TRUCKING, the text field
only display the first word CASTRO.

I tried to use the trim() function, but it didn't work.

Any idea?

Thanks in advanced.
Nato

here is the code

html
body
?php
include ./connection.php;
//include ./common_db.inc;
//$link_id = db_connect('test_bia');

$result = mysql_query(SELECT * FROM test LIMIT 0, 1);

//while($query_data = mysql_fetch_array($result)) {

echoform;
while($query_data = mysql_fetch_array($result)){



  $tracking_num = $query_data[0];

  $id = $query_data[1];

  $name = $query_data[2];

  $user = $query_data[3];

  $comment = $query_data[4];
}
?
table border=1
form name=test action=test.php method=post
tr
tdinput type=text value=?php echo $tracking_num ?
/td
tdinput type=text value=?php echo $id ?
/td
tdinput type=text value=?php echo $name ?
/td
tdinput type=text value=?php echo $user ?
/td
/tr
tdinput type=text name=comment value=?php echo $comment ?
tr
tdbrbr
input type=submit value=Send
/td/tr
/form
/td/tr/table
/body
/html


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




Re: [PHP-DB] Images on MySQL

2002-03-29 Thread Steve Cayford

I keep hearing this from people (not to store images in mysql), but I 
would like to hear a bit more about why. Mysql has blob fields, so it 
seems perfectly reasonable to use them, doesn't it? I'm storing some 
images in a database and what's attractive to me about it is that I can 
put the images anywhere I like. I guess I could mount an image directory 
over NFS, but it seems easier and more consistent to use sql. Any 
thoughts on this?

-Steve

On Friday, March 29, 2002, at 05:43  AM, Jason Wong wrote:

 On Thursday 28 March 2002 19:35, Clever wrote:
 Hi,
 I'm designing a site and I have to store a lot of images.
 Which is the best for speed?
 1) Store all images on a MySQL table?
 2) Save them on disk like normal files and only have pointers to them 
 on
 the database?

 2)


 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk

 /*
 The only difference in the game of love over the last few thousand years
 is that they've changed trumps from clubs to diamonds.
   -- The Indianapolis Star
 */

 --
 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] displaying info in a form

2002-03-29 Thread biorn

I have come across this before.  Make sure you put  around the value field 
and then single quotes around the variable, ie.

tdinput type=text value=?php echo '$tracking_num' ?
 /td
 tdinput type=text value=?php echo '$id' ? (NOTE: if this is an int 
value, you do not need to use the single quotes around $id)
 /td
 tdinput type=text value=?php echo '$name' ?
 /td
 tdinput type=text value=?php echo '$user' ?
 /td
 /tr
 tdinput type=text name=comment value=?php echo '$comment' ?


HTH

MB

Natividad Castro [EMAIL PROTECTED] said:

 Hi to all,
 I'm trying to display data in a form, but for some reason I can display the
 entire value of every field that has more than two words in the text box.
 For example, if I want to display the name CASTRO TRUCKING, the text field
 only display the first word CASTRO.
 
 I tried to use the trim() function, but it didn't work.
 
 Any idea?
 
 Thanks in advanced.
 Nato
 
 here is the code
 
 html
 body
 ?php
 include ./connection.php;
 //include ./common_db.inc;
 //$link_id = db_connect('test_bia');
 
 $result = mysql_query(SELECT * FROM test LIMIT 0, 1);
 
 //while($query_data = mysql_fetch_array($result)) {
 
 echoform;
 while($query_data = mysql_fetch_array($result)){
 
 
 
   $tracking_num = $query_data[0];
 
   $id = $query_data[1];
 
   $name = $query_data[2];
 
   $user = $query_data[3];
 
   $comment = $query_data[4];
 }
 ?
 table border=1
 form name=test action=test.php method=post
 tr
 tdinput type=text value=?php echo $tracking_num ?
 /td
 tdinput type=text value=?php echo $id ?
 /td
 tdinput type=text value=?php echo $name ?
 /td
 tdinput type=text value=?php echo $user ?
 /td
 /tr
 tdinput type=text name=comment value=?php echo $comment ?
 tr
 tdbrbr
 input type=submit value=Send
 /td/tr
 /form
 /td/tr/table
 /body
 /html
 
 
 -- 
 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] Unknown column 'Test' in 'field list'

2002-03-29 Thread Jonathan Hilgeman

Even though this is solved, I should mention a method that I find to be
personally easier to use when INSERTing records. Simply use the field=value
method:

INSERT INTO MyTable SET firstname='Joe', lastname='Bob', age=58;

By doing it this way, you don't have to worry about matching up the number
of columns to values, or the order of the fields (the above example could
have age or lastname as the first value without changing the output). Not to
mention this method is a little easier to read and easier to construct.

- Jonathan

-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 6:55 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Unknown column 'Test' in 'field list'


Never mind I forgot to put  '  ' around $u_name in my insert.

Jen



-- 
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: Images on MySQL

2002-03-29 Thread Luis R. Sales Glez.

Hi Steve  *:

Based on my experience, not only for MySQL, but any Database, I think it's
better to keep just links to images instead of keep them in the database.

Some of the reasons are, for example, when you need to update an image,
you don't need to touch the database, only change the file. Another one
would be if you try to move to another Database and it does not support
those types, then you won't be able to keep your images in the database.

One more... In a heavy traffic site or environment it would be faster and
more efficient to serve the images directly from the file system than from
the database having several users connected at the same time.

Anyway, there is not a solution that is better than the other. It all
depends on what you want to do, how you want to do it, and the
environment, specifications and resources that you have.

Regards, 

-- 
Luis R. Sales Glez.
Database Administrator
Information Systems  Solutions
Sony Latin America Inc.
Mailto: [EMAIL PROTECTED]


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




[PHP-DB] Re: displaying info in a form

2002-03-29 Thread Luis R. Sales Glez.

Hi Natividad  *:

Try to declare the input file as:

input type=text value=?php echo $name ?

instead of 

input type=text value=?php echo $name ?

Regards,

-- 
Luis R. Sales Glez.
Database Administrator
Information Systems  Solutions
Sony Latin America Inc.
Mailto: [EMAIL PROTECTED]


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




RE: [PHP-DB] Insert into command - PHP

2002-03-29 Thread Jonathan Hilgeman

You can check to see if there were any insert errors by:

  print mysql_error();

...after you have run the query. Give us the output and your query and we
can help a bit more.

- Jonathan

-Original Message-
From: Ethan J. Mings [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 6:34 AM
To: PHP Mailing List
Subject: [PHP-DB] Insert into command - PHP


Crafted from The Desk on location in the Quality Lab.
Hello PHP,
--

I'm using the mysql_query() function.
I have 61 fields (e.g, '$fname','$lname'etc) to insert into the data
table.

No matter what I do, the data is not loaded into the table.

I've tried smaller tables with less than 11 fields and the data is
loaded correctly.

Question:
[1] Does PHP have a limit on the number of fields?
[2] How does one stop the line from running to the right. \n does
not appear to work.


Any insights would be extremely helpful. If you can point me to a
direct resource on the web, I'm glad to do the homework.

Thanks.
-- 
Best regards,
Ethan J. Mings
mailto:[EMAIL PROTECTED]


-- 
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] displaying info in a form

2002-03-29 Thread Paul Burney

on 3/29/02 10:54 AM, Natividad Castro at [EMAIL PROTECTED] appended the
following bits to my mbox:

 I'm trying to display data in a form, but for some reason I can display the
 entire value of every field that has more than two words in the text box.
 For example, if I want to display the name CASTRO TRUCKING, the text field
 only display the first word CASTRO.

 tdinput type=text value=?php echo $name ?

Just following up on what someone else said.  If the Name field has a quote
in it, such as Joe's Amazing Truck Company that could also cause
problems.  

To remedy, do this:

input type=text value=?php echo htmlspecialchars($name); ?

HTH,

Paul Burney
http://burney.ws/

?php
while ($self != asleep) {
$sheep_count++;
}
?



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




RE: [PHP-DB] Re: displaying info in a form

2002-03-29 Thread Jonathan Hilgeman

People have already answered this question, but here are some additional
tips.

Always make sure you include the NAME attribute of an INPUT - otherwise it
can cause some headaches when you try to get the submitted data on the next
page. So:

  input type=text name=TrackingNum value=?php echo $tracking_num ?

You can also shorten the echo/print statement down to:

  input type=text name=TrackingNum value=?=$tracking_num;?

I've heard that you can leave off the semi-colon, but I just consider it
good coding habit to always end statements with semi-colons.

- Jonathan

-Original Message-
From: Luis R. Sales Glez. [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 9:30 AM
To: Natividad Castro
Cc: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: displaying info in a form


Hi Natividad  *:

Try to declare the input file as:

input type=text value=?php echo $name ?

instead of 

input type=text value=?php echo $name ?

Regards,

-- 
Luis R. Sales Glez.
Database Administrator
Information Systems  Solutions
Sony Latin America Inc.
Mailto: [EMAIL PROTECTED]


-- 
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: Re[2]: [PHP-DB] Insert into command - PHP

2002-03-29 Thread Jonathan Hilgeman

Well first, I don't know if you copied and pasted directly from your file,
but you're building your query in the variable $sql AFTER you run the query:

  mysql_query($sql) or die(msql_error());
  $sql = Insert into table ('$field1','$field2',,'$field61');

It should be:

  $sql = Insert into table ('$field1','$field2',,'$field61');
  mysql_query($sql) or die(msql_error());

However, you should also use the coding practice of:

  $sql = INSERT INTO table SET
NameOfField1='ValueOfField2',Field2='Value',Field3='Value', etc;

It's a little easier to read and understand. Note that you don't really have
to do anything special to be able to separate the query onto multiple lines:

  $sql = INSERT INTO
  table
  SET
  field='value',
  field2='value';
  ;

  mysql_query($sql) or die(msql_error());

... will work fine. No need for special characters - PHP will recognize
values and strings that are on multiple lines AS LONG AS the value starts
and ends with quotes (and the semicolon at the end).

- Jonathan

-Original Message-
From: Ethan J. Mings [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 9:11 AM
To: Jonathan Hilgeman
Subject: Re[2]: [PHP-DB] Insert into command - PHP


PHP-DB Mailing List
Hello Jonathan,
--
Friday, March 29, 2002, 11:53:31 AM, you wrote:

 ...after you have run the query. Give us the output and your query and we
 can help a bit more.

Hi, thanks for the follow up.

I included the following command in the line...

mysql_query($sql) or die(msql_error());
$sql = Insert into table ('$field1','$field2',,'$field61');

The message returned was, Query was empty

I am suspect of the 61 fields.  The line travels far out to the right.

Is there a way to properly code the line so it does not go so far to
the right.

Otherwise, no other report errors.




-- 
Ethan J. Mings
Office E-mail [EMAIL PROTECTED]

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




Re[4]: [PHP-DB] Insert into command - PHP

2002-03-29 Thread Ethan J. Mings

PHP-DB Mailing List
Hello Jonathan,
--
Friday, March 29, 2002, 12:16:19 PM, you wrote:


 It should be:

   $sql = Insert into table ('$field1','$field2',,'$field61');
   mysql_query($sql) or die(msql_error());

Thanks that is helpful.


 It's a little easier to read and understand. Note that you don't really have
 to do anything special to be able to separate the query onto multiple lines:

   $sql = INSERT INTO
   table
   SET
   field='value',
   field2='value';
   ;

   mysql_query($sql) or die(msql_error());

I re coded as per the suggestion above.  Still, I get a new error
message,

You have an error in your SQL syntax near  at line 55.


Line 55 is R38='$R38',



 ... will work fine. No need for special characters - PHP will recognize
 values and strings that are on multiple lines AS LONG AS the value starts
 and ends with quotes (and the semicolon at the end).
   field2='value';
   ;


Any suggestions.

Jerry


-- 
Ethan J. Mings
Office E-mail [EMAIL PROTECTED]


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




[PHP-DB] Advanced. Optimizing querry performance on a huge db with over 2.5 million entries

2002-03-29 Thread Andy

Hi there,

I used to work with a table containing over 2.5 million cities. This
was verry slow even using indexes. So I did split the huge table into
250 tables named after their country. Example: gm_cities for the german city
table.
Now performance is ok, because my interface knows in which table
to look at.

A new problem arised. There is a need for a search on all tables to find a
specific
city. To find this city even in one table takes 0.5s which is a lot if you
put it times 250 tables.
I have to admit that there is no index on the city column yet. I tryed to
put a full text index
on the city column, but this busted up the table size from 2.5Mb to 7.5MB
which made
the querry take 1s.

My questions are as follows:

1. whats wrong with this one table having 7.5Mb instead of 2.5 I did delete
the index and optimized
the table but still 7.5

2. What would be the best way to organize this data to make the search on
this 2.5 mio entrys to
take not longer than 0.5s? I could put it all into one table again, but this
would meen a week of work
because my application is based on this system. Maybe a good hint for
putting the right index
would be the best help for me.

My tablestrukture looks like this:

ID -mediumint(9) unique index
city   -char(100)
province_id- char(2) index

A nother story would be that it might take even longer because I have to get
the province name and the country name
out of the table countries and provinces

Thank you for any help,

Andy



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




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

2002-03-29 Thread Kevin Won

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 a 
href=$string$string/a 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 ;-)

thanks

kevin





Kevin Won
-
ITG Web Developer,
Systems Administrator
Oregon Health Sciences University
(503) 418-4282
cell: (503) 913-5367
page: x15897
fax: (503) 494-1888





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




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

2002-03-29 Thread Kevin Won

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 a 
href=$string$string/a 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 ;-)

thanks

kevin





Kevin Won
-
ITG Web Developer,
Systems Administrator
Oregon Health Sciences University
(503) 418-4282
cell: (503) 913-5367
page: x15897
fax: (503) 494-1888





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




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

2002-03-29 Thread Jonathan Hilgeman

Just do a while loop:
  
  while(preg_match(/string to find unconverted links/, $TextBody))
  {
// preg_replace here
  }

But make sure you're not doing this on the fly every time the page is
viewed. That will take up an enormous amount of resources with lots of
visitors. Just convert it and save the converted version for viewing.

- Jonathan

-Original Message-
From: Kevin Won [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 11:46 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] help with preg_replace for http://


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 a href=$string$string/a 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 ;-)

thanks

kevin





Kevin Won
-
ITG Web Developer,
Systems Administrator
Oregon Health Sciences University
(503) 418-4282
cell: (503) 913-5367
page: x15897
fax: (503) 494-1888





-- 
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: Advanced. Optimizing querry performance on a huge db with over 2.5 million entries

2002-03-29 Thread Lutz Brückner

Hi Andy,

it is difficult to give you an advice without the knowing about
how you are searching the database. But if you have to search
through all entries, it was a bad decision to split them up into
250 tables.

Some other hints:
You are lost without an index, because mysql have to do a full 
table scan to find the matching rows.

CREATE INDEX cityidx ON cities (city(10));
creates an index for the leading 10 characters of the column which
needs much less tablespace than a fulltext index and will probably
fitt your needs.

OPTIMIZE TABLE gm_cities;
releases the tablespace lost after a DROP INDEX or after deleting
rows.

Do you really need a char(100) for the city names? If you can use
char(50) instead, the table would be much smaller.

Buy lot of ram and fast harddisks. And setup the mysql-server to use
the ram proberly.

Good luck,
   Lutz


[EMAIL PROTECTED] (Andy) writes:

 Hi there,
 
 I used to work with a table containing over 2.5 million cities. This
 was verry slow even using indexes. So I did split the huge table into
 250 tables named after their country. Example: gm_cities for the german city
 table.
 Now performance is ok, because my interface knows in which table
 to look at.
 
 A new problem arised. There is a need for a search on all tables to find a
 specific
 city. To find this city even in one table takes 0.5s which is a lot if you
 put it times 250 tables.
 I have to admit that there is no index on the city column yet. I tryed to
 put a full text index
 on the city column, but this busted up the table size from 2.5Mb to 7.5MB
 which made
 the querry take 1s.
 
 My questions are as follows:
 
 1. whats wrong with this one table having 7.5Mb instead of 2.5 I did delete
 the index and optimized
 the table but still 7.5
 
 2. What would be the best way to organize this data to make the search on
 this 2.5 mio entrys to
 take not longer than 0.5s? I could put it all into one table again, but this
 would meen a week of work
 because my application is based on this system. Maybe a good hint for
 putting the right index
 would be the best help for me.
 
 My tablestrukture looks like this:
 
 ID -mediumint(9) unique index
 city   -char(100)
 province_id- char(2) index
 
 A nother story would be that it might take even longer because I have to get
 the province name and the country name
 out of the table countries and provinces
 
 Thank you for any help,
 
 Andy

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




[PHP-DB] Re: Advanced. Optimizing querry performance on a huge db with over 2.5 million entries

2002-03-29 Thread Andy

thanx,

I am gonna play with it

Andy

Lutz Brückner [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi Andy,

 it is difficult to give you an advice without the knowing about
 how you are searching the database. But if you have to search
 through all entries, it was a bad decision to split them up into
 250 tables.

 Some other hints:
 You are lost without an index, because mysql have to do a full
 table scan to find the matching rows.

 CREATE INDEX cityidx ON cities (city(10));
 creates an index for the leading 10 characters of the column which
 needs much less tablespace than a fulltext index and will probably
 fitt your needs.

 OPTIMIZE TABLE gm_cities;
 releases the tablespace lost after a DROP INDEX or after deleting
 rows.

 Do you really need a char(100) for the city names? If you can use
 char(50) instead, the table would be much smaller.

 Buy lot of ram and fast harddisks. And setup the mysql-server to use
 the ram proberly.

 Good luck,
Lutz


 [EMAIL PROTECTED] (Andy) writes:

  Hi there,
 
  I used to work with a table containing over 2.5 million cities. This
  was verry slow even using indexes. So I did split the huge table into
  250 tables named after their country. Example: gm_cities for the german
city
  table.
  Now performance is ok, because my interface knows in which table
  to look at.
 
  A new problem arised. There is a need for a search on all tables to find
a
  specific
  city. To find this city even in one table takes 0.5s which is a lot if
you
  put it times 250 tables.
  I have to admit that there is no index on the city column yet. I tryed
to
  put a full text index
  on the city column, but this busted up the table size from 2.5Mb to
7.5MB
  which made
  the querry take 1s.
 
  My questions are as follows:
 
  1. whats wrong with this one table having 7.5Mb instead of 2.5 I did
delete
  the index and optimized
  the table but still 7.5
 
  2. What would be the best way to organize this data to make the search
on
  this 2.5 mio entrys to
  take not longer than 0.5s? I could put it all into one table again, but
this
  would meen a week of work
  because my application is based on this system. Maybe a good hint for
  putting the right index
  would be the best help for me.
 
  My tablestrukture looks like this:
 
  ID -mediumint(9) unique index
  city   -char(100)
  province_id- char(2) index
 
  A nother story would be that it might take even longer because I have to
get
  the province name and the country name
  out of the table countries and provinces
 
  Thank you for any help,
 
  Andy



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




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 a 
href=$string$string/a 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




[PHP-DB] end of file

2002-03-29 Thread Natividad Castro

Hi to all,
how can I handle when the recordset reach the last record?
is it possible to use eof?
e.g. if there is no more record, do something

Thanks in advanced
Nato



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




RE: [PHP-DB] end of file

2002-03-29 Thread Rick Emery

while( $row = mysql_fetch_array($result) )
{
}

-Original Message-
From: Natividad Castro [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 2:59 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] end of file


Hi to all,
how can I handle when the recordset reach the last record?
is it possible to use eof?
e.g. if there is no more record, do something

Thanks in advanced
Nato



-- 
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] end of file

2002-03-29 Thread Clever

It's simple.
The mysql_fetch_array($result)  function will return a false value.

example :
if ( !mysql_fetch_array($result) ) {
// Then do what u want
}
- Original Message - 
From: Natividad Castro [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, March 29, 2002 5:58 PM
Subject: [PHP-DB] end of file


 Hi to all,
 how can I handle when the recordset reach the last record?
 is it possible to use eof?
 e.g. if there is no more record, do something
 
 Thanks in advanced
 Nato
 
 
 
 -- 
 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] Uploading a file

2002-03-29 Thread Clever

Hi,
I want to upload a file to the server using a form.
Instead of using a text input, i'd like to open an Internet Explorer window,
(that one that apears when you click on File/Open).
I already have the code to copy the file.
I only want a way to select from local files.
How do this?
Thanks
- Original Message -
From: Clever [EMAIL PROTECTED]
To: Natividad Castro [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, March 28, 2002 10:26 PM
Subject: Re: [PHP-DB] end of file


 It's simple.
 The mysql_fetch_array($result)  function will return a false value.

 example :
 if ( !mysql_fetch_array($result) ) {
 // Then do what u want
 }
 - Original Message -
 From: Natividad Castro [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, March 29, 2002 5:58 PM
 Subject: [PHP-DB] end of file


  Hi to all,
  how can I handle when the recordset reach the last record?
  is it possible to use eof?
  e.g. if there is no more record, do something
 
  Thanks in advanced
  Nato
 
 
 
  --
  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: Images on MySQL

2002-03-29 Thread Andrew Chase

The kneejerk response always seems to be #2, store images in the filesystem
and store their paths in the database.

I like to compromise: store the original image in a dedicated image data
table in the database (keep a separate table for image meta data
(date/title/category/whatever) for faster queries, link the two with an
'image_id' field), then have the script which displays the image check for a
copy in a specified directory in the filesystem; if it's not there, yank a
copy from the database, resize/watermark as needed, and store in the
directory.  Otherwise, the script can just write the img href on the fly.

This way you don't wind up with the overhead of pulling images from the DB
on the fly every time (just the first time a script looks for the image),
but you maintain a pristine copy of the original image in the database-
especially nice for uploading photos straight out of a digital camera
without monkeying around in Photoshop/GIMP; you get the web-sized copy in
your /images directory, but you keep the full resolution copy in the db if
you ever need it for something else.  And if you ever need to move the db to
a new server, you don't need to worry about moving all the image files
separately.

I suppose storage space might become a factor if the number of images
climbed into the high hundreds or thousands, but it works great for me in
smaller applications.  YMMV, caveat emptor, etc.

-Andy

 -Original Message-
 From: Clever [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, March 28, 2002 3:35 AM
 To: [EMAIL PROTECTED]
 Subject: Images on MySQL


 Hi,
 I'm designing a site and I have to store a lot of images.
 Which is the best for speed?
 1) Store all images on a MySQL table?
 2) Save them on disk like normal files and only have pointers to
 them on the
 database?
 Thanks a lot
 Clever Anjos





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




[PHP-DB] Problem with PHP connectivity with mySQL (RedHat package)

2002-03-29 Thread Saulo Silva

Hi everybody

I can't get PHP to work with mySQL. I'm using PHP as an Apache module
(RedHat) and the error message I get is the following message:

Fatal error: Call to undefined function: mysql_connect() in
/var/www/html/other/test.php on line 10

I've tried to recompile PHP with mySQL support and restart httpd but nothing
changed. The problem is not with the mySQL database because I also use Perl
in our website and it works fine.

Can anyone help me?

Best regards



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




Re: [PHP-DB] Problem with PHP connectivity with mySQL (RedHat package)

2002-03-29 Thread Jason Wong

On Saturday 30 March 2002 10:42, Saulo Silva wrote:
 Hi everybody

 I can't get PHP to work with mySQL. I'm using PHP as an Apache module
 (RedHat) and the error message I get is the following message:

Are both apache  php installed from RedHat rpms?

 Fatal error: Call to undefined function: mysql_connect() in
 /var/www/html/other/test.php on line 10

It's telling you that you don't have mysql support compiled into php (which 
you know).

 I've tried to recompile PHP with mySQL support and restart httpd but
 nothing changed. The problem is not with the mySQL database because I also
 use Perl in our website and it works fine.

If you're mixing RPMs installs with source tarball installs you have to make 
sure that the paths they use are the same.

Check where your recompiled PHP installs its files (libphp4.so etc)
Check in your httpd.conf that apache is loading those same files.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
The only difference in the game of love over the last few thousand years
is that they've changed trumps from clubs to diamonds.
-- The Indianapolis Star
*/

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




Re: [PHP-DB] Uploading a file

2002-03-29 Thread Jason Wong

On Friday 29 March 2002 09:58, Clever wrote:
 Hi,
 I want to upload a file to the server using a form.
 Instead of using a text input, i'd like to open an Internet Explorer
 window, (that one that apears when you click on File/Open).
 I already have the code to copy the file.
 I only want a way to select from local files.
 How do this?

Not sure what you mean by open an Internet Explorer window. But if you want 
a file select dialog then your form needs to be something like:


form enctype=multipart/form-data action=doodah.php method=post
input type=file name=file size=60
input type=submit name=action value=Upload!
/form


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
I don't want people to love me.  It makes for obligations.
-- Jean Anouilh
*/

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