Re: [PHP-DB] Bug in interbase.c (Ver. 5.2.6) INVALID BLOB ID

2008-11-27 Thread Benjamin Schwarze

Thank you for this hint.

Chris schrieb:

Benjamin Schwarze wrote:

Hi!

Ay many other users recognized, there is a bug in the implementation 
of the function "_php_ibase_quad_to_string". (imho since version 5.2.1)


The line "spprintf(&result, BLOB_ID_LEN+1, "0x%0*" LL_MASK "x", 16, 
*(ISC_UINT64*)(void *) &qd);" doesnt work as estimated. The result 
stored inside qd isnt the value convertet from the string, but 
something else. Normally this should work, but it doesnt.


One possible solution is, to change the line into "spprintf(&result, 
BLOB_ID_LEN+1, "0x%0*x%0*x", 8, qd.gds_quad_low, 8, qd.gds_quad_high);"


Of course, this solution isnt the fine way ... but it works.


If you want to discuss this sort of stuff, join the -internals list. 
That's where they discuss the C code behind php.




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



[PHP-DB] Bug in interbase.c (Ver. 5.2.6) INVALID BLOB ID

2008-11-27 Thread Benjamin Schwarze

Hi!

Ay many other users recognized, there is a bug in the implementation of 
the function "_php_ibase_quad_to_string". (imho since version 5.2.1)


The line "spprintf(&result, BLOB_ID_LEN+1, "0x%0*" LL_MASK "x", 16, 
*(ISC_UINT64*)(void *) &qd);" doesnt work as estimated. The result 
stored inside qd isnt the value convertet from the string, but something 
else. Normally this should work, but it doesnt.


One possible solution is, to change the line into "spprintf(&result, 
BLOB_ID_LEN+1, "0x%0*x%0*x", 8, qd.gds_quad_low, 8, qd.gds_quad_high);"


Of course, this solution isnt the fine way ... but it works.

The problem occured onto a 64bit System (Fedora Core 8).

Greetings
Benjamin

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



Re: [PHP-DB] PHP Beginners Help

2008-01-02 Thread Benjamin Darwin
Ben:

First, using a $_POST value directly into a MySQL query is EXTREMELY
unsafe. Always filter data from any source to make sure it's what you
expect. SQL injection is one of the easiest ways to cause real damage
to a website. http://en.wikipedia.org/wiki/SQL_injection

Check out this fuction for making the string safe:
http://us2.php.net/manual/en/function.mysql-real-escape-string.php
Also, try and strip out any characters that don't belong in the string
anyway, just as added security.

Good luck learning PHP.

--Another person who happens to be named Ben

I've also put a few edits in the code.
On Jan 2, 2008 9:57 PM, Ben Stones <[EMAIL PROTECTED]> wrote:
> Hello, my name is Ben Stones. I am quite a beginner to PHP, and as a new
> years resolution I am going to learn PHP (finally!)
>
> Cut to the chase I have created a basic looping script that would display
> anything submitted in a form, on seperate lines; here is the PHP code:
>
> $con = mysql_connect("localhost","ben_test","--removed-") or
> die("con");
> $db = mysql_select_db("ben_test") or die("db");
> mysql_query("CREATE TABLE `comments` (messages varchar(255))");
> $comments = $_POST['comment'];
> $sql1 = mysql_query("INSERT INTO `comments` (`messages`) VALUES
> ($comments)");
>
> $mysql_query_one = mysql_query("SELECT * FROM `comments`");
> while($rows=mysql_fetch_array($mysql_query_one)) {
> echo $rows['messages'] . "[br /]";
> }
>
> Everything went swell for the first half, and after I truncated the test
> messages (or everything in the column, if you like), I tried doing one more
> test run and upon clicking 'Submit', nothing would display except the
> messages I added via phpMyAdmin.
>
> Hope someone could help me.
>
> PS: The password has been edited out of the preceding code as well as the
> HTML code purposely for the mailing list.
>

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



Re: [PHP-DB] Only a section from the database result

2006-07-18 Thread Benjamin Adams

I have it working with left, Thanks everyone.

On Jul 18, 2006, at 1:57 PM, [EMAIL PROTECTED] wrote:




I have articles in a MySQL database and I want creating a fast brows
where people can read the beginning of the articles and select
the ones they want to read.

How do I only display the first say 50 chars of a 5000 char article?

$count = 1;
while(($row = mysql_fetch_array($News)) or ($count < 15)){
if(isset($row['threadid'])){
echo "" .
$row['title']. "";
echo "   " . $row['dateline'] . " -- by: " . $row
['postusername'] . "";
echo "   Views: " . $row['views'] . " - Comments:
" . $row['replycount'] . "";
echo "" . $row['pagetext'] . ""; //This is the variable I
only want the fist 50 chars
}
$count++;
}


One possible solution is to select from the database only the first 50
characters for display in the initial page: "SELECT left(FieldName,  
50)

FROM tablename";

Once a user has chosen the articles they would like to read, run  
another

query and select the entire content field.

David





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



[PHP-DB] Only a section from the database result

2006-07-18 Thread Benjamin Adams
I have articles in a MySQL database and I want creating a fast brows  
where people can read read the beginning of the articles and select  
the ones they want to read.


How do I only display the first say 50 chars of a 5000 char article?

$count = 1;
while(($row = mysql_fetch_array($News)) or ($count < 15)){
if(isset($row['threadid'])){
echo "" .  
$row['title']. "";
echo "   " . $row['dateline'] . " -- by: " . $row 
['postusername'] . "";
echo "   Views: " . $row['views'] . " - Comments:  
" . $row['replycount'] . "";
echo "" . $row['pagetext'] . ""; //This is the variable I  
only want the fist 50 chars

}
$count++;
}

Thanks

--Ben

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



Re: [PHP-DB] can you use php to connect to both FileMaker and MySQL simultaneously

2006-04-17 Thread Benjamin Adams

If you are using filemaker 8.0 you can connect using ODBC.

On Apr 17, 2006, at 3:17 PM, Michael Scappa wrote:

I've never done it, but assuming there is a connector for  
filemaker, there

is no reason you shouldn't be able to.

