[PHP-DB] error handling

2005-03-15 Thread Chenri
hello, 
how can i use error_log( ) function 
to capture the error occured in my server,
currently the Error warning is switched off
and i can't turn it on because it is in production server

the problem is the query miss some records, 
and i didn't see it's error message

beside this code 

$err=mysql_query($string);
if(!$err) {
  error_log();
}

do i can get somekind of global error handling? 
Something that can catch an error anywhere 
in the codes, 

thx

-- 
Chenri J
Taman Palem Lestari B18 - 19A
Mobile CDMA Esia: (62) (21) 926 68 651
Email: [EMAIL PROTECTED]

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



Re: [PHP-DB] Queries close session

2005-03-15 Thread Jochem Maas
Adept-Hosting.Net Administration wrote:
I am using the following script to maintain a login session on some
pages:
?php
	session_start();
	if(empty($_SESSION['username'])) {
 die('An error has ocurred. It may be that you have not
logged in,
  or that your session has expired.
  Please try a href=index.phplogging in/a again 
  or contact the 
  a href=mailto:[EMAIL PROTECTED]system
administrator/a');
	}
?

The sessions are stable and work fine EXCEPT when I run another PHP
script on the web page such as:
the script below does not call session_start()- you must call 
session_start()
on each request that you need the session data, normally people put all
their session check/start-up stuff in a seperate file and then include that
when needed:
?
require db_connect.inc;
require session.inc;
// do you queries and output the results etc!

?php
// Make a MySQL Connection
require db_connect.inc;
// Retrieve all the data from the example table
$result = mysql_query(SELECT * FROM members WHERE Status='Inactive') 
or die(mysql_error()); 

echo table border='1' cellpadding='0' cellspacing='1'
align='center';
echo tr thCertificate #/ththDan rank/ththFirst Name/th
thLast Name/th /tr;
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo trtd; 
echo $row['Cert_number'];
echo /tdtd; 
echo $row['Dan_rank'];
echo /tdtd; 
echo $row['First'];
echo /tdtd; 
echo $row['Last'];
echo /td/tr; 
} 
echo /table;

? 

I'm assuming that I am either not maintaining the session properly or
not linking the scripts to the session.
Any pointers on how to accomplish what I'm trying to do?
Thanks,
- Ken
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] variable and MySQL

2005-03-15 Thread Ross Honniball
Not entirely sure what you are wanting, but if you want a variable 
variable, just use a double $ sign. eg:

$fred = 'var2';
$var2 = 'value of var 2';
echo $$fred;
will echo 'value of var 2'
At 10:14 AM 15/03/2005, you wrote:
Hi, I'm trying to make a script but have a problem ...
How could I do this:
I'd like to use   $get_question_data[xxx_name_en]
where xxx would be a variable variable according to the situation where the
script is called... how would I do this?
tried :
$get_question_data[$test_name_en]
$get_question_data[{$test}_name_en]
${get_question_data[$test_name_en]}
but nothing works  any help would be appreciated.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

. Ross Honniball  JCU Bookshop Cairns Supervisor
. James Cook Uni, McGregor Rd, Smithfield, Qld. 4878,  Australia
. Ph:07.4042.1157  Fx:07.4042.1158   Em:[EMAIL PROTECTED]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] php and serial port

2005-03-15 Thread Rodrigo Cabeceiras
hi
can php interact whit a serial port, (example com1 - modem) and 
exchange info whit a modem(hayscommand) ?
has any one tried ?

thks
rodrigo
---
[This E-mail scanned for viruses by Declude Virus]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] recommending a PHP book?

2005-03-15 Thread Danny Lin
Can any one recommend a good book that discusses MVC design patterns with
PHP (and mySQL)?

Thanks.

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



[PHP-DB] Re: recommending a PHP book?

2005-03-15 Thread Jim Plush
Hey Danny,
no good books on that subject regarding php/mcv that I've seen but PHP 
Architecht has some good articles on MVC, I believe they have a free 
issue that has a huge article on PHP/MVC. www.phparch.com

Danny Lin wrote:
Can any one recommend a good book that discusses MVC design patterns with
PHP (and mySQL)?
Thanks.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] global var

