Re: [PHP-DB] MySQL performance and crash

2004-10-02 Thread Mikhail U. Petrov
MySQL is stable enough. May be it'll be better to rewrite your code or 
to add some indexes to Users?
I can help you with ideas of refactoring.
Murat BIYIKLI wrote:

I use a Linux web server with PHP-MySQL. The hardware is good enough with
2GHz CPU and 1 GB RAM. and 7200 Cycle/min Serial ATA IDE HDD. Only one web
site is running on it and on every page of that site, it searchs for a value
in Users table including 78000 records and updates that value. The MySQL
crashes on everyweek and needs to be killed and restarted, sometimes the
server becomes unreachable and needs to be restarted.
Do you think MySQL is not stable or bad configured? How to optimize that and
monitor what goes wrong, or is it time for Oracle?
 

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


Re: [PHP-DB] which DB to use?

2004-10-02 Thread M Saleh EG
I'd say never be subjective n say "i'm not a fan of MS". Choose what
works the best for you.
Check ur budget... ur time ur method of programming and ur DB
knowlede. And ofcorse the size of your project.

For website(not web applications) i'd prefer mySQL
For webapps I'd preffer MSSQL.
For intranet use I'd preffer Oracle.

M.Saleh.EG
+971 50 4779817

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



[PHP-DB] What is PHPBB?

2004-10-02 Thread Lic. Daniel Alfredo Betancourt Reboso
Hi folks!!!:

Somebody wrote:

>for example, the phpBB web app, multiple people log into the bulletin 
>board.  but the account that is used to connect to the MYSQL (in this 
>case) backend is a single account that is created when you first install 
>phpBB.  phpBB then uses this account to do all the work needed and logs 
>that into a table so you know who posted (or edit or deleted) what post 
>on the forum.

All I wanna know is what is PHPBB?. Is it some PHP thing that deals with
Database directly or is it another PHP relese?

Thank´s

Regards...
Daniel..

Please excuse my englsih grammar.




INFOSOL Webmail
http://webmail.gtm.sld.cu/imp/

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



RE: [PHP-DB] What is PHPBB?

2004-10-02 Thread Mike
Google is your friend:
http://www.google.com/search?hl=en&ie=UTF-8&q=PHPBB&btnG=Google+Search

-Original Message-
From: Lic. Daniel Alfredo Betancourt Reboso
[mailto:[EMAIL PROTECTED] 
Sent: Saturday, October 02, 2004 9:22 AM
To: '[PHP-DB] Mailing List'
Subject: [PHP-DB] What is PHPBB?

Hi folks!!!:

Somebody wrote:

>for example, the phpBB web app, multiple people log into the bulletin 
>board.  but the account that is used to connect to the MYSQL (in this 
>case) backend is a single account that is created when you first install 
>phpBB.  phpBB then uses this account to do all the work needed and logs 
>that into a table so you know who posted (or edit or deleted) what post 
>on the forum.

All I wanna know is what is PHPBB?. Is it some PHP thing that deals with
Database directly or is it another PHP relese?

Thank´s

Regards...
Daniel..

Please excuse my englsih grammar.




INFOSOL Webmail
http://webmail.gtm.sld.cu/imp/

-- 
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] newlines to BR tag

2004-10-02 Thread Murat BIYIKLI
if there are unknown number of newlines repeating like (\r\n\r\n\r\n) in a
post var and if I want to change them to a SINGLE newline, what kind of an
iteration should be used? The message may like below in DB and as you see
the \r\n newline codes may repeat severaltimes and should be changed to only
one SINGLE newline and after read from DB it will be easily coverted to BR
tag by nl2br($foo) func.

KIRKUK, Iraq (AP)\r\n\r\n - Iraqi engineers have fixed most of the damage
caused by a sabotage attack earlier this month on the main pipeline that
carries Iraqi oil to Turkey, but the country is still depending on a network
of substitute lines to export crude, an official with the North Oil Co. said
Monday. \r\n\r\n\r\n\r\n The official said 75 percent of the work has been
done but few more days are needed for the 40-inch pipeline to be ready for
exports to the Turkish port of Ceyhan. \r\nThe pumping rate is still down to
250,000 barrels a day from the normal average of 400,000 barrels, the
official said on condition of anonymity. Exports will go back to normal when
the line is fixed, he said.

