Re: [PHP-DB] question about '

2003-07-19 Thread David Robley
In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] says...
 Hi there,
 
 The problem is the data is already in the DB, it was mass-added with the '
 already there, what I need is a way to retrieve the ' that is already in the
 DB.
 
 Thanks
 
 Chris
 
  yes, by adding stripslashes it will somewhat escape those quotes ('),
  but when displaying the results there will not be any need to do so.
  unless it is your wish to actually store the backslash into the db.
 
 
  Jerry wrote:
 
  I think you should use addslashes to store the text in the database and
  then stripslashes when displaying the text.  I think that should work,
  but I'm new to PHP so I might be wrong.
  
  Jerry
  
  -Original Message-
  From: Chris Payne [mailto:[EMAIL PROTECTED]
  Sent: Saturday, July 12, 2003 2:11 PM
  To: php
  Subject: [PHP-DB] question about '
  
  
  Hi there everyone,
  
  I am having alittle problem.  I am calling some text that has a ' in it
  in the DB, but when it is being displayed on the screen the ' becomes a
  ? any ideas?  I'm displaying just with a ?=$ctitle? and everything
  works great except that.  I just read about addslashes and stripslashes
  etc . but not sure if that's relevant to this being that the data in
  the DB has a single ' already there.
  
  Anyway help would be appreciated :-)

Is it possible that this is one of the Microsoft Word 'smart quote' things 
and you are displaying it in other than IE? You may need to track down the 
ascii value for it/them and run a conversion on your data prior to 
display.

I have found this happens where people copy/paste data from MS Word to 
input forms.

-- 
Quod subigo farinam

$email =~ s/oz$/au/o;


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



[PHP-DB] What happens when the database is down?

2003-07-19 Thread Hanxue Lee
Hi,

I am using PHP 4.3.1, Apache 2.0.46 and MySQL 4.0.12 on Windows 2000 
Processional Edition.

All the code are working fine, with only one exception. When I shut 
down the database, the PHP script will continue running normally until 
it reaches the part where information is retrieved from the database. 
Then, the HTML output just hangs there. No error, nothing.

How can I detect this type of error? Any way I can set some timeout 
limit, etc?

Thank you in advance.


Yours truly,
Hanxue


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



Re: [PHP-DB] What happens when the database is down?

2003-07-19 Thread Miles Thompson
C'mon, think about it.

Connect to the database at the top of your page - if you can't connect 
either error out and die, or branch to alternate output.

As far as lack of error reporting is concerned, check and see what level of 
error reporting is set on the server; the manual has a helpful section on 
this as well as how to set up and configure .htacess if your ISP has all 
error reporting turned off.

If you are running locally, you can adjust the level of error reporting.

There are lots of examples in the PHP manual.

Couple of things: I know PHP and Apache 2 are not a recommended combination 
on LInux, you may be better off with 1.3.x. Aren't you also running a beta 
or rc version of MySQL - stable is still 3.x, isn't it? You may have two 
alternate sources of breakage there.

Cheers - Miles Thompson

At 12:00 AM 7/20/2003 +1000, Hanxue Lee wrote:
Hi,

I am using PHP 4.3.1, Apache 2.0.46 and MySQL 4.0.12 on Windows 2000
Processional Edition.
All the code are working fine, with only one exception. When I shut
down the database, the PHP script will continue running normally until
it reaches the part where information is retrieved from the database.
Then, the HTML output just hangs there. No error, nothing.
How can I detect this type of error? Any way I can set some timeout
limit, etc?
Thank you in advance.

Yours truly,
Hanxue
--
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] What happens when the database is down?

2003-07-19 Thread Rich Hutchins
C'mon, think about it.

Right on, Miles.

Hanxue,

One other thing to consider is if you're using the @ in front of your mysql
function calls in PHP (e.g. @mysql_connect()). Especially if you're using
the @ without and additional error checking with things like:

if (!$dbconnect) {
die (sprintf (Error [%d]: %s,
mysql_errno (), mysql_error ()));
}

Since you didn't post any code, I'm not sure if you are using @ or not. But
if you are, the @ will suppress MySQL's error reporting and it will look
like your HTML is just hanging.

Rich

-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 19, 2003 10:35 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] What happens when the database is down?



C'mon, think about it.

Connect to the database at the top of your page - if you can't connect
either error out and die, or branch to alternate output.

As far as lack of error reporting is concerned, check and see what level of
error reporting is set on the server; the manual has a helpful section on
this as well as how to set up and configure .htacess if your ISP has all
error reporting turned off.

If you are running locally, you can adjust the level of error reporting.

There are lots of examples in the PHP manual.