2005-03-15 Thread H. J. Wils
Hi,
I want to use a global var, but it doesnt seem to work.
This how it should be right?
?
$txt = text;
function echo_txt()
{
  global $txt;
  echo $global;
}
?
but it doesnt work...
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] global var

2005-03-15 Thread Bastien Koert
no, that is not how it should be
?
$txt = text;
function echo_txt()
{
 global $txt;
 echo $txt;
}
?


From: H. J. Wils [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] global var
Date: Tue, 15 Mar 2005 18:38:13 +
Hi,
I want to use a global var, but it doesnt seem to work.
This how it should be right?
?
$txt = text;
function echo_txt()
{
  global $txt;
  echo $global;
}
?
but it doesnt work...
--
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] recommending a PHP book?

2005-03-15 Thread Bastien Koert
Martin Fowler is the man behind most of this style of Enterprise 
Architecture (http://www.martinfowler.com/books.html#eaa) His Pof EAA is the 
definitive book on this and is used as the model for php

bastien
From: Danny Lin [EMAIL PROTECTED]
To: php-db@lists.php.net, phpdoc@lists.php.net, 
php-general@lists.php.net,php-windows@lists.php.net
Subject: [PHP-DB] recommending a PHP book?
Date: Mon, 14 Mar 2005 19:52:57 -0500

Can any one recommend a good book that discusses MVC design patterns with
PHP (and mySQL)?
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


Re: [PHP-DB] global var

2005-03-15 Thread Henk Jan Wils
sorry, thats the way i meant it...
i have it that way, but it doesnt work... 

- Original Message - 
From: Bastien Koert [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; php-db@lists.php.net
Sent: Tuesday, March 15, 2005 7:50 PM
Subject: RE: [PHP-DB] global var


no, that is not how it should be
?
$txt = text;
function echo_txt()
{
 global $txt;
 echo $txt;
}
?


From: H. J. Wils [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] global var
Date: Tue, 15 Mar 2005 18:38:13 +
Hi,
I want to use a global var, but it doesnt seem to work.
This how it should be right?
?
$txt = text;
function echo_txt()
{
  global $txt;
  echo $global;
}
?
but it doesnt work...
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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


Re: [PHP-DB] global var

2005-03-15 Thread Vladimir Rodionov
Hi,
Shouldn't  it be echo $txt?

Vladimir.
Novosibirsk, Russia.
On Mar 16, 2005, at 00:38, H. J. Wils wrote:
Hi,
I want to use a global var, but it doesnt seem to work.
This how it should be right?
?
$txt = text;
function echo_txt()
{
  global $txt;
  echo $global;
}
?
but it doesnt work...
--
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] global var

2005-03-15 Thread J. Connolly
you need to call the function
?
$txt = text;
function echo_txt()
{
global $txt;
echo $txt;
}
?

?php
echo_txt;
?
---
i got no signature,
jzf
Henk Jan Wils wrote:
sorry, thats the way i meant it...
i have it that way, but it doesnt work...
- Original Message - From: Bastien Koert 
[EMAIL PROTECTED]
To: [EMAIL PROTECTED]; php-db@lists.php.net
Sent: Tuesday, March 15, 2005 7:50 PM
Subject: RE: [PHP-DB] global var


no, that is not how it should be
?
$txt = text;
function echo_txt()
{
 global $txt;
 echo $txt;
}
?


From: H. J. Wils [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] global var
Date: Tue, 15 Mar 2005 18:38:13 +
Hi,
I want to use a global var, but it doesnt seem to work.
This how it should be right?
?
$txt = text;
function echo_txt()
{
  global $txt;
  echo $global;
}
?
but it doesnt work...
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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


Re: [PHP-DB] global var

2005-03-15 Thread Bastien Koert
You also need to call the function
?
$txt = text;
echo_text();  //call the function
function echo_txt()
{
 global $txt;
 echo $txt;
}
?

From: J. Connolly [EMAIL PROTECTED]
To: Henk Jan Wils [EMAIL PROTECTED], PHP list php-db@lists.php.net
Subject: Re: [PHP-DB] global var
Date: Tue, 15 Mar 2005 14:09:43 -0500
you need to call the function
?
$txt = text;
function echo_txt()
{
global $txt;
echo $txt;
}
?

?php
echo_txt;
?
---
i got no signature,
jzf
Henk Jan Wils wrote:
sorry, thats the way i meant it...
i have it that way, but it doesnt work...
- Original Message - From: Bastien Koert [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; php-db@lists.php.net
Sent: Tuesday, March 15, 2005 7:50 PM
Subject: RE: [PHP-DB] global var

no, that is not how it should be
?
$txt = text;
function echo_txt()
{
 global $txt;
 echo $txt;
}
?


From: H. J. Wils [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] global var
Date: Tue, 15 Mar 2005 18:38:13 +
Hi,
I want to use a global var, but it doesnt seem to work.
This how it should be right?
?
$txt = text;
function echo_txt()
{
  global $txt;
  echo $global;
}
?
but it doesnt work...
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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


Re: [PHP-DB] global var

2005-03-15 Thread Henk Jan Wils
thnx.. it works!
- Original Message - 
From: J. Connolly [EMAIL PROTECTED]
To: Henk Jan Wils [EMAIL PROTECTED]; PHP list 
php-db@lists.php.net
Sent: Tuesday, March 15, 2005 8:09 PM
Subject: Re: [PHP-DB] global var


you need to call the function
?
$txt = text;
function echo_txt()
{
global $txt;
echo $txt;
}
?

?php
echo_txt;
?
---
i got no signature,
jzf
Henk Jan Wils wrote:
sorry, thats the way i meant it...
i have it that way, but it doesnt work...
- Original Message - From: Bastien Koert 
[EMAIL PROTECTED]
To: [EMAIL PROTECTED]; php-db@lists.php.net
Sent: Tuesday, March 15, 2005 7:50 PM
Subject: RE: [PHP-DB] global var


no, that is not how it should be
?
$txt = text;
function echo_txt()
{
 global $txt;
 echo $txt;
}
?


From: H. J. Wils [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] global var
Date: Tue, 15 Mar 2005 18:38:13 +
Hi,
I want to use a global var, but it doesnt seem to work.
This how it should be right?
?
$txt = text;
function echo_txt()
{
  global $txt;
  echo $global;
}
?
but it doesnt work...
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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

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


[PHP-DB] Re: recommending a PHP book?

2005-03-15 Thread Philip Olson



Do.  Not.  Cross.  Post.

Use ONE mailing list at a time.



Please have all further replies to this unfortunate thread
go to php-general and only php-general.

Regards,
Philip

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



[PHP-DB] Re: recommending a PHP book?

2005-03-15 Thread Jeremiah Fisher
PHP 5 Power Programming by Andi Gutmans, Stig Bakken, and Derick 
Rethans may be worth the read for you. It doesn't mention an MVC, but 
they do talk a little about patterns in PHP.

However, you probably won't find much in-depth coverage of patterns in 
PHP. There are alot of good books written on patterns in C++, Java, and 
C#, but PHP doesn't have that enterprise stigma about it.

I've nearly finished an MVC-based framework in PHP, and think that Java 
should be sincerely evaluated before you take up the endeavor. I've had 
to reinvent alot of Struts functionality. Not only that, but you'll 
probably go further with J2EE on your resume than PHP.

O'Reilly has some good books on design patterns. I picked up Head First 
myself, and though it was repetitive, it got the point across pretty 
well. You'll find that most of the code is in Java, but it should be 
easy to read if you speak PHP 5.

For a quick online reference of some common design patterns (and if you 
can read C#), you can look at this site: 
http://www.dofactory.com/Patterns/Patterns.aspx#list

Thanks,
Jeremy
Danny Lin wrote:
Can any one recommend a good book that discusses MVC design patterns with
PHP (and mySQL)?
Thanks.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] most popular places

2005-03-15 Thread Kevin

Micah Stevens [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 With mysql 4.1 you could union and then subSelect maybe? I'm not
 super-familiar with sub selects, so this code won't likely run..

There is a unwritten rule that states: If your db needs the use of unions
the db is set up poorly. You can union just about everything, that's the
whole problem of a union. I would not and I do mean not ever use a union in
my code.

I woudl need more detail on the schema to give a more abt answer to the
problem.


 But then, you're runn 4.0x so it won't run anyway. :)


 select city_id, count(city_id) as num from
 ((select city_id from members)
 UNION
 (select city_id from pictures)
 UNION
 (select city_id from reports))
 order by num





 On Friday 25 February 2005 07:08 am, Merlin wrote:
  Hi there,
 
  I am trying to do a tricky task with PHP and MySQl 4.0.x
 
  There are 3 content tables where each of them contains a city_id
  and there is a 4th table which holds the city_id and the acording
city_name
 
  Now I would like to find out the most used city names.
 
  For example:
 
  members  pictures  reports
  3  4  3
  2  9  8
  9  8  8
 
  So the most used city_ids are
  8
  3
  9
 
  To find this out would be a chelenging task, but to merge them with the
  city name is even more difficult
 
  I am working on this quite a while now and cant find a way. Maybe
someone
  of you guys could give me a smart push.
 
  Thank you for any help,
 
  Merlin

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



Re: [PHP-DB] Queries close session

2005-03-15 Thread Matt Ferris
 normally people put all
 their session check/start-up stuff in a seperate file and then include
 that
 when needed:

 ?

 require db_connect.inc;
 require session.inc;

Of course, you would want to make sure any of your included PHP files have
the .php (or equivilant) extension, thus preventing your server from
serving their full contents to people who would request them directly (as
the server won't know to parse them as PHP scripts).

-- 
Matt Ferris
[EMAIL PROTECTED]

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



Re: [PHP-DB] big data base

2005-03-15 Thread Kevin

Martin Norland [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 luis medrano wrote:
  Hi All,
 
  I need you help. I need to design a very big data base, around 900GB
  or more of information but I never had design or manage this magnitude
  of information before. I really appreciate if you can point me to
  documentation to how can do this properly  or you can help me with
  some experiance you have doing this.

 I wasn't going to chime in, but after reading some replies I feel I have
to.

 Bottom line - you need to give more details.

 The design of the database will not depend greatly on the amount of data
 inside it, unless there are operations/calculations to be done on/with
 it.  Most people talk number of rows / tables / read|write operations /
 joins / etc. when talking database design, instead of size - as with
 proper indexes, the size can affect things very little.

Ok... I don't completely agree with the Design of the database will not
depend greatly on the amount of data, unless of course I am
misinterpreting.  If the size of the data and the usage rather simple one
mind choose to ignore some of the rules when developing databases. I have
seen databases pass my desk where parts of it aren't even in 3NF (3rd degree
Normal Form). Then again, if the database is complex one might need to get
into 4NF or BCNF. Also the design when it comes down to how to organise the
database, storage wise, one might choose to seperate the database into
several pieces - store one piece here and another there. It would suggest
that the design is rather important if you do not wish to see the
performance drop like a brick in water.

Also if the data in the database is small you can easily get away with
design mistakes, like bad index and the sort. While when the data is
extensive one needs fast ways to get through the data. A table of several
tens of thousands of records or more can take a long time to process when
not having the right indexes and design schema's.

I am wondernig though that if the size of the db is anyway related to the
complexity and size of the project if PHP is the right choice of language. I
would most likely move towards something like Java. Well just a thought...


 For example - if you're designing a database to store 20GB raw movie
 files - then you might want to rethink storing the gigs of data inside
 the database, then suddenly you aren't working with a large database
 at all.

 So, if you can't give more details - you're going to have to search on
 your own.  Otherwise, you might want to speak up with some more info so
 you can get better recommendations.

 My only suggestion with the information you've given - is basically what
 Bastien said - multiple big iron and big fast hard disks / SAN.  Other
 than that, I can only suggest that you design it well

 P.S.
   - I wanted to toss in a troll reply about trying SQLLite, since it
 comes with PHP! - but that's mean
 P.P.S.
   - I was also tempted to link to a great tutorial on this - an
 arbitrary resume writing tutorial, as a mean spiteful joke about being
 in over your head - but that's just too mean.  It all depends on the
 system requirements, your budget, and your time.

Just because someone may be in over his head one shouldn't try? Didn't we
all have our first big project at some point?


 cheers,
 --
 - Martin Norland, Sys Admin / Database / Web Developer, International
 Outreach x3257
 The opinion(s) contained within this email do not necessarily represent
 those of St. Jude Children's Research Hospital.

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