SHOULD BE CHANGED LIKE (all new lines to a single newline):

KIRKUK, Iraq (AP)\r\n - Iraqi engineers have fixed most of the damage caused
by a sabotage attack earlier this month on the main pipeline that carries
Iraqi oil to Turkey, but the country is still depending on a network of
substitute lines to export crude, an official with the North Oil Co. said
Monday. \r\n The official said 75 percent of the work has been done but few
more days are needed for the 40-inch pipeline to be ready for exports to the
Turkish port of Ceyhan. \r\nThe pumping rate is still down to 250,000
barrels a day from the normal average of 400,000 barrels, the official said
on condition of anonymity. Exports will go back to normal when the line is
fixed, he said.

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



[PHP-DB] Passing url parameters

2004-10-02 Thread Stuart Felenstein
I swear this is not a repeat of earlier post :)

When passing variables via URL, my understanding is
that the value passed is the database column name. 
What I don't understand is the name / label part.  It
seems like the only name I can use is the same name as
the value.

i.e. 
Database column: Myfield
Value: _get["Myfield"]
Name: Myfield  (this is the one I want to change, so
my database column is not identified in the url)

This make sense ?
I hope this is not off topic.  If it is my apologies.

Stuart

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



RE: [PHP-DB] newlines to BR tag

2004-10-02 Thread Tom Crimmins
Murat BIYIKLI wrote:
>if there are unknown number of newlines 
>repeating like (\r\n\r\n\r\n) in a post 
>var and if I want to change them to a 
>SINGLE newline, what kind of an iteration 
>should be used? The >message may like below 
>in DB and as you see the \r\n newline codes 
>may repeat severaltimes and should be changed
> to only one SINGLE newline and after read 
>from DB it will be easily coverted to BR tag 
>by nl2br($foo) func.

Instead of using nl2br you could just use
$foo=preg_replace("/(\r\n)+/","",$foo).

---
Tom Crimmins
Interface Specialist
Pottawattamie County, Iowa

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



[PHP-DB] Re: Passing url parameters

2004-10-02 Thread Amit Arora
You can set this to anything you want.
http://www.url.com?new_field=value
And you can get the value using the
$_GET['new_field']
Amit
www.digitalamit.com
Stuart Felenstein wrote:
I swear this is not a repeat of earlier post :)
When passing variables via URL, my understanding is
that the value passed is the database column name. 
What I don't understand is the name / label part.  It
seems like the only name I can use is the same name as
the value.

i.e. 
Database column: Myfield
Value: _get["Myfield"]
Name: Myfield  (this is the one I want to change, so
my database column is not identified in the url)

This make sense ?
I hope this is not off topic.  If it is my apologies.
Stuart
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: newlines to BR tag

2004-10-02 Thread Amit Arora
You can use something like this ..
$new_str = preg_replace('/(\r\n){2,20}/', "\r\n", $old_str);
Amit
www.digitalamit.com
Murat Biyikli wrote:
if there are unknown number of newlines repeating like (\r\n\r\n\r\n) in a
post var and if I want to change them to a SINGLE newline, what kind of an
iteration should be used? The message may like below in DB and as you see
the \r\n newline codes may repeat severaltimes and should be changed to only
one SINGLE newline and after read from DB it will be easily coverted to BR
tag by nl2br($foo) func.
KIRKUK, Iraq (AP)\r\n\r\n - Iraqi engineers have fixed most of the damage
caused by a sabotage attack earlier this month on the main pipeline that
carries Iraqi oil to Turkey, but the country is still depending on a network
of substitute lines to export crude, an official with the North Oil Co. said
Monday. \r\n\r\n\r\n\r\n The official said 75 percent of the work has been
done but few more days are needed for the 40-inch pipeline to be ready for
exports to the Turkish port of Ceyhan. \r\nThe pumping rate is still down to
250,000 barrels a day from the normal average of 400,000 barrels, the
official said on condition of anonymity. Exports will go back to normal when
the line is fixed, he said.
SHOULD BE CHANGED LIKE (all new lines to a single newline):
KIRKUK, Iraq (AP)\r\n - Iraqi engineers have fixed most of the damage caused
by a sabotage attack earlier this month on the main pipeline that carries
Iraqi oil to Turkey, but the country is still depending on a network of
substitute lines to export crude, an official with the North Oil Co. said
Monday. \r\n The official said 75 percent of the work has been done but few
more days are needed for the 40-inch pipeline to be ready for exports to the
Turkish port of Ceyhan. \r\nThe pumping rate is still down to 250,000
barrels a day from the normal average of 400,000 barrels, the official said
on condition of anonymity. Exports will go back to normal when the line is
fixed, he said.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: What is PHPBB?