-Original Message-
From: Tami Williams [mailto:[EMAIL PROTECTED]
Sent: Monday, April 17, 2006 3:14 PM
To: php-db@lists.php.net
Subject: [PHP-DB] can you use php to connect to both FileMaker and  
MySQL

simultaneously

Thanks in advance for any help.

Can you use php to connect to both FileMaker and MySQL
simultaneously?  Has anyone ever done it?

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

2006-03-08 Thread Benjamin Stambaugh

Hi,

I have created a user login/registration page.  As of now I am using a 
MySQL database to store the info of the user.  To validate the user I 
also have the password stored in the same DB.  I was wondering if there 
is a way that I can store the password in the DB so that it is 
encrypted or something.  Just so it is not in plain text.


Ben

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



[PHP-DB] Compile Error FIXED

2006-02-21 Thread Benjamin Stambaugh
I fixed my own problem.  It was my Apache web server that was not 
working correctly.


Quoting Benjamin Stambaugh <[EMAIL PROTECTED]>:

Hi. I have been having issues with PHP compiling.  It was workin fine 
until a day ago and now every time I try to access a page with any 
kinda of PHP script I comes up with errors.  I just worte this simple 
code for the purpose to demonstrate my problem.  When I access the 
file through my web browser (firefox) it starts to compile fine and 
then I just stops just about at the 3rd or 4th line of the PHP script 
and treats the rest of the page as if it were just plain HTML code.  
It does this for anything I have in written in PHP even without using 
a database.  I was wondering if anyone had any clue as to why this is 
happening.


Some back ground info.  Im using the latest version of PHP, Apache2, 
and MySQL5.0 all on a windows platfrom.


Here is the code:

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>

http://www.w3.org/1999/xhtml";>
 
   MySQL Server Information
   

   
 
 
   MySQL Database Server Information
   MySQL client version: "
 . mysqli_get_client_info() . "";
echo "MySQL connection: "
 . mysqli_get_host_info($DBConnect) . "";
echo "MySQL protocol version: "
 . mysqli_get_proto_info($DBConnect) . "";
echo "MySQL server version: "
 . mysqli_get_client_info($DBConnect) . "";
mysqli_close($DBConnect);
   ?>
 



Here is the output I got from this code:

MySQL Database Server Information
MySQL client version: " . mysqli_get_client_info() . ""; echo "

MySQL connection: " . mysqli_get_host_info($DBConnect) . "
"; echo "

MySQL protocol version: " . mysqli_get_proto_info($DBConnect) . "
"; echo "

MySQL server version: " . mysqli_get_client_info($DBConnect) . "
"; mysqli_close($DBConnect); ?>


Ben Stambaugh

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

2006-02-20 Thread Benjamin Stambaugh
Hi. I have been having issues with PHP compiling.  It was workin fine 
until a day ago and now every time I try to access a page with any 
kinda of PHP script I comes up with errors.  I just worte this simple 
code for the purpose to demonstrate my problem.  When I access the file 
through my web browser (firefox) it starts to compile fine and then I 
just stops just about at the 3rd or 4th line of the PHP script and 
treats the rest of the page as if it were just plain HTML code.  It 
does this for anything I have in written in PHP even without using a 
database.  I was wondering if anyone had any clue as to why this is 
happening.


Some back ground info.  Im using the latest version of PHP, Apache2, 
and MySQL5.0 all on a windows platfrom.


Here is the code:

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>

http://www.w3.org/1999/xhtml";>
 
   MySQL Server Information
   

   
 
 
   MySQL Database Server Information
   MySQL client version: "
 . mysqli_get_client_info() . "";
echo "MySQL connection: "
 . mysqli_get_host_info($DBConnect) . "";
echo "MySQL protocol version: "
 . mysqli_get_proto_info($DBConnect) . "";
echo "MySQL server version: "
 . mysqli_get_client_info($DBConnect) . "";
mysqli_close($DBConnect);
   ?>
 



Here is the output I got from this code:

MySQL Database Server Information
MySQL client version: " . mysqli_get_client_info() . ""; echo "

MySQL connection: " . mysqli_get_host_info($DBConnect) . "
"; echo "

MySQL protocol version: " . mysqli_get_proto_info($DBConnect) . "
"; echo "

MySQL server version: " . mysqli_get_client_info($DBConnect) . "
"; mysqli_close($DBConnect); ?>


Ben Stambaugh

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



[PHP-DB] php5 with imap

2005-12-09 Thread Benjamin Adams

I'm trying to build and install php-5.1.1 on My Mac OS X 10.4.3
I can build it with out imap but can't get it to work when I enter it  
in:


./configure --prefix=/usr/local/php --with-apxs --enable-force-cgi- 
reidirect --enable-fast-cgi --with-openssl=/usr --with-dom=/usr/local/ 
php --with-gd --with-mysql --with-mysql-socket=/tmp/mysql.sock -- 
enable-sockets --enable-wddx --enable-xslt --with-zlib=/usr --with- 
xml --with-xmlrpc --enable-exif --enable-wddx --enable-ftp --enable- 
mbstring -enable-xslt --with-ldap --with-xml --with-xmlrpc --with- 
iodbc=/usr --enable-sockets --enable-dbx --enable-dbase --enable- 
trans-sid --with-dom=/usr/local/php --with-dom-xslt=/usr/local/php -- 
with-dom-exslt=/usr/local/php --with-xslt-sablot=/usr/local/php -- 
enable-zend-multibyte --enable-maintainer-zts --with-openssl=/usr -- 
with-jpeg-dir=/usr/local/php --with-imap-ssl=/usr --with-imap=../ 
imap-2004g


I already ran make osx in imap-2004g

When building I get:
checking whether build with IMAP works... no
configure: error: build test failed. Please check the config.log for  
details.


config.log
configure:47438: checking whether build with IMAP works
configure:47476: gcc -o conftest -DBIND_8_COMPAT=1 -DEAPI -O3  -no- 
cpp-precomp  -L/usr/local/php/lib -L/usr/local/php/lib -L/usr/local/ 
lib -L/usr/local/lib -L/Users/badams/Desktop/imap-2004g/c-client -L/ 
Users/badams/Desktop/imap-2004g/c-client conftest.c -lc-client   - 
lssl -lcrypto -lpam -lpng -lz -ljpeg -lssl -lcrypto -lz -lssl - 
lcrypto -lm  -lxml2 -lz -liconv -lm -lxml2 -lz -liconv -lm 1>&5

/usr/bin/ld: Undefined symbols:
_gss_accept_sec_context
_gss_acquire_cred
_gss_delete_sec_context
_gss_display_name
_gss_display_status
_gss_import_name
_gss_init_sec_context
_gss_nt_service_name
_gss_release_buffer
_gss_release_cred
_gss_release_name
_gss_unwrap
_gss_wrap
_krb5_aname_to_localname
_krb5_free_context
_krb5_free_principal
_krb5_init_context
_krb5_kt_close
_krb5_kt_default
_krb5_kt_start_seq_get
_krb5_parse_name
collect2: ld returned 1 exit status
configure: failed program was:
#line 47449 "configure"
#include "confdefs.h"


void mm_log(void){}
void mm_dlog(void){}
void mm_flags(void){}
void mm_fatal(void){}
void mm_critical(void){}
void mm_nocritical(void){}
void mm_notify(void){}
void mm_login(void){}
void mm_diskerror(void){}
void mm_status(void){}
void mm_lsub(void){}
void mm_list(void){}
void mm_exists(void){}
void mm_searched(void){}
void mm_expunged(void){}

char mail_newbody();
int main() {
  mail_newbody();
  return 0;
}
 


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



[PHP-DB] connect vs pconnect

2005-12-08 Thread Benjamin Adams
I'm trying to figure out if running mysql_connect or mysql_pconnect  
would be faster.

Can someone explain the difference?
Picking one for a very high traffic website with a 10 G database.

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



Re: [PHP-DB] Debugging

2005-12-02 Thread Benjamin Adams
On think I'm looking to figure out is how much it takes for an http  
process to connect.


On Dec 2, 2005, at 3:17 PM, Benjamin Adams wrote:

Can anyone give me an ideas or ways for me to find out a problem on  
my website?
Its either the Invision power boards code, apache config or MySQL  
config.
I'm having trouble figuring out which one is causing the problems,  
can someone lead me to some good tips or programs to help me figure  
this out.

THANKS

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

2005-12-02 Thread Benjamin Adams
Can anyone give me an ideas or ways for me to find out a problem on  
my website?
Its either the Invision power boards code, apache config or MySQL  
config.
I'm having trouble figuring out which one is causing the problems,  
can someone lead me to some good tips or programs to help me figure  
this out.

THANKS

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



Re: [PHP-DB] How to redirect after a valid login

2004-03-13 Thread Benjamin
What kind of error does it give you?  Because in the snippet you gave us 
you wrote

> include "mainmenu.php"; // Which gives me an error !

And that should give you an error because it should be

include( "mainmenu.php" );  //note parenthesies

I have done what you want to do before like so

if( $logged_in ) include( "logged_in_script.php" );
else include( "logged_in_failed.php" );
So what error do you get?

Goodluck,

Benjamin

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


[PHP-DB] Re: PHP5B5 + Oracle9i + Apache1.3

2004-03-10 Thread Benjamin Müller
Hi,

same here

[Wed Mar 10 14:42:10 2004] [notice] child pid 11646 exit signal Segmentation
fault (11)
[Wed Mar 10 14:42:10 2004] [notice] child pid 11648 exit signal Segmentation
fault (11)
[Wed Mar 10 14:42:10 2004] [notice] child pid 11649 exit signal Segmentation
fault (11)

but with PHP5b4 / Oracle 9.2 / Apache 1.3.29

Benjamin

"Php.Net" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hallo
> I have a trouble with PHP5Beta4 + Oracle9i + Apache1.3. When I start
Apache
> it fails with Error 1067: The process terminated unexpectelly.
>
> When I change PHP5Beta4 to PHP4.3.4 it works fine.
>
> Can you help me?
>
> Thanks, Josef

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



[PHP-DB] Help please

2004-03-05 Thread Benjamin Jeeves
hi all,

I my querying two tables in mysql the first table I query returns a list of software 
that I have. 

Then I query a second table that show me what is installed on a computer. 

I would then like to be able to display the first list but with a tick next to 
software installed on a computer.

I have treid with making a function that reuten the full list of software but can not 
get it to to work function below.

function software_list(&$software) # Software is a word or it can be empty.

{

$db_search = "SELECT software_name 

FROM software_list 

WHERE software_name 

LIKE '".$software."%'";

$db_result = mysql_query($db_search);

$db_count = mysql_num_rows($db_result);

while($sw_result = mysql_fetch_array($db_result)){

$temp = $sw_result[software_name];

for($i=0;$i

[PHP-DB] Building A Query

2004-02-11 Thread Benjamin Jeeves
Hi All

I have a form with a number of checkboxs on it and what I would like to be able to do 
is build a query base on the checked checkedboxes. 

The database I am using is mysql


Thank You

Ben

[PHP-DB] Warning: Unable to jump to row...

2003-03-31 Thread Benjamin Trépanier
Hi, 

I'm trying to using a  news script and improve somes with a query.


$req = MYSQL_QUERY("SELECT * FROM $TBL_NEWS");
$res = MYSQL_NUM_ROWS($req);

?>







I want that my script show the content of the rows corresponding to my
Variable called: Id_News_

So the variable is moving well but when the scirpt is running and go to
display the row  this code happend:

Warning: Unable to jump to row number X

Or

Currently he is always showing row #5...

I put my id_news_  in a echo and the variable is ok.. I really dont
understand

Thanks for your help!

BEn




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



[PHP-DB] PHP and MySQL 4

2003-03-30 Thread Benjamin Higgins
Does PHP have support for MySQL 4?  If I install MySQL 4, and rebuild PHP
with --with-mysql, is that sufficient to get MySQL 4 support?

Ben



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



[PHP-DB] Re: textarea data and printing

2003-03-13 Thread Benjamin Walling
Not really sure what you are asking.  Do you want to remove the line breaks
from the textarea entry?  Use str_replace("\n","",$user_input);
str_replace("\r","",$user_input); to remove them.

If you want the user to be able to use the enter key to format the
description, you will have to replace "\n" with  when you display it
back.  HTML ingores whitespace, so "\n" accomplishes nothing.


"Rajesh Fowkar" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> We are accepting Detailed description of the item in
> .
>
> Is there any function which can return full words without breaking the
> lines. The data is stored in a PostgreSQL database in varchar field.
>
> item_detail_description varchar(200)
>
> I am assuming that the user need not press the 'enter' key at the end of
> each line. Hence by using the 'carriage return' code this function
> cannot be written. I was interested in knowing if any such function
> already exists.
>
> Thanks in advance.
>
> Peace
>
> --
> Rajesh
> :
> [ GNU/Linux One Stanza Tip (LOST) ]###
>
> Sub : Locating a command (whereis)   LOST #126
>
> To locate the  binary, source, and  manual page for a command,
> try : whereis  [e.g. whereis man].  See man pages for
> detailed filter options)
> For merely knowing where it lies: which 
>
> <[EMAIL PROTECTED]>##
> :



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



[PHP-DB] Re: Real Killer App!

2003-03-12 Thread Benjamin Walling
Are you doing some kind of recursion and getting stuck or overflowing the
stack?

If you create something like:

function Factorial($x)
{
 if ($x == 1)
 {
  return $x;
 }
 else
 {
  return $x * Factorial($x-1);
 }
}


You can get into a problem with overflowing the call stack with a
sufficiently high value for $x.

"Nicholas Fitzgerald" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm having a heck of a time trying to write a little web crawler for my
> intranet. I've got everything functionally working it seems like, but
> there is a very strange problem I can't nail down. If I put in an entry
> and start the crawler it goes great through the first loop. It gets the
> url, gets the page info, puts it in the database, and then parses all of
> the links out and puts them raw into the database. On the second loop it
> picks up all the new stuff and does the same thing. By the time the
> second loop is completed I'll have just over 300 items in the database.
> On the third loop is where the problem starts. Once it gets into the
> third loop, it starts to slow down a lot. Then, after a while, if I'm
> running from the command line, it'll just go to a command prompt. If I'm
> running in a browser, it returns a "document contains no data" error.
> This is with php 4.3.1 on a win2000 server. Haven't tried it on a linux
> box yet, but I'd rather run it on the windows server since it's bigger
> and has plenty of cpu, memory, and raid space. It's almost like the
> thing is getting confused when it starts to get more than 300 entries in
> the database. Any ideas out there as to what would cause this kind of
> problem?
>
> Nick
>
>



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



Re: [PHP-DB] php, mssql and french accents

2003-03-12 Thread Benjamin MAsdoua
hi,


The charset used on my sql server is :

Character Set = 1, iso_1
ISO 8859-1 (Latin-1) - Western European 8-bit character set.


Where can I change these settings ?

Ben

[EMAIL PROTECTED] (Edwin Boersma) wrote in
news:[EMAIL PROTECTED]: 

> Your code page setting might be wrong.
> 
> 
> Edwin
> 
> Benjamin Masdoua wrote:
>> Hello,
>> 
>> I'm developping an application using php and mssql.
>> I have problems with french accents,
>> when I insert something from php, and i consult it by enterprise
>> manager (sql server) the accents are replaced, example "paté" becomes
>> "patÚ" and if I insert something from enterprise manager and get teh
>> value by php, the accents are also replaced and not by the same as
>> the first situation example : "paté" becomes "pat,"
>> 
>> any idea ?
>> 
>> Benjamin Masdoua
>> ABS-Integration
>> Toulouse.
>> 
>> 
> 


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



[PHP-DB] php, mssql and french accents

2003-03-11 Thread Benjamin Masdoua
Hello,

I'm developping an application using php and mssql.
I have problems with french accents,
when I insert something from php, and i consult it by enterprise manager
(sql server) the accents are replaced, example "paté" becomes "patÚ"
and if I insert something from enterprise manager and get teh value by php,
the accents are also replaced and not by the same as the first situation
example : "paté" becomes "pat,"

any idea ?

Benjamin Masdoua
ABS-Integration
Toulouse.



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



[PHP-DB] Automattic Rollback on User Cancel with MySQL

2002-10-18 Thread Benjamin Schleinzer
Hi

I Am using the latest PHP version 4.2.3 with MySQL 3.23.51-max. I use 
InnoDB tables for transactions and everything works fine with Rollback and 
Commit. But when the user presses cancel in the browser or the script stops 
due to an error in the script all open transactions are committed instead 
of rolled back. Is there some way to change this behavior ?

Thanks for any help

Ben

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



[PHP-DB] mssql_init using freetds

2002-08-20 Thread Benjamin Walling

I've installed freetds 0.53, php 4.2.2 and apache 1.3.26.  I have some of
the mssql functions working (mssql_connect(), for example).  I cannot get
mssql_init() to work - I get Fatal error: Call to undefined function:
mssql_init() in /var/www/html/stdFunctions.php on line 128

I saw a previous post on this from January, which received a reply stating
that the CVS version had this working.  Has it not been moved into the
regular tarball?  What do I need to do to get this working?



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




[PHP-DB] Re: time field query problems.

2002-07-29 Thread Benjamin Pflugmann

Hi.

On Mon 2002-07-29 at 14:41:30 -0400, [EMAIL PROTECTED] wrote:
> Sorry to repost but I typed in the wrong sql statement in my previous post.

Ah. Okay.

> For some reason the below statement is not working. Can anyone tell me why?
> 
> Select EDIT_LOCK from ordmaster where EDIT_LOCK + INTERVAL 10 MINUTE < now()
> AND ORDER_NO = '5' AND EDIT_LOCK > 0;

Regardless of the original problem, you should use

  EDIT_LOCK < NOW() - INTERVAL 10 MINUTE

because this variant has no expression on the left side and therefore
could use an index, if there is one on EDIT_LOCK (MySQL does not
optimize expressions, in the few cases where this would be
possibible).

> -EDIT_LOCK is a MySQL (ver 3.23.49-max) time field, allows nulls, default is
> NULL.

Oh. Is it really a TIME field, not TIMESTAMP? In this case you would
compare a time (without date) with a whole datetime value from
NOW(). These values cannot be compared reasonable.

Additionally +- INTERVAL only works on DATE or DATETIME/TIMESTAMP
values, otherwise you have to use DATE_SUB/DATE_ADD.

In this case, you would need something like

  SELECT EDIT_LOCK
  FROM   ordmaster
  WHERE  EDIT_LOCK < DATE_FORMAT( NOW() - INTERVAL 10 MINUTE, "%T" )
 AND ORDER_NO = '5' AND EDIT_LOCK > 0;

This does not handle the special cases on day change, but I presume
that this already had been thought of, or else a TIME instead of a
DATETIME field makes no sense.

Greetings,

Benjamin.

-- 
[EMAIL PROTECTED]

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




[PHP-DB] Re: Problem with JOIN

2002-05-23 Thread Benjamin Walling

I'm not sure I'm reading what you want correctly, but it sounds like you
really want an INNER JOIN instead of a LEFT JOIN.  INNER JOIN will only join
if the records in both tables exist and match on the join criteria.  Also,
why are you joining the user_websites table to itself?  Just use WHERE
user_websites.user_id = '3'.  Generally, you would join the other tables
based on fields in the main table, instead of on constants.

SELECT
w.website,
c.comment,
i.icq,
s.signature
FROM user_websites w
INNER JOIN user_comments c ON w.user_id = c.user_id
INNER JOIN user_icq i ON w.user_id = i.user_id
INNER JOIN user_signature s ON w.user_id = s.user_id
WHERE w.user_id = '3'

This will only return records that exist in all of the tables.  If there are
any records that are not essential, change them to a LEFT JOIN.  For
example, if you icq and signature were optional return values, you would
LEFT JOIN them instead of INNER JOIN, then only records that matched in
user_websites and user_comments would be returned, and they would include
anything that was found in user_icq or user_signature.



"Andy" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi there,
>
> I do want to pull out some data of a user. I did normalize the tables, so
> there is a table for website, comment ...
>
> Now I would like to pull out the users website, comment.. but only if
there
> is one.
>
> Unfortunatelly my select stmt returns all 5 records of the website
> table:
>
> SELECT
> w.website,
> c.comment,
> i.icq,
> s.signature
> FROM
> user_websites
> LEFT JOIN user_comments AS c ON c.user_id = '3'
> LEFT JOIN user_icq AS i ON i.user_id = '3'
> LEFT JOIN user_signature AS s ON s.user_id = '3'
> LEFT JOIN user_websites AS w ON w.user_id = '3'
>
> Somehow my syntax must be wrong, but I can not find the error :-(
>
> Maybe one of you guys does know why.
>
> Thanx in advance,
>
> Andy
>
>



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




[PHP-DB] Re: PHP Mysql Select Distinct problem

2002-05-22 Thread Benjamin Walling

MessageAccording to http://www.mysql.com/doc/D/I/DISTINCT_optimisation.html,
DISTINCT is converted to a GROUP BY on all columns, DISTINCT combined with
ORDER BY will in many cases also need a temporary table.

Instead of using DISTINCT, consider adding GROUP BY for all the columns
except ID.



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




[PHP-DB] Re: Complicated query on very simple database - pointers sought

2002-05-22 Thread Benjamin Walling

Look into Aggregate Functions.  They can let you do the things that you are
looking for.

SELECT Month(OrderDate) as 'Month', Count(DISTINCT Customer) as
'NumCustomersOrdering', Count(Customer) as 'TotalOrders' FROM tbl_Orders
GROUP BY Month(OrderDate)

will give you a list of months, and the number of Customer Orders.  Throw in
a distinct if you want to know how many different customers ordered.  The
GROUP BY clause basically tells it when to reset the counter.  You can get
sums, averages, counts, etc using aggregates.

Check this page for more information:
http://www.mysql.com/doc/G/r/Group_by_functions.html

(I mainly use MSSQL, so the syntax might be slightly different - refer to
the URL above for specifics).


"George Pitcher" <[EMAIL PROTECTED]> wrote in message
03b701c20190$8f53fe00$630db092@HLATITUDE">news:03b701c20190$8f53fe00$630db092@HLATITUDE...
> Hi all,
>
> I want to report some figures to my colleagues.
>
> My database (2 fields: Customer, Order date) contains over 15000 records
> dating back to 1999.
>
> I want to be able to show, in a web page, the following information
>
> Month   Customers placing orders Orders placed
> Average Orders/Cust  Average over prev 12 months.
>
> My work with MySQL has never been this detailed.
>
> Can anyone give me any pointers?
>
> Regards
>
> George in Edinburgh
>



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




[PHP-DB] Re: REGEXP for search engine/SQL Server

2002-05-21 Thread Benjamin Walling

Why not yank the quoted terms out before using split?  Search for patterns
".*" and put them in a separate array.  Once those are gone, split the
remaining string.  You may want to remove duplicate spaces created by
removing the quoted terms.


"Kevin Won" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
I'm having a bit of difficulty getting my REGEXP right for my search engine.
I'm hoping someone has done this already--it is actually a rather simple
problem but I suck at regexps . . .

problem:  need to concatinate a query string with like '%searchterm%' from a
list of words from a webform, but also need to identify "quoted terms" which
should not have wildcards infront/behind them.

so the result for a search query of

this is "my search" term set

should end up:

SELECT * FROM TABLE WHERE keywords LIKE '%this%'
OR keywords LIKE '%is%'
OR keywords LIKE 'my search'
OR keywords LIKE '%term%'
OR keywords LIKE '%set%'

so the quoted term doesn't have the wildcards in front/behind.

I'm using preg_split to cut the words using a \s space character
presently--I haven't yet implemented containing "quoted terms". I'm unsure
how to keep the "quoted terms" together yet split the other words apart.

I'm guessing someone has done this on the list. ..

thanks



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] Re: Question about ODBC databases

2002-05-21 Thread Benjamin Walling

Write a simple web service.

Put a few PHP pages on the NT server, which take parameters, and return
results.  For example, create a function that takes a string (sql statement,
eg) as a parameter, and echos a comma delimited page (the resulting
recordset).

Then, on the Linux/Unix box, use the HTTP methods to call the page, passing
the string and then parses the output.

I've done this with ASP to interact with some VB programs that some of our
remote sites use.  It works well.

"Anthony" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> That is not entirely what I'm trying to do.  What I need is for the NT
> server that is running ODBC to respond to remote requests from other
> servers or clients.  In other words, I need computer A to access
> database on computer B which is running ODBC.  Computer A does not have
> ODBC, I need computer a to be able to query against computer B as if it
> were a SQL server.  As far as I can tell, I can't make an NT server
> running ODBC respond to remote requests.  If I am wrong though, PLEASE
> let me know.  Thanks.
>
> - Anthony [EMAIL PROTECTED]
>
> Andrew Hill wrote:
>




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




[PHP-DB] Re: ADODB - whaddya think?

2002-05-17 Thread Benjamin Walling

I'm starting to migrate from ASP to PHP.  What are you finding that you
can't to with mssql_*?  I'd be interested in knowing what limitations I may
be facing.


"Jerome Houston" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Testimonial time!
>
> Despite ROCK STAR assistance from a PHP developer, I'm having troubles
with
> mssql_*() functions.  most of the problems are gone (or being fixed by
some
> AWESOME people), but to make use of those fixes, i've got to use php v
> 4.3-dev.  and there's other bugs in that (as there should be).  so i've
been
> looking for alternatives to using the mssql functions...  and i've found
> something that looks promising: ADODB.  for those of you who don't know,
> some people have just written some code that attempts (and looks as if it
> does a pretty good job) of unifying ODBC calls for lots of different
> databases. their website: http://php.weblogs.com/ADODB
>
> What i want to know is:  does anyone have experience with these libraries?
I
> tested them briefly, and it seemed to work like a charm, but so did the
> mssql_*() functions, until i got into some of the nitty-gritty uses of the
> DB.  Will lots of little bugs come about, the more i use it?  or have they
> ironed most of that out?
>
> thanks for your opinons - honestly.
>
> -jerome
>
> _
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>



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




[PHP-DB] Re: Question about ODBC databases

2002-05-17 Thread Benjamin Walling

I don't use Access, but I believe an Access database to be just a file.
You're going to have to mount (through Samba) the share on the NT server
that contains the database file.  There's not a server that is taking
requests like an SQL server - you just open the file itself.


"Gerardo Morales" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have a little problem.
>
> I must design a little system in a linux server, this should be in php.
> The system must read a  MS Access DB in a remote server (Win NT). After
> a single process the system must update a MySQL DB in the same server
> (Linux) and the Access DB.
>
> The current code works fine in the Linux server, so i can update the
> MySQL DB, but it doesn't connect with the NT server.
>
> When i tried to connect to it i have the following error.
> Fatal error: Call to undefined function: odbc_connect() in
> /usr/local/etc/httpd/htdocs/vox/loginAccess.inc on line 14
>
> I never developed  with ODBC DB, only with MySQL.
>
> I was searching about what could be the problem, but i don't found it.
>
> The code in liginAccess is the following:
>
> $dbaccess = array();
> $dbaccess["accessserver"]
> = "NT.server.ip.address";
> // Access server hostname
> $dbaccess["accessport"]
> = "";
> // Access server port
> $dbaccess["accessusername"]
> = "user";
> // username
> $dbaccess["accesspassword"]
> = "password";
> // password
> $dbaccess["defaultdb"]
> = "database";
> // database
>
$conexionAccess=odbc_connect($dbaccess["defaultdb"],$dbaccess["accessusernam
e"],$dbaccesss["accesspassword"],"");
>
> In the code above i tried to inser the remote server address, port etc,
> and the error codee is the same
>
> I hope you cant help me.
>
> I don't who else can i ask for it.
>
> Thanks in advanced
>



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




Re: [PHP-DB] Anti-virus alarm! Sulfbnk var inget virus.

2002-05-16 Thread Benjamin Walling

It's been a long time since I heard this one.  Damn marketing guy at work
forwarded a similar email to the entire company, telling them to delete the
file sulfnbk.exe one day when I was out.  Thing was supposedly 'dormant
until June 1st, 2001' and then the whole company was going to get screwed.




"Craig Vincent" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Beklager forrige epost, det viser seg at jeg og en god del andre har
> > blitt lurt.
> > Her er en webside som forklarer hvordan du reparerer feilen:
> >
> > http://netsquirrel.com/msconfig/sulf.html
> >
> > Filen sulfnbk.exe er en fil som gjenoppretter lange filnavn.
> >
> >
> > English:
> >
> > Sorry for the last email, it seems, this file "sulfnbk.exe" only
> > restores long filenames.
> > Here's a link to a page that explains how you can restore the file.
> > http://netsquirrel.com/msconfig/sulf.html
>
> Buahahahaboy do I smell a troll.  Innovative way to spam a list with
an
> advertisement I must say.  Better be careful though, piss the wrong person
> off with a scam like this and you could have a lawsuit on your hands.
>
> Sincerely,
>
> Craig Vincent
>
>



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




[PHP-DB] MSSQL DateTime field formatting?

2002-05-14 Thread Benjamin Walling

I can't seem to find a way to format the field that comes back from my
DateTime fields in MSSQL Server.  For example, '2002-05-13' shows in Query
Analyzer as 2002-05-13 00:00:00.000.  If I echo it from PHP, I get May 13
2002 12:00AM.  date() won't take it.  strftime() won't take it.  What do I
need to do to convert this to a time PHP likes?



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




Re: [PHP-DB] mssql_fetch_array not working?

2002-05-13 Thread Benjamin Walling

I thought about that while I was copying the code from the tutorial.  I know
a little C++, and it seemed wrong, but I let it go.

Thanks.


"Terry Romine" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Do I see a semicolon at the end of the while? that won't work...
>
> On Monday, May 13, 2002, at 04:35  PM, Gurhan Ozen wrote:
>
> >   while ($row = mssql_fetch_array($rs)) _;_
> >
> should be
> while ($row = mssql_fetch_array($rs))
> {
> ...
> }
>
> Terry Romine
> Web Developer
> JumpInteractive.com
>



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




Re: [PHP-DB] mssql_fetch_array not working?

2002-05-13 Thread Benjamin Walling

It's the ';' at the end of the while statement.  It runs the loop with no
statements in it, then executes the code in brackets.  I copied some bum
code from a tutorial...


"Peter Lovatt" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> hi
>
> The code looks OK
>
> Try something like
>
>   while ($row = mssql_fetch_array($rs));
>   {
>echo "another row";
>echo $row["ItemClassKey"];
>echo "";
>   }
>  }
>
> to see if it is looping thro the results, if so then the array
> $row["ItemClassKey"] is empty - check the obvious - index case and that
> there is data in the field in the record.
>
> If it is not looping thro then could the if($rs) be moving the pointer to
> the end of he result set, so there is nothing left to loop thro?
>
> hth
>
> Peter
>
> ---
> Excellence in internet and open source software
> ---
> Sunmaia
> www.sunmaia.net
> [EMAIL PROTECTED]
> tel. 0121-242-1473
> ---
>
> > -Original Message-
> > From: Benjamin Walling [mailto:[EMAIL PROTECTED]]
> > Sent: 13 May 2002 22:16
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] mssql_fetch_array not working?
> >
> >
> > I apologize if the answer to this is incredibly simple.  I'm
> > trying to learn
> > PHP, and evaluate whether to change our site away from ASP.
> >
> > I have the following php code, and I can't get any results.
> >
> > I have add the line  echo mssql_num_rows($rs); to see how many rows are
> > returned, and I get 11 (there are 11 rows in this table).
> >
> > The page outputs only "11Done".  Why am I not getting any thing into
> > $row?  Why do I only get 1  (I would expect 11)?
> >
> > --Begin Code
> >
> > $db = mssql_connect("domino","uid","pwd");
> > if ($db)
> > {
> >  $dbs = mssql_select_db("acuity_edd_app",$db)
> >   or die("Couldn't set DB");
> >  $sql = "SELECT * FROM timItemClass ORDER BY ItemClassID";
> >  $rs = mssql_query($sql);
> >  echo mssql_num_rows($rs);
> >  if ($rs)
> >  {
> >   while ($row = mssql_fetch_array($rs));
> >   {
> >echo $row["ItemClassKey"];
> >echo "";
> >   }
> >  }else{
> >   echo "No results\n";
> >  }
> >  echo "Done\n";
> > }else{
> >  echo "Unable to connect to database.\n";
> > }
> >
> > --End Code
> >
> >
> >
> >
> > --
> > 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] mssql_fetch_array not working?

2002-05-13 Thread Benjamin Walling

I still get the same response.

"Gurhan Ozen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi ...
> Get rid of the if($rs) block...
> Just do:
>
>   while ($row = mssql_fetch_array($rs));
>   {
>echo $row["ItemClassKey"];
>echo "";
>   }
>
> Gurhan
>
> -Original Message-
> From: Benjamin Walling [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 13, 2002 5:16 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] mssql_fetch_array not working?
>
>
> I apologize if the answer to this is incredibly simple.  I'm trying to
learn
> PHP, and evaluate whether to change our site away from ASP.
>
> I have the following php code, and I can't get any results.
>
> I have add the line  echo mssql_num_rows($rs); to see how many rows are
> returned, and I get 11 (there are 11 rows in this table).
>
> The page outputs only "11Done".  Why am I not getting any thing into
> $row?  Why do I only get 1  (I would expect 11)?
>
> --Begin Code
>
> $db = mssql_connect("domino","uid","pwd");
> if ($db)
> {
>  $dbs = mssql_select_db("acuity_edd_app",$db)
>   or die("Couldn't set DB");
>  $sql = "SELECT * FROM timItemClass ORDER BY ItemClassID";
>  $rs = mssql_query($sql);
>  echo mssql_num_rows($rs);
>  if ($rs)
>  {
>   while ($row = mssql_fetch_array($rs));
>   {
>echo $row["ItemClassKey"];
>echo "";
>   }
>  }else{
>   echo "No results\n";
>  }
>  echo "Done\n";
> }else{
>  echo "Unable to connect to database.\n";
> }
>
> --End Code
>
>
>
>
> --
> 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] Our software

2002-05-13 Thread Benjamin Walling

I suppose it might help to know that this is on Windows 2000(SP2), IIS 5,
PHP 4.21, SQL Server 2000.



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




[PHP-DB] I'm running...

2002-05-13 Thread Benjamin Walling

It might help to tell you:

Windows 2000 Server (SP2)
IIS 5
PHP 4.21



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




[PHP-DB] mssql_fetch_array not working?

2002-05-13 Thread Benjamin Walling

I apologize if the answer to this is incredibly simple.  I'm trying to learn
PHP, and evaluate whether to change our site away from ASP.

I have the following php code, and I can't get any results.

I have add the line  echo mssql_num_rows($rs); to see how many rows are
returned, and I get 11 (there are 11 rows in this table).

The page outputs only "11Done".  Why am I not getting any thing into
$row?  Why do I only get 1  (I would expect 11)?

--Begin Code

$db = mssql_connect("domino","uid","pwd");
if ($db)
{
 $dbs = mssql_select_db("acuity_edd_app",$db)
  or die("Couldn't set DB");
 $sql = "SELECT * FROM timItemClass ORDER BY ItemClassID";
 $rs = mssql_query($sql);
 echo mssql_num_rows($rs);
 if ($rs)
 {
  while ($row = mssql_fetch_array($rs));
  {
   echo $row["ItemClassKey"];
   echo "";
  }
 }else{
  echo "No results\n";
 }
 echo "Done\n";
}else{
 echo "Unable to connect to database.\n";
}

--End Code




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




[PHP-DB] Install SAPDB with Apache and PHP

2002-04-27 Thread Benjamin Heckmann

I got SAPDB (7.3) to compile with the apache (1.3.24) and php (4.1.2) under AIX 
(4.3.3) without failures and it seems to run. It is quite easy after all, but I 
had to do a lot of research to get the knowledge:

---START---
cd apache
/configure
cd ../php
/configure --with-apache=../apache --with-sapdb=/usr/sapdb/depend
make
make install
cd ../apache
LIBS=/lib/libposix4.so
export LIBS
/configure --activate-module=src/modules/php4/libphp4.a
make
---STOP---

For me it worked without configuring the LIBS path. Done so, I got a compile 
error. But the guide up there was for Solaris.

The basic thing to know is the path to use for the --with-sapdb statement.

Benjamin

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




[PHP-DB] Re: Table Locking...

2001-11-27 Thread Benjamin Pflugmann

Hi.

Please stop cross-posting and use the appropriate forum.

On Wed, Nov 21, 2001 at 03:27:23PM -0700, [EMAIL PROTECTED] wrote:
> 
> (PHP-DB folks, ignore this top question - unless you want to answer)
> 
> Which type of DB/Table provides table locking while a process is
> altering data?

ISAM and MyISAM. BDB has page locking. InnoDB has row locking.

>  I don't care for locking while using SELECTs, but I do
> need locking when something's being INSERTed or UPDATEd, so I won't get
> two processes trying to do the same darned thing at the same time.

Well, the above was about implicit locking. If you use LOCK TABLE, you
will always get the whole table locked, I think.

> (MySQL folks, ignore this bottom question - unless you want to
> answer)
>
> I'm trying to go through a table and check for a particular
> information.  If it doesn't exist, then go ahead and issue an INSERT
> with the relevant data.  The next time another process comes along,
> it'll obviously find the information and issue an UPDATE instead.  But,
> what happens if I get two processes running at the same time, trying to
> find information that does not exist yet?

You will get concurrency problems.

More serious answer: There are several solutions to this problem. One
is the beforementioned LOCK TABLE.

> If both issue a SELECT and find the information not there, both will
> try to issue an INSERT, where really I want one of those processes to
> wait for the first one to finish doing whatever it needs to do, prior to
> continuing.  (all of this is being done in PHP by the way).  Does anyone
> have any suggestions for this scenario (or am I just blowing smoke out
> my arse and there's something else, internally, that I'm not aware of?)

No. You have to program your application to take care of this. How
should MySQL know that are want to issue a INSERT after the SELECT?

> When (and how) to issue some sort of "wait" state for one process while
> the other's finishing what it needs to do, then restart the second
> process (which should re-check for existing information, and not blindly
> issue another INSERT right after the first one).

Another method is assure uniqueness via keys and to simply issue the
INSERT and retry with an UPDATE if the INSERT failed (because the row
already existed). In this case you don't need LOCK TABLE.

Bye,

Benjamin.

-- 
[EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] How can I insert a binary-file into sybase dbsystem??

2001-10-23 Thread Benjamin

I'd finished install sysbase,but could not insert binary-file (pic or mp3)
into it ,why??

Thanks:)



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Images from database