Couple of things: I know PHP and Apache 2 are not a recommended combination
on LInux, you may be better off with 1.3.x. Aren't you also running a beta
or rc version of MySQL - stable is still 3.x, isn't it? You may have two
alternate sources of breakage there.

Cheers - Miles Thompson


At 12:00 AM 7/20/2003 +1000, Hanxue Lee wrote:
Hi,

I am using PHP 4.3.1, Apache 2.0.46 and MySQL 4.0.12 on Windows 2000
Processional Edition.

All the code are working fine, with only one exception. When I shut
down the database, the PHP script will continue running normally until
it reaches the part where information is retrieved from the database.
Then, the HTML output just hangs there. No error, nothing.

How can I detect this type of error? Any way I can set some timeout
limit, etc?

Thank you in advance.


Yours truly,
Hanxue


--
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] speeing up query and display...

2003-07-19 Thread Aaron Wolski
Hi Guys,
 
I have the following query which unfortunately has to grab all records
in a table (well over 3000) to display in a multiple select box.
 
Code:
 
?php
 
$manufQuery = db_query(SELECT manufacturer FROM
kcs_threads);
while ($manufResults = db_fetch($manufQuery)) {
 
?
option value=?php echo $manufResults[manufacturer];
?/option
 
?php
 
$threadQuery = db_query(SELECT id,colour,colourID FROM kcs_threads
LIMIT 10);
while ($threadResults = db_fetch($threadQuery)) {
 
$threadselectQuery = db_query(SELECT * FROM
kcs_patternthreads WHERE pattern_index='$id');
while ($threadselectResult =
db_fetch($threadselectQuery)) {
 
?
option value=?php echo $threadResults[id]; ? ?php
if ($threadselectResult[thread_index] == $threadResults[id]) echo
checked; ??php echo $threadResults[colour]; ?/option
 
?php
 
}
}
}
 
?
 
Can ANYONE see a way to speed up the query and displaying of the
results? Take a while on High Speed and WY to long on Dialup.
 
Thanks a lot
 
Aaron
 


Re: [PHP-DB] speeing up query and display...

2003-07-19 Thread Becoming Digital
You've got three queries, two of which are in while loops.  If you're calling up
3000 records, you may have as many as 3000 DB queries, possibly more.  That's
why things take forever.

Restructure your code, placing the queries outside the loops.  Then use
mysql_fetch_array() and loop through the result sets.  While you're at it, stop
closing out of PHP to write one character.  Simply enclose your echo/print text
with single quotes so that PHP knows not to evaluate it.

To start you off, I've done most of the later work.  I've also taken the liberty
of neatly formatting your code so that it's easier to follow.  Good luck with
the rest.

?php
$manufQuery = db_query(SELECT manufacturer FROM kcs_threads);
while ($manufResults = db_fetch($manufQuery))
echo 'option value='.$manufResults[manufacturer].'/option';

$threadQuery = db_query(SELECT id,colour,colourID FROM kcs_threads LIMIT 10);

while ($threadResults = db_fetch($threadQuery)) {
$threadselectQuery = db_query(SELECT * FROM kcs_patternthreads WHERE
pattern_index='$id');

while ($threadselectResult = db_fetch($threadselectQuery)) {
echo 'option value='.$threadResults[id].'';
if ($threadselectResult[thread_index] == $threadResults[id])
echo 'checked'.$threadResults[colour].'/option';
}
}
?

Edward Dudlik
Becoming Digital
www.becomingdigital.com


Did I help you?  Want to show your thanks?
www.amazon.com/o/registry/EGDXEBBWTYUU



- Original Message -
From: Aaron Wolski [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, 19 July, 2003 13:29
Subject: [PHP-DB] speeing up query and display...


Hi Guys,

I have the following query which unfortunately has to grab all records
in a table (well over 3000) to display in a multiple select box.

Code:

?php

$manufQuery = db_query(SELECT manufacturer FROM
kcs_threads);
while ($manufResults = db_fetch($manufQuery)) {

?
option value=?php echo $manufResults[manufacturer];
?/option

?php

$threadQuery = db_query(SELECT id,colour,colourID FROM kcs_threads
LIMIT 10);
while ($threadResults = db_fetch($threadQuery)) {

$threadselectQuery = db_query(SELECT * FROM
kcs_patternthreads WHERE pattern_index='$id');
while ($threadselectResult =
db_fetch($threadselectQuery)) {

?
option value=?php echo $threadResults[id]; ? ?php
if ($threadselectResult[thread_index] == $threadResults[id]) echo
checked; ??php echo $threadResults[colour]; ?/option

?php

}
}
}

?

Can ANYONE see a way to speed up the query and displaying of the
results? Take a while on High Speed and WY to long on Dialup.

Thanks a lot

Aaron




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