2004-10-02 Thread Amit Arora
PHPBB is a bulletin board written in PHP. It very good and completely free.
http://www.phpbb.com
Amit
www.digitalamit.com
Lic. Daniel Alfredo Betancourt Reboso wrote:
Hi folks!!!:
Somebody wrote:

for example, the phpBB web app, multiple people log into the bulletin 
board.  but the account that is used to connect to the MYSQL (in this 
case) backend is a single account that is created when you first install 
phpBB.  phpBB then uses this account to do all the work needed and logs 
that into a table so you know who posted (or edit or deleted) what post 
on the forum.

All I wanna know is what is PHPBB?. Is it some PHP thing that deals with
Database directly or is it another PHP relese?
Thank´s
Regards...
Daniel..
Please excuse my englsih grammar.


INFOSOL Webmail
http://webmail.gtm.sld.cu/imp/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] MySQL performance and crash

2004-10-02 Thread Amit Arora
And to add further, please check the following two setting in your PHP / 
MySQL configuration.

1. Default timeout
MySQL has a default timeout of a session set to 8 hrs. You may want  	to 
reduce it to say 5 min

2. Persistent connection
Check whether you are using the persistent connection in PHP, while 
connecting to MySQL
(Although the advantages and disadvantages of Persistent connections are 
still not clear, but it does help in certain situation)
Do No 2 only as a test, because it may worsen the situation, if your 
MySQL setting are not properly set.

On a general note, you can always check the status and current running 
processes with the query

SHOW PROCESSLIST
Amit
www.digitalamit.com
Bastien Koert wrote:
Do you have indexes on the searched columns?
Are you searching on numeric links not text (numbers are easier to compare)
What is your structure / data like?
Bastien

From: "Murat BIYIKLI" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL performance and crash
Date: Fri, 1 Oct 2004 17:41:57 +0300
I use a Linux web server with PHP-MySQL. The hardware is good enough with
2GHz CPU and 1 GB RAM. and 7200 Cycle/min Serial ATA IDE HDD. Only one 
web
site is running on it and on every page of that site, it searchs for a 
value
in Users table including 78000 records and updates that value. The MySQL
crashes on everyweek and needs to be killed and restarted, sometimes the
server becomes unreachable and needs to be restarted.
Do you think MySQL is not stable or bad configured? How to optimize 
that and
monitor what goes wrong, or is it time for Oracle?

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_
Take charge with a pop-up guard built on patented Microsoft® SmartScreen 
Technology  
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines 
 Start enjoying all the benefits of MSN® Premium right now and get the 
first two months FREE*.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: String handling

2004-10-02 Thread Amit Arora
Try using the intval() function
intval('1000'); // will result in 1000
intval('1000ABC');  // will result in 1000
Amit
www.digitalamit.com
Darryl wrote:
Hay,
 

Is there a way to make a string into an integer?
I have a value coming from a textbox and I want to check if the amount in it
is < 1.
 

Thanks,
Darryl

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


Re: [PHP-DB] Re: Convert plain text to HTML tagged text

2004-10-02 Thread Bastien Koert
just run them in order
$test=str_replace(...);
$test=str_replace(...);
$test=str_replace(...);
$test=str_replace(...);
bastien