2001-07-10 Thread Benjamin Bleything

Check out http://www.phpbuilder.com/columns/florian19991014.php3.  It's a 
tutorial that explains getting images in and out of databases.  It also 
describes what this myscript.php thingy does.

Good luck,
Ben

>Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
>list-help: 
>list-unsubscribe: 
>list-post: 
>Delivered-To: mailing list [EMAIL PROTECTED]
>Date: Tue, 10 Jul 2001 13:41:27 -0600
>From: Randall Barber <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>MIME-version: 1.0
>X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
>X-Priority: 3
>X-MSMail-priority: Normal
>Subject: [PHP-DB] Images from database
>
>I have seen in several places the following line:
>
>
>
>Will this tag work in both IE and Netscape?
>
>What does myScript.php do?  Does it find an image and pass the binary data 
back?
>
>Something like this--
>
>
>// Code to find get a path from a database
>
>$fp = fopen(odbc_result($qryResult, "imgPath"), "rb");
>fpassthru($fp);
>fclose($fp);
>?>
>
>Am I getting this, or am I missing the whole point?
>Thanks
>RDB


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] MySQL Error

2001-07-10 Thread Benjamin Bleything

ensure that your mysqld is actually running.  Then try running 'mysql 
-hlocalhost -uroot' if it's a new install, or add '-p' at the end if you've set 
a root password.  Alternately, specify another user after -u.