From: GH <[EMAIL PROTECTED]>
Reply-To: GH <[EMAIL PROTECTED]>
To: Felipe Alcacibar <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Re: Convert plain text to HTML tagged text
Date: Fri, 1 Oct 2004 23:33:46 -0400
I have a question along this line... is it possible to have PHP do
more than one str_replace at the same time? or would I need to pass
through each time seperately? I.e I wasn to check for Line returns and
change it to , i want to replace "[c]" with a special formating
tag etc...?
Thanks?
On Wed, 29 Sep 2004 13:55:31 -0400, Felipe Alcacibar
<[EMAIL PROTECTED]> wrote:
> if the returnns are "\n" you only need nl2br("this \n test \n")... or
> preg_replace("/((\r|\n)|(\r\n|\n\r))/", "", "this \r\n test 
\r\n")...
> good luck...
>
> <[EMAIL PROTECTED]> escribió en el mensaje
> 
news:[EMAIL PROTECTED]
> cast.net...
>
>
> > To the list:
> >
> > I've googled and searched the manual, but I'm still looking for a 
simple
> solution to a simple problem.
> >
> > I have a MySQL database of text stories in longtext MySQL fields. 
These
> stories have simple returns (\r) in them and no other formatting. I need 
to
> use these stories both for web and print production, so I need to be 
able to
> get the text out of MySQL via PHP and have those returns change to  
tags.
> But I also need to keep those extra  tags out of the database file so 
the
> text can be exported and poured into a layout program.
> >
> > HTMLspecialchars and HTMLentities don't seem like the right solution, 
but
> maybe I'm missing something. Do I have to use regular expressions in PHP 
as
> the text is pulled from the database?
> >
> > Thanks in advance for your help.
> >
> > --veditio
>
> --
> 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
_
Take advantage of powerful junk e-mail filters built on patented Microsoft® 
SmartScreen Technology. 
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines 
 Start enjoying all the benefits of MSN® Premium right now and get the 
first two months FREE*.

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


[PHP-DB] Re: Office document upload to website (and inserting in MySQL if possible)

2004-10-02 Thread Phill

"Pugi!" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi,
>
> I would like to upload office-document (doc, xls, ...) using a form to a
> website (apache, php, mysql) in a specific directory and if possible 
> insert
> it into a table (MySQL-db). Is this possible. If yes, how ? You don't have
> to explain it in detail, a link to a website or online manual or example 
> is
> fine.
>
> Thanks,
>
> Pugi!
>
>
>
> Please reply to group or to pugilator at yahoo dot com
>

I think I get what you want to do, do you want to have a form on a webpage, 
where you specify the path of it on that pc, and then be able to upload it 
to a folder on the server. Then, you store the details, such as original 
filename, current filename, location etc. in the database.

I know this is possible, but I've never managed to do it myself. Try looking 
in PHP and MySQL, it's by Larry Ullman and is published by Peachpit Press. 
There is something towards the back of the book about file uploads, and it 
gives an example of a solution like I explained above 

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



RE: [PHP-DB] Re: Office document upload to website (and inserting in MySQL if possible)

2004-10-02 Thread Bastien Koert
here is some code i wrote for a guy.

// redefine the user error constants - PHP 4 only
define("FATAL", E_USER_ERROR);
define("ERROR", E_USER_WARNING);
define("WARNING", E_USER_NOTICE);
// set the error reporting level for this script
error_reporting(FATAL);
//Declarations
$myfile   = "";
$article  = "";
$username = "";
$FileFlag = 0;
$DBFlag   = 0;
$ConStartFlag = 0;
$LoggedInFlag = 0;
//
//logon the user on
if (($_SESSION['username']=="")&&(!$_POST['submit']=="Log In")){
 logon();   
  //show the logon form
 die();
}

//logon form submitted so check button and logon state
if (($LoggedInFlag==0)&&($ConStartFlag==0)&&($_POST['submit']=="Log In")){
 confirm_logon();
}
//
//main form code
//handle the data inputs
if (!$_POST['submit']=="Submit Entry"){
 show_form();
 die();
}else{
 $article = $_POST['article'];
}//end if
 //check for the presence of a file
 $tempfile = $_FILES['userfile']['tmp_name'];   
  //get the temporary file name from the upload dir
 if (is_uploaded_file($tempfile)){
   upload();
 }else{
   $FileFlag = 0;
 }//end if

 //check there is a value for article
 if ($article!=''){
   echo "Processing entry.";
   load_db($article);
 }
 //article submission confirmed and records / files updated uploaded
 if ($DBFlag == 1){
   confirmation();
 }
function show_form()
{
?>
 
  
  Composition:
  
  Send this file: 
   
 


function upload()
{
 // In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used 
instead
 // of $_FILES.

 global $article, $FileFlag,$myfile;
 $uploaddir  = '../bastien/uploads/';   
 //change to match your dir
 $uploadfile = $uploaddir . $_FILES['userfile']['name'];
 $myfile = $_FILES['userfile']['name'];
 //echo "Filename is:".$myfile."";

 print "";
 //check the file extension (only doc allowed) and check the mime type of 
the file
 if ($_FILES['userfile']['type']!='application/msword'){
   echo "filetype=".strtolower(substr($_FILES['userfile']['name'],-3));

   if (strtolower(substr($_FILES['userfile']['name'],-3))=="doc"){
 //check the file size
 if ($_FILES['userfile']['size']<3){
   if (copy($_FILES['userfile']['tmp_name'], $uploadfile)){ 
  //windows
   //if (move_uploaded_file($_FILES['userfile']['tmp_name'], 
$uploadfile)) {  //unix
  $FileFlag = 1;

   } //end if copy file
 }//end if file size
   }//end if file type
 }else{
   show_form($article);
   die("File is of the wrong format and has been rejected. Please try 
again.");
 }
 print "";
}//end function

function load_db($article)
{
 global $DBFlag, $myfile, $FileFlag;
//get the data to load into the db
$sql = "";
$time_out = "";
$time_out = date("Y-m-D H:i:s");
//get the connection info
require("dbconng.php");
 //create and run the query to load the data into the db
 $sql = "update contest set article = '$article', time_out = now() ";
 if ($FileFlag == 1){
$sql.=", file_name = '$myfile' ";
 }
 $sql.= "where user_id=".$_SESSION['user_id'];
 echo $sql;
 $result = mysql_query($sql,$conn)or die ("Can't insert data because 
".mysql_error());

 if (!$result){
   echo "There was an error with the database. Hit the back button and try 
again.";
 }else{
   $DBFlag = 1;
 }//end if

}//end function
function confirmation()
{
 global $FileFlag, $DBFlag;
 //show the confirmation screen
 if (($FileFlag == 1) && ($DBFlag ==1)){
   $msg = "File and contest entry have been successfully uploaded.Good luck in the contest";
 }else{
   $msg = "Contest entry have been successfully uploaded.Good luck in 
the contest";
 }

 echo $msg;
 session_destroy();
} //end function
function logon()
{
 //show the logon form
 echo "
 Rich's Writing Club Contest
 
   
  User Name:
  Password :
  
   
 
   ";

}//end function
function confirm_logon()
{
 global $ConStartFlag;
 //get the connection info
 require("dbconng.php");
 //do the logon check
 $username  = "";
 $user_id   = "";
 $pass  = "";
 $sql   = "";
 $sql2  = "";
 $time_in   = "";
 $time_in   = date("Y-m-D H:i:s");
 //assume only alpha and numeric chars allowed in username & passwords
 
if((eregi("[[:alnum:]]",$_POST['username']))&&(eregi("[[:alnum:]]",$_POST['pass']))){
$username = $_POST['username'];
$pass = $_POST['pass'];

 }else{
logon();
die("Invalid login attempt");
 }//end if
 $sql = "select user_id from users where user_name = '$username' and pass = 
'".md5($pass)."'";

 $result = mysql_query($sql,$conn)or die ("Can't insert data because 
".mysql_error());

 if (m