That should help.  I just figured this one out the other day... I had gone so 
far as to install phpMyAdmin solely because I couldn't get the damn mysql client 
to work.

Good Luck,
Ben

>Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
>list-help: 
>list-unsubscribe: 
>list-post: 
>Delivered-To: mailing list [EMAIL PROTECTED]
>Date: Tue, 10 Jul 2001 22:23:08 +0530
>From: Vivek Misra <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Mime-Version: 1.0
>Content-Transfer-Encoding: 7bit
>Subject: [PHP-DB] MySQL Error
>
>Dear Experts 
>
>When ever i try to run MySQL under linux it gives me following error 
>
>ERROR 2002 : can't connect to local MYSQL server through socket 
'/var/lib/mysql.sock' (111)
>
>what could be possible remedy/rectification of the above ?
>
>million thx in advance 
>
>Vivek Misra 
>
>-- 
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Re: Connection closing problem!

2001-02-10 Thread Benjamin Pflugmann

Hi.

It looks like you are using persistent connections with SQL server,
but not with MySQL (time_wait and close_wait are states of a TCP
connection after it was closed by the appliction). I don't know much
about PHP, but there is somewhere a option to influence whether you
want persistent connections or not.

Second, what is MySQL telling (mysqladmin processlist with MySQL-root
privileges). Are there sleeping connections (persistent connections)
or not (no persistent connections).

Bye,

    Benjamin.

On Mon, Feb 05, 2001 at 12:26:38PM +1100, [EMAIL PROTECTED] wrote:
> Hi, 
>   Does anyone know of or have a problem that means that the 
> HTML server will not receive the message back from the MySQL 
> server to say close the connection. 
> The two servers are on two seperate machines. 
> The html server is Apache using the PHP scripting language.
> The error messages I am getting, not so much error messages but 
> messages, when I do a netstat on the html machine state that alot 
> of the sql connections are time_wait or close_wait. This should 
> cause no problem I here you say but when the majority of the html 
> server connections are on time_wait or close_wait then the site 
> starts to slow right down. And eventually cause database server 
> busy errors for users. On the SQL server the netstat results appear 
> to be fine with the majority of them being Established. Can any 
> shed some light on this problem or even tell me of a way to fix it. If 
> any questions about the problem need to be asked I will try and 
> answer them. Thanks in advance.
> 
> Drew
> 
> Andrew Toussaint  
> Richardson-Shaw Pty Ltd 
> [EMAIL PROTECTED] 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]