Re: [PHP-DB] Time difference question...

2002-06-25 Thread szii

Watch out, though, as "direct date math" can really screw ya over
when it Daylight Savings changes (if you're not in a daylight savings
area, you're okay.)  Best bet is to use getdate() to build up the array,
modify the array elements, then mktime it.  If you just add seconds
you'll get odd results when traversing daylight savings.

-Mike

- Original Message - 
From: "Martin Clifford" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, June 25, 2002 1:47 PM
Subject: Re: [PHP-DB] Time difference question...


> Versions above just before 4.0 of MySQL can handle direct date math.
> 
> Try SELECT date_returned - date_paged FROM pagetable;
> 
> It'll work if you have values "date_returned" and "date_paged" in the table 
>"pagetable" of course :o)
> 
> HTH
> 
> Martin
> 
> >>> "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> 06/25/02 04:40PM >>>
> I am working on a Call Log application, and need to calculate time.
> For example, if a page is received at 12:00, the page is returned at 12:10,
> and the call is resolved at 14:30...  I need to be able to calculate the
> time to return the page, and also the time to resolve the call.  I am not
> sure if PHP provides a function to handle date/time math.  I know that MySQL
> can add and subtract a fixed interval to a date/time, but I am not sure if
> it can deal with math involving a pair of date/time values.  Thanks in
> advance.
> 
> Scott Nipp
> Phone:  (214) 858-1289
> E-mail:  [EMAIL PROTECTED] 
> Web:  http:\\ldsa.sbcld.sbc.com
> 
> 
> 
> -- 
> 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] Re: DB400 on AS/400

2002-06-25 Thread szii

Sorry, that was vague.  ODBC is a standard of connectivity
and IS supported by the AS/400 platform.  

With that said, if AS/400 has ODBC support and PHP has
ODBC support then the two can "talk."

-Mike

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, June 25, 2002 12:24 PM
Subject: Re: [PHP-DB] Re: DB400 on AS/400


> There's a long thread somewhere in the archives of PHPBuilder.com
> in regards to getting DB2/PHP to work on an AS/400.
> 
> -Mike
> 
> - Original Message - 
> From: "John Lim" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, June 25, 2002 12:01 AM
> Subject: [PHP-DB] Re: DB400 on AS/400
> 
> 
> > Hi Mike
> > 
> > I have heard  successful reports of using odbc to connect to db400. I have
> > not personally done so.
> > 
> > Regards, John
> > 
> > "Mike Germain" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > I am trying to do a query on a database on an AS/400. The database is in
> > > DB400 format which is simaluar to DB2. Can PHP access databases in DB400
> > via
> > > ODBC or does it only work in DB2?
> > > thx,
> > > Mike
> > >
> > >
> > >
> > 
> > 
> > 
> > -- 
> > 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] INNER JOIN by field content

2002-06-25 Thread szii

You need to have "keys" in each table to join them together.
Once you have those "keys" in place, you can match the keys
across the tables and use a WHERE clause to filter the results.

'Luck!

-Mike

- Original Message -
From: "José Moreira" <[EMAIL PROTECTED]>
To: "Php-Db" <[EMAIL PROTECTED]>
Sent: Tuesday, June 25, 2002 6:48 AM
Subject: [PHP-DB] INNER JOIN by field content


> for building my website i am implementing a tree-style data organization.
> for that i have a mysql table called 'jm_tree':
> CATID,  int(10)auto_increment  -> Index
> PARENT,  int(10)   ->the CATID of
> the 'parent' node
> TEXT,   varchar(40)  -> small
> description
> TYPEset('FOLDER','FILE','LINK','POST')   -> the type of object
>
> and for each TYPE of object i have a corresponding table like :
>
> ex.: for a TYPE 'FILE' i have a 'jm_files' table [ that has the CATID field
> also ( as a FK ) ]
> with all the files related to that node.
>
> i want to know is ( and i am perfectly aware that this in possible using
> multiple queries and PHP ) if  it's possible that in one MySQL query to
> INNER JOIN the 'jm_tree' table to the specifical table ( jm_files, jm_links,
> fo fo fo )
> according to the contents of the 'jm_tree.type'
>
> 99%-possibility-of-being-wrong-something-like-example :)
>
> SELECT * FROM jm_tree INNER JOIN jm_files IF jm_tree.type='FILE'
> INNER JOIN jm_links IF jm_tree.type='LINKS'
>
>
>
>
> Best Regards,
>
>
>
> José Moreira
> Técnico de Informática | IT Technician
> Vila Nova de Gaia, Portugal
> E-mail: [EMAIL PROTECTED]
> MSN: [EMAIL PROTECTED]
> ICQ: 136936120
> IRC: gray (irc.ptnet.org)
>
>





> --
> 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] Form not working...

2002-06-25 Thread szii

okay, couple of questions in this one... =)

First...
 is shorthand for  if you care.

With a  there is no "value" attribute.
  
   
Your "UPDATE" call via sprintf() is okay for the parameter passing,
but you're missing single quotes around the text values.

UPDATE test SET (number = 1, name = 'the Name', Desc = 'the Desc');

When dealing with PHP and DBs, the single best thing you can do is 
var_dump($your_query) and then cut-n-paste into the command line 
utility.  It is, hands down, the single easiest (and fastest) way to figure out
why your query doesn't work.

'Luck!

-Mike



- Original Message - 
From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 25, 2002 11:03 AM
Subject: [PHP-DB] Form not working...


> I am working on a "Call Log" application for our SA group.  I
> currently have the database back-end configured and working OK.  Right now I
> am working with 3 pages, one is to post new entries, the second is a log
> view of all entries, and the last is a page that updates an existing entry.
> I have the first two pages working OK.  The problem is the update page does
> not post back into the database.  
> I am working in Dreamweaver, and I am still quite new to PHP and web
> page development in general.  I am not sure what some of the DreamWeaver PHP
> code is doing, and I cannot figure out why I am not able to get the update
> page to post to the database.  The update page is connecting successfully to
> the database, because I have it's fields populated from the database for the
> entry to be updated.  One other minor issue I am having, is getting a PHP
> variable to populate a text area on the page.  Is this even possible?
> Thanks in advance, and below is the code for the problem page.
> 
> 
>  function GetSQLValueString($theValue, $theType, $theDefinedValue = "",
> $theNotDefinedValue = "") 
> {
>   $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
> 
>   switch ($theType) {
> case "text":
>   $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
>   break;
> case "long":
> case "int":
>   $theValue = ($theValue != "") ? intval($theValue) : "NULL";
>   break;
> case "double":
>   $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" :
> "NULL";
>   break;
> case "date":
>   $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
>   break;
> case "defined":
>   $theValue = ($theValue != "") ? $theDefinedValue :
> $theNotDefinedValue;
>   break;
>   }
>   return $theValue;
> }
> 
> $editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
> if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
>   $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
> }
> 
> if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"]
> == "form1")) {
>   $updateSQL = sprintf("UPDATE oncall SET sa=%s, ptime=%s, rtime=%s,
> sbcuid=%s, name=%s, problem=%s, resolution=%s, pass=%s, ctime=%s,
> duration=%s, ttrp=%s, feedback=%s, P1=%s WHERE callid=%s",
>GetSQLValueString($HTTP_POST_VARS['sa'], "text"),
>GetSQLValueString($HTTP_POST_VARS['ptime'], "date"),
>GetSQLValueString($HTTP_POST_VARS['rtime'], "date"),
>GetSQLValueString($HTTP_POST_VARS['sbcuid'], "text"),
>GetSQLValueString($HTTP_POST_VARS['name'], "text"),
>GetSQLValueString($HTTP_POST_VARS['problem'],
> "text"),
>GetSQLValueString($HTTP_POST_VARS['resolution'],
> "text"),
>GetSQLValueString($HTTP_POST_VARS['pass'], "text"),
>GetSQLValueString($HTTP_POST_VARS['ctime'], "date"),
>GetSQLValueString($HTTP_POST_VARS['duration'],
> "date"),
>GetSQLValueString($HTTP_POST_VARS['ttrp'], "date"),
>GetSQLValueString($HTTP_POST_VARS['feedback'],
> "text"),
>GetSQLValueString($HTTP_POST_VARS['P1'], "text"),
>GetSQLValueString($HTTP_POST_VARS['callid'], "int"));
> 
>   mysql_select_db($database_Test, $Test);
>   $Result1 = mysql_query($updateSQL, $Test) or die(mysql_error());
> }
> 
> $tmp = $_GET['callid'];
> mysql_select_db($database_Test, $Test);
> $query_Update = "SELECT * FROM oncall WHERE callid='$tmp'";
> $Update = mysql_query($query_Update, $Test) or die(mysql_error());
> $row_Update = mysql_fetch_assoc($Update);
> $totalRows_Update = mysql_num_rows($Update);
> ?>
> 
> 
> Untitled Document
> 
> 
> 
> 
> 
>   
>   
>   
> 
>  
>   SA name:
>   
>    
>   Call passed to:
>value="" size="32">
> 
>  
>   Time of page:
>   
>   
>   
>   
>   
> 
>  
>   Time page returned:
>   
>    
>   Call completion time:
>value="" size="32">
> 
>  
>   SBCUID of cl

Re: [PHP-DB] email format: meeting request

2002-06-25 Thread szii

You're going to have to rip open the MS-specific format and 
handbuild (or script) your PHP to custom-build that format with
the correct data fields.  While it can be done, it's a good bit of 
time and energy.

-Mike

- Original Message - 
From: "Dib, Walid (MED, Stagiaire GEMS)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 25, 2002 1:38 AM
Subject: [PHP-DB] email format: meeting request


> Hello,
> 
> I have a little bit difficult question, I need to send email under format"
> meeting request " to automatically update the calendar in outlook, how can I
> do that with PHP and what parameters use??
> 
> Thank you
> 
> Walid
> 
> -- 
> 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] A JOIN that works sometimes ?

2002-06-25 Thread szii

Make sure you're exec'ing against the correct database with identical schema.
Different MySQL versions?  Schema?  Permissions?  

var_dump() and cut'n'paste onto the server to make sure the query DOES
run, then look for remote DB connection issues, permissions, database, etc.
Are there multiple "num" fields across the two tables such that the "ORDER BY"
clause is ambiguous? Whole lot of possibilities.  Run the var_dump() query
first...it's the best place to start.

'Luck.

-Mike

- Original Message - 
From: "Christine Clerc" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 25, 2002 12:35 AM
Subject: [PHP-DB] A JOIN that works sometimes ?


> Could anyone please help me with that query ?
> 
> $req="SELECT * FROM tab AS C INNER JOIN inter AS A ON 
> C.id_tab=A.id_tab WHERE A.id_cat IS NULL OR A.id_cat = 0 ORDER BY 
> num";
> $result = mysql_query ($req,$db);
> 
> It works on my machine but not on the server.
> 
> Christine


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




Re: [PHP-DB] Re: DB400 on AS/400

2002-06-25 Thread szii

There's a long thread somewhere in the archives of PHPBuilder.com
in regards to getting DB2/PHP to work on an AS/400.

-Mike

- Original Message - 
From: "John Lim" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 25, 2002 12:01 AM
Subject: [PHP-DB] Re: DB400 on AS/400


> Hi Mike
> 
> I have heard  successful reports of using odbc to connect to db400. I have
> not personally done so.
> 
> Regards, John
> 
> "Mike Germain" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I am trying to do a query on a database on an AS/400. The database is in
> > DB400 format which is simaluar to DB2. Can PHP access databases in DB400
> via
> > ODBC or does it only work in DB2?
> > thx,
> > Mike
> >
> >
> >
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


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




Re: [PHP-DB] what the heck? (elementary question)

2002-06-25 Thread szii

One large PHP block is more efficient than multiple small blocks of 
php.

It's a tradeoff of "multiple invocations of the parser" versus having
the parse run through (and ignore) normal text.  We have run tests
inhouse that validate the performance difference is fairly small, but 
it does exist.  This was about two years ago, though, so perhaps
the engine is now a one-time invocation and my test is invalid.

-Mike

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 24, 2002 8:00 PM
Subject: Re: [PHP-DB] what the heck? (elementary question)


> Keep with Christophers original statement.
> 
> It is more efficient to not have large echo values.
> 
> gl -- Seth
> 
> [EMAIL PROTECTED] wrote:
> 
> > - Original Message - 
> > From: "Cosby, Christopher" <[EMAIL PROTECTED]>
> > 
> >>I don't want to start a tangent here, but the most accepted way for
> >>generating HTML with PHP is to NOT generate HTML with PHP.  Thus, the
> >>original code should be written like this:
> >>
> > 
> > Huh?  ".. most accepted way for generating ...is NOT generate.."?
> > Brain fart?  =)
> > 
> > I will regularly use large "echo" style statements to generate HTML, especially
> >  tags and result tables.
> > 
> > 
> >>As far as the POST/GET question, you technically can use POST and GET
> >>methods simultaneously, but it's nasty.  For best results, stay away from
> >>the register_globals functionality and use $HTTP_POST_VARS[] and
> >>$HTTP_GET_VARS[] instead.
> >>
> > 
> > Both of which are deprecated.  =(  _GET _POST are the new ones.
> > 
> > POST will allow larger form submits as well, like file uploads.  GET are for 
> > smaller and faster data sets.
> > 
> > 
> >>Go to WeSellBooksByTheMillions and buy a good PHP book for reference.  They
> >>have lots of basics like this in them.  I prefer most anything from Wrox
> >>Press (http://www.wrox.com/)
> >>
> > 
> > www.php.net
> > www.phpbuilder.com
> > 
> > RIP Computer Literacy bookstores after the Barnes and Noble acquisition.
> > 
> > -Mike
> > 
> > 
> > 
> 
> 
> -- 
> 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] PHP in Database Fields..

2002-06-24 Thread szii

I'm sorry, brainfart.

Don't exec(), eval().

Apologies.

-Mike

- Original Message - 
From: "Matthew Tedder" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, June 24, 2002 4:00 PM
Subject: Re: [PHP-DB] PHP in Database Fields..


> On Monday 24 June 2002 09:21 pm, [EMAIL PROTECTED] wrote:
> > exec() the query results.
> 
> I can't seem to get that to work...  Basically, I want to put my variables 
> into the code in order to theme HTML code within data base fields.
> 
> Consider the following for example:
> 
> $glPageFG = "#FF";
> $mystr = "Themed Text!";
> print exec($mystr);// Doesn't work
> exec($mystr);// Doesn't work
> print $mystr;  // Doesn't work after an exec(), either..
> 
> The only part of the PHP reference guide I can check online at the moment is 
> not telling me much, either..
> 
> Matthew
> 
> >
> > -Mike
> >
> > - Original Message -
> > From: "Matthew Tedder" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, June 24, 2002 2:31 PM
> > Subject: [PHP-DB] PHP in Database Fields..
> >
> > > Question:
> > >
> > > I want to put PHP code into database fields holding HTML text, how
> > > can I make it execute that PHP before sending to the browser??
> > >
> > > Currently, I get the text from MySQL and print it The browser
> > > shows the PHP code mixed into the HTML.
> > >
> > > Matthew
> > >
> > >
> > > --
> > > Anything that can be logically explained, can be programmed.
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> 
> -- 
> Anything that can be logically explained, can be programmed.
> 
> -- 
> 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] PHP in Database Fields..

2002-06-24 Thread szii

exec() the query results.

-Mike

- Original Message - 
From: "Matthew Tedder" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 24, 2002 2:31 PM
Subject: [PHP-DB] PHP in Database Fields..


> 
> Question:
> 
> I want to put PHP code into database fields holding HTML text, how can I 
> make it execute that PHP before sending to the browser??
> 
> Currently, I get the text from MySQL and print it The browser shows 
> the PHP code mixed into the HTML.
> 
> Matthew
> 
> 
> -- 
> Anything that can be logically explained, can be programmed.
> 
> -- 
> 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] Re: brand new elementary question

2002-06-24 Thread szii

Just a quick follow up...

from http://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.1
  "When there is only one single-line text input field in a form, the user agent 
should accept Enter in that field as a request to
submit the form. "


and a random link...

http://ppewww.ph.gla.ac.uk/~flavell/www/formquestion.html

'Luck.

-Mike

- Original Message -
From: "Martin Clifford" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, June 24, 2002 1:56 PM
Subject: [PHP-DB] Re: brand new elementary question


> If your form is up to standards, then hitting the enter key on any field, with the 
>exception of textarea, should submit the form.
If you are using an image for your submit button via the  tag, 
then you'd have to tab until on the image before
hitting enter for it to work.
>
> HTH
>
> Martin
>
> >>> Seth Yount <[EMAIL PROTECTED]> 06/24/02 03:58PM >>>
> initially I would look at your button type in the source code.  Their
> are two basic types of buttons, the ' submit ' and the ' clear form '.
>
> If that doesn't work, post back
>
> gl -- Seth
>
> Matthew Crouch wrote:
>
> > got my other one sorted out; thanks everyone.
> > now:
> > how do i get it so when you hit "enter" on the keyboard it's the same as
> > hitting the "submit" button with the mouse? When I hit enter, it clears
> > my form and reloads the current page.
> >
> >
>
>
> --
> 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] what the heck? (elementary question)

2002-06-24 Thread szii

- Original Message - 
From: "Cosby, Christopher" <[EMAIL PROTECTED]>
> I don't want to start a tangent here, but the most accepted way for
> generating HTML with PHP is to NOT generate HTML with PHP.  Thus, the
> original code should be written like this:

Huh?  ".. most accepted way for generating ...is NOT generate.."?
Brain fart?  =)

I will regularly use large "echo" style statements to generate HTML, especially
 tags and result tables.

> As far as the POST/GET question, you technically can use POST and GET
> methods simultaneously, but it's nasty.  For best results, stay away from
> the register_globals functionality and use $HTTP_POST_VARS[] and
> $HTTP_GET_VARS[] instead.

Both of which are deprecated.  =(  _GET _POST are the new ones.

POST will allow larger form submits as well, like file uploads.  GET are for 
smaller and faster data sets.

> Go to WeSellBooksByTheMillions and buy a good PHP book for reference.  They
> have lots of basics like this in them.  I prefer most anything from Wrox
> Press (http://www.wrox.com/)

www.php.net
www.phpbuilder.com

RIP Computer Literacy bookstores after the Barnes and Noble acquisition.

-Mike



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




Re: [PHP-DB] Works with one server and not the other

2002-06-24 Thread szii

MySQL doesn't support subselects.

Look up mysql_insert_id().  It'll return the ID of the last inserted record.

Or just break out the second INSERT statement into one "SELECT" 
and then the actual INSERT.

-Mike

- Original Message - 
From: "Christine Clerc" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 24, 2002 2:48 PM
Subject: [PHP-DB] Works with one server and not the other


> Hi,
> 
> I want to populate two related tables : here is the code
> 
> include ("connect.php");
> $req="select * from tab where num='$mod'";
> $result=mysql_query($req,$db);
> 
> if ($ligne=mysql_fetch_array($result))
> 
> //if the data is already there do nothing
> {continue;}
> //otherwise put it in table 1
> $req2="INSERT INTO tab (num) VALUES ('$mod')";
> $result2=mysql_query($req2,$db);
> 
> //and then add the relational element to table 2
> $req4="INSERT INTO inter (id_tab) SELECT id_tab FROM 
> tab WHERE num='$mod'";
> $result4=mysql_query($req4, $db);
> 
> The first part works fine on both servers (table 1)
> Table 2 fills up fine on my machine but not on the server wher it is 
> supposed to go !
> 
> Any idea ?
> 
> Christine


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




Re: [PHP-DB] check two tables at same time?

2002-06-24 Thread szii

SQL JOINs...

http://www.mysql.com/doc/J/O/JOIN.html

-Mike

- Original Message - 
From: "Noah Spitzer-Williams" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 24, 2002 4:21 PM
Subject: [PHP-DB] check two tables at same time?


> hey guys,
> 
> im trying to figure out a query that i can return rows from more than
> one table at a time. for example, i have two identical tables in structure
> and i want to return rows from both using one query. maybe this will help:
> 
> select * from table1 and table2 where condition='value'
> 
> is there any way to do this?
> 
> thanks!
> 
> - Noah
> 
> --
> TradeMyTraffic! Web Services
> http://www.trademytraffic.com
> 
> 
> 
> 
> -- 
> 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] got it, thanks

2002-06-24 Thread szii

Because it's not $s in the context of a printf() call.  It is %s to denote a
string replacement.

-Mike

- Original Message - 
From: "Matthew Crouch" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 24, 2002 12:41 PM
Subject: [PHP-DB] got it, thanks


> 
> 
> Seth Yount wrote:
> 
> > in you print statement you have ?lastname=%s, shouldn't that be '$s'
> > denoting a variable being passed?  Try that out.
> >
> > gl -- Seth
> >
> > Matthew Crouch wrote:
> >
> > > this bit from my index page is giving me 2 headaches:
> > > 1. it isn't passing anything into the URL
> > > 2. the page that gets called ("name.php") sits and tries to load
> > > forever. it looks like it's even filling up my hard drive with data (?!)
> > >
> > > Note: it does this (#2) even if I type in the URL with a variable and
> > > value, like "name.php?lastname=smith"
> > >
> > >  > > printf ("",
> > > $lastname);
> > > ?>
> > > 
> > >   
> > >   
> > > 
> > >   
> > > 
> > >
> 
> 
> -- 
> 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] String datetime to DateTime

2002-06-20 Thread szii

Hmm...odd.  I guess their %s (yes that was a typo) looks for a space
as a delimiter and not the specified next one.

Easiest workarounds off the cuff...
1)  sscanf() to get the bulk of the data out, then regex out the %s string.
2)  eregi_replace() Jun with the numeric
3)  Dump it as numeric instead of a string month name
4)  eregi_replace() the /'s with spaces then sscanf() it.

'Luck

-Mike

- Original Message - 
From: "Glenn Holden" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 20, 2002 8:48 AM
Subject: Re: [PHP-DB] String datetime to DateTime


> Thanks for the help, Mike.
> Trouble with sscanf...
> 
> Incidentally I changed the $s in the format string to %s, I think that was a
> typo. :-)
> 
> $str = "12/Jun/2002:01:02:26 -0600";
> $newstr = sscanf($str,"%d/%s/%d:%d:%d:%d
> %s",$day,$mon,$year,$hour,$min,$sec,$offset);
> 
> The trouble I'm having is with the first %s.  It doesn't see the next
> delimiter so it puts the remaining text up to the next space into the $mon
> string.
> result:
> $day = 12
> $mon = Jun/2002:01:02:26
> other variables are empty
> 
> Looking at php help online, there was a spanish user comment that seemed to
> be the same problem.  And even though I can't read spanish, it looks like
> only a work around was suggested.
> 
> I can work around this further but does anyone have a solution using sscanf?
> I'm not too clear on the acceptable syntax for the format string. Some
> comments intimate that I could use regular expressions withing there, but it
> doesn't seem to work either.
> 
> Thanks in advance for any thoughts.
> Glenn
> 
> 
> 
> 
> <[EMAIL PROTECTED]> wrote in message
> news:046401c217fb$56310b00$[EMAIL PROTECTED]...
> > DateTime formats are closer to what you have.
> > strtotime() will give you an unsigned integer(ususally long/32bit) for the
> > number of seconds since the unix epoch.
> >
> > Automagically from what you have to mySQL DateTime...nope...not that I can
> think of or find.
> > If you have the Unix timestamp in ulong format, you can use date() to put
> it in the correct format.
> >
> > Obvious workaround...
> >
> > MySQL retrieves and displays DATETIME values in '-MM-DD HH:MM:SS'
> format.
> > The supported range is '1000-01-01 00:00:00' to '-12-31 23:59:59'.
> >
> > $str = "12/Jun/2002:01:02:26 -0600";
> > $newstr = sscanf($str,"%d/%s/%d:%d:%d:%d
> $s",$day,$mon,$year,$hour,$min,$sec,$offset);
> > $newdatestr = 
> >
> > I never noticed that it didn't store the GMT offset before.  heh.
> >
> > 'Luck
> >
> > -Mike
> >
> >
> > - Original Message -
> > From: "Glenn Holden" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, June 19, 2002 3:58 PM
> > Subject: [PHP-DB] String datetime to DateTime
> >
> >
> > > Hello All!
> > >
> > > I have a unix time stamp in string format like this:
> > >
> > > 12/Jun/2002:01:02:26 -0600
> > >
> > > I am trying to turn that back into a mySQL DateTime value.  I've
> > > experimented with strtotime with no luck.  I'm not really sure if that's
> > > what it's for.
> > >
> > > I can, of course, parse the string manually to build a datetime that
> MySQL
> > > will accept, but isn't there a function that handles this?
> > >
> > > How do -you- do this?
> > >
> > > Thanks!
> > > -Glenn
> > >
> > >
> > >
> > > --
> > > 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] xml doc validation .... details ...... ! ! ! !

2002-05-20 Thread szii

Your questions are far too vague and XML/XML:Schema/XSLT etc
are far too complicated to explain without definitive focus'd questions.

XML allows you to do whatever YOU want in whatever format
YOU want. 

Best help I can give is this...

http://www.w3.org/

'Luck

-Szii

- Original Message - 
From: "toby z" <[EMAIL PROTECTED]>
To: "php db" <[EMAIL PROTECTED]>
Sent: Monday, May 20, 2002 6:52 PM
Subject: [PHP-DB] xml doc validation  details .. ! ! ! ! 


> well  its something like 
> 
> i need to take user input and store it somewhere 
> and then retrieve it back thru DOM 
> 
> and i guess i need to store that input in an xml
> doccument like the one i sent earlier 
> or do i 
> 
> now the thing that im most concerned bout is .
> this doccument or anyother that i try tomake using the
> scheema doesent get validated 
> i keep getting an error fo one of the fields for each
> .
> 
> i've tried changing the field types  but ...
> even that doesnt change anything ..
> 
> 
> secondly  i made a single scheema . and i
> included all the elements in it .
> user-info, content-info, categry,..
> with all their subelements .
> i think im right  or am i 
> 
> third .i have a few elements in the scheema that
> are repeated .
> 
> do u think that cud be the problem  ?
> 
> so thats it ...
> if u want me to tell u more  plz do let me know
> 
> 
> thnx a million 
> 
> toby 
> 
> 
> 
> 
> __
> Do You Yahoo!?
> LAUNCH - Your Yahoo! Music Experience
> http://launch.yahoo.com
> 
> -- 
> 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] replication questions

2002-05-20 Thread szii

>From the mySQL Replication docs...

snip
--
In Version 3.23.15, all of the tables and databases will be replicated.
Starting in Version 3.23.16, you can restrict replication to a set of databases
with replicate-do-db directives in `my.cnf' or just exclude a set of
databases with replicate-ignore-db.
--

Two-way replication is not supported yet.

http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#Replication

'Luck

-Szii

- Original Message - 
From: "Jeff Field" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, May 20, 2002 6:03 PM
Subject: [PHP-DB] replication questions


> I think I understand how to set up replication but have a couple unanswered
> questions. I'm hoping the list can help.
> 
> I have two servers with MySQL.  Each server currently has completely
> different databases, except for the standard mysql permissions database.
> Server 1 is in production and server 2 is basically a development box.  I
> would like to replicate server 1's databases to server 2 (in effect,
> creating a hot-swap), but then that would mean that server 2 not only has
> the production db's, but also the development db's.  My  question are:
> 
> 1) Is that even possible to do?  Can a slave to a master also have
> additional db's on it that the master doesn't even know about?
> 
> 2) If the answer to question one is yes, then what do you do regarding the
> mysql permissions db on the slave?
> 
> BTW, I'm thinking that my setup perhaps has to be more along the following
> lines:
> 
> The master contains all my db's, both production and development.  The
> production db's (as well as the development db's) would sit there in
> production on server 1, replicating all the data to server 2.  I would have
> to set the permissions for both production and development db's on server 1.
> 
> Meanwhile, as the production server is sitting there and replicating all
> it's important data to the development box, I could still work on the
> development db's on the slave box (thereby not fooling around with the
> production box).
> 
> The issue, as I see it, would be that the slave box's development db's would
> soon go out of synch with the development db's on the master (because I'd be
> inserting, updating, etc. records on the development db's on the slave and
> the master would never know).  I could set up two-way replication, but since
> I don't really care about the development db's being in synch on the master,
> why bother.  Does this make sense?
> 
> Anyway, I hope I've made this clear enough for someone to jump with answers
> and comments.
> 
> Jeff
> 
> 
> -- 
> 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] JOIN statement not producing expected output

2002-05-20 Thread szii

If you're looking to do cross-table joins, I'd advise a good book/class
on basic SQL or you're going to get in over your head very very quickly.

SELECT * FROM table1,table2; 

This WILL run, but there's no where clause.  Therefore it will return all
of table1 matched against all of table 2.

SELECT * FROM table1,table2 WHERE table1.col1 = table2.col2;
will limit your result set to the match of the two tables (and is an implicit
INNER JOIN call.)

The SQL language is (mostly) database independant.  Here's a link
to the mySQL website which'll give some basic info on SELECTs.
http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#SELECT

'Luck

-Szii

- Original Message - 
From: "admin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, May 20, 2002 5:48 PM
Subject: [PHP-DB] JOIN statement not producing expected output


> Okay, now this is my first try on fetching data from two tables, and frankly
> I'm starting to pull my hair out ;)
> 
> All I want is to fetch some data from two seperate tables in my database.
> 
> So far I have tried different approches, and below is what I think should
> work, but doesn't :(
> 
> SELECT * FROM table1,table2
> 
> This I pasted into phpmyadmin, and it outputted two rows from table2 with
> ekstra columns at the tail of each row. These ekstra columns was just the
> same output from table2.
> 
> Now I have searched the web, but have not found a simple solution for my
> problem.
> 
> Any ideas?
> 
> If you need more info, please let me know :)
> 
> -Lasse
> 
> 
> 
> 
> -- 
> 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] DB and eval. HELP !!!

2002-05-20 Thread szii

I'm sorry, I'm having an "off day."  This'll be my last post on the
subject.  *sigh*  Apologies up front...

while($website = mysql_fetch_array($result))
{
  $text = "You can go here:  " . $website['originalDomain'] . " and 
find information";
  echo $text;
}

I'll shut up now...  :)

-Szii


- Original Message -
From: <[EMAIL PROTECTED]>
To: "Bogdan ROMAN" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, May 20, 2002 11:21 AM
Subject: Re: [PHP-DB] DB and eval. HELP !!!


> Oops, minor oversights on my part.
>
> If you're calling eval() in the context of a PHP script, you
> don't have to  the eval'd code...
>
> > foreach($website = mysql_fetch_array($result))
> > {
> >   $text = "You can go here: $website['originalDomain'] and find 
>information";
> > }
>
> The above code doesn't even require an eval() call.
>
> Apologies for the confusion..
>
> -Szii
>
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: "Bogdan ROMAN" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Monday, May 20, 2002 11:11 AM
> Subject: Re: [PHP-DB] DB and eval. HELP !!!
>
>
> > foreach($website = mysql_fetch_array($result))
> > {
> >   $text = "You can go here:  and 
>find information";
> >   eval($text);
> > }
> >
> > You get the idea...
> >
> > 'Luck
> >
> > -Szii
> >
> > - Original Message -
> > From: "Bogdan ROMAN" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, May 20, 2002 5:16 AM
> > Subject: [PHP-DB] DB and eval. HELP !!!
> >
> >
> > Hello
> >
> > I busted my a$$ out to figure it out but i had to ask for help.
> >
> > Considering you have this line in a DB (TEXT field):
> >
> > You can go here:  and find 
>information
> >
> > That needs to be output in a html webpage between two  tags.
> >
> > How can you eval the  to the contents of 
>$website['originalDomain'] ?
> >
> > I've tried this:
> >
> > print ''.preg_replace( "'<\?=(.*?)\?>'esi", '\\1', $row['title'] ).''
> >
> > Where $row is the result from mysql_fetch_assoc() function and 'title' is the 
>field containing the above line. If i use the
above
> > line of code (with preg_replace) or if i simply try to eval the code i get errors 
>like:
> >
> > Warning: Unexpected character in input: '\' (ASCII=92) state=1 in 
>h:\wwwroot\work\site\website_gen.php(41) : regexp code on line
1
> >
> > Parse error: parse error, unexpected $ in h:\wwwroot\work\site\website_gen.php(41) 
>: regexp code on line 1
> >
> > Fatal error: Failed evaluating code: $website[\'originalDomain\'] in 
>h:\wwwroot\work\site\website_gen.php on line 41
> >
> > As you note, it automatiaclly adds slashes to the ['originalDomain']. I tried to 
>remove them with stripslashes() or even again
> > preg_replace() but doesnt work.
> >
> > Please help !!!
> > Thank you,
> >
> > Bogdan
> >
> >
> > Bogdan Roman
> >
> >
> > email:[EMAIL PROTECTED]
> > msn:[EMAIL PROTECTED]
> > yahoo:bogdanbog
> > website:http://bog.ath.cx
> >
> >
> >
> > --
> > 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] DB and eval. HELP !!!

2002-05-20 Thread szii

Oops, minor oversights on my part.

If you're calling eval() in the context of a PHP script, you
don't have to  the eval'd code...

> foreach($website = mysql_fetch_array($result))
> {
>   $text = "You can go here: $website['originalDomain'] and find 
>information";
> }

The above code doesn't even require an eval() call.

Apologies for the confusion..

-Szii

- Original Message -
From: <[EMAIL PROTECTED]>
To: "Bogdan ROMAN" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, May 20, 2002 11:11 AM
Subject: Re: [PHP-DB] DB and eval. HELP !!!


> foreach($website = mysql_fetch_array($result))
> {
>   $text = "You can go here:  and 
>find information";
>   eval($text);
> }
>
> You get the idea...
>
> 'Luck
>
> -Szii
>
> - Original Message -
> From: "Bogdan ROMAN" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, May 20, 2002 5:16 AM
> Subject: [PHP-DB] DB and eval. HELP !!!
>
>
> Hello
>
> I busted my a$$ out to figure it out but i had to ask for help.
>
> Considering you have this line in a DB (TEXT field):
>
> You can go here:  and find 
>information
>
> That needs to be output in a html webpage between two  tags.
>
> How can you eval the  to the contents of 
>$website['originalDomain'] ?
>
> I've tried this:
>
> print ''.preg_replace( "'<\?=(.*?)\?>'esi", '\\1', $row['title'] ).''
>
> Where $row is the result from mysql_fetch_assoc() function and 'title' is the field 
>containing the above line. If i use the above
> line of code (with preg_replace) or if i simply try to eval the code i get errors 
>like:
>
> Warning: Unexpected character in input: '\' (ASCII=92) state=1 in 
>h:\wwwroot\work\site\website_gen.php(41) : regexp code on line 1
>
> Parse error: parse error, unexpected $ in h:\wwwroot\work\site\website_gen.php(41) : 
>regexp code on line 1
>
> Fatal error: Failed evaluating code: $website[\'originalDomain\'] in 
>h:\wwwroot\work\site\website_gen.php on line 41
>
> As you note, it automatiaclly adds slashes to the ['originalDomain']. I tried to 
>remove them with stripslashes() or even again
> preg_replace() but doesnt work.
>
> Please help !!!
> Thank you,
>
> Bogdan
>
>
> Bogdan Roman
>
>
> email:[EMAIL PROTECTED]
> msn:[EMAIL PROTECTED]
> yahoo:bogdanbog
> website:http://bog.ath.cx
>
>
>
> --
> 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] problems 'adding' to MySQL DBs

2002-05-20 Thread szii

Here's a hint...ALWAYS use proxies for your query strings.

$query = "insert into firsttab (first_name, last_name) values
 ('$first_name', '$last_name')";
mysql_query($query);

var_dump($query);  // copy output and paste into the mysql
   // command line interface.

You can also use the mysql_error() and mysql_errno() calls
to see what went wrong.

-Szii

- Original Message - 
From: "cin" <[EMAIL PROTECTED]>
> 
> 
>  mysql_connect("localhost", "test", "testpw");
> mysql_select_db("testdb");
> msyql_query("insert into firsttab (first_name, last_name) values
> ('$first_name', '$last_name')");
> print ($first_name);
> print (" ");
> print ($last_name);
> print ("");
> print ("blah blah blah");
> ?>
> 
> 
> 
> i have used the appropriate grant privileges to ensure said user can indeed
> do the requested action in the script.
> 
> 
> any help is appreciated.
> 
> 
> thanks.
> 
> 
> cin
> 
> 
> 
> 
> -- 
> 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] DB and eval. HELP !!!

2002-05-20 Thread szii

foreach($website = mysql_fetch_array($result))
{
  $text = "You can go here:  and find 
information";
  eval($text);
}

You get the idea...

'Luck

-Szii

- Original Message -
From: "Bogdan ROMAN" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, May 20, 2002 5:16 AM
Subject: [PHP-DB] DB and eval. HELP !!!


Hello

I busted my a$$ out to figure it out but i had to ask for help.

Considering you have this line in a DB (TEXT field):

You can go here:  and find information

That needs to be output in a html webpage between two  tags.

How can you eval the  to the contents of 
$website['originalDomain'] ?

I've tried this:

print ''.preg_replace( "'<\?=(.*?)\?>'esi", '\\1', $row['title'] ).''

Where $row is the result from mysql_fetch_assoc() function and 'title' is the field 
containing the above line. If i use the above
line of code (with preg_replace) or if i simply try to eval the code i get errors like:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in 
h:\wwwroot\work\site\website_gen.php(41) : regexp code on line 1

Parse error: parse error, unexpected $ in h:\wwwroot\work\site\website_gen.php(41) : 
regexp code on line 1

Fatal error: Failed evaluating code: $website[\'originalDomain\'] in 
h:\wwwroot\work\site\website_gen.php on line 41

As you note, it automatiaclly adds slashes to the ['originalDomain']. I tried to 
remove them with stripslashes() or even again
preg_replace() but doesnt work.

Please help !!!
Thank you,

Bogdan


Bogdan Roman


email:[EMAIL PROTECTED]
msn:[EMAIL PROTECTED]
yahoo:bogdanbog
website:http://bog.ath.cx



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




Re: [PHP-DB] PHP/MySQL and inserting blob data?

2002-05-09 Thread szii

$escdata = addslashes($data);

UPDATE 
Blabla
SET
value = '$escdata'
WHERE...

Make sure you use addslashes, though.  It's important.

'Luck

-Szii

- Original Message - 
From: "Hadmut Danisch" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 09, 2002 1:06 PM
Subject: [PHP-DB] PHP/MySQL and inserting blob data?


> 
> Hi,
> 
> can anyone give me a hint how to insert
> random blob data into a MySQL database?
> 
> Just a plain query like
> 
>   update Blabla set value=$data where... 
> 
> doesn't seem to be the right way, because
> in this case the variable is substituted and 
> will crash the sql statement.
> 
> regards
> Hadmut
> 
> -- 
> 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] need help on improving performance on this querry

2002-05-07 Thread szii

SELECT DISTINCT L.*
from data.languages L, data2.user U
WHERE L.id IN (U.language_1, U.language_2, U.language_3)
order by name;

I believe the IN clause is a shade faster than multiple ORs, but 
I'm not 100% sure.

'Luck

-Szii 

- Original Message - 
From: "andy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 07, 2002 9:38 AM
Subject: [PHP-DB] need help on improving performance on this querry


> Hi there,
> 
> I do have a user table with 3 languages. I know that I should have put them
> into a seperate table. I still could, but would take lots of recoding. I
> discovered, that as soon as I leave out the OR statements the querry takes
> under 0.2 s. With the two OR it takes on a 1 records about 1.4 s.
> 
> Is there a way to increase the performance with a different querry? I did
> already index the fields, but does not look much better though.
> 
> SELECT DISTINCT L.*
> from data.languages L, data2.user U
> where
>   L.id = U.language_1
>   or L.id = U.language_2
>   or L.id = U.language_3
> order by name
> 
> Thanx for any help,
> 
> Andy
> 
> 
> 
> -- 
> 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] sql querry problem

2002-05-03 Thread szii

"Delete from" does not work with multiple tables, AFAIK..

-Szii

- Original Message - 
From: "andy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 03, 2002 2:02 AM
Subject: [PHP-DB] sql querry problem


> Hi there,
> 
> I do have 2 tables. One contains an update for the other one. Before
> inserting I would like to delete all the entries in the old table containing
> the same country_code like one in the new table.
> 
> I tryed:
> 
> delete o.*
> from Cities_update_imported n, test.cities o
> where n.country_code = o.country_code
> 
> But does not work though:-(
> 
> can anybody help on that?
> 
> thanx, Andy
> 
> 
> 
> 
> -- 
> 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] Re: Spaces Problem php & mysql

2002-05-02 Thread szii

AddSlashes() or AddCSlashes()

-Szii

- Original Message - 
From: "Paul" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 02, 2002 4:11 PM
Subject: Re: [PHP-DB] Re: Spaces Problem php & mysql


> On Thursday 02 May 2002 10:10 am, you wrote:
> > - Original Message -
> > From: "Hugh Bothwell" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, May 02, 2002 6:23 AM
> > Subject: [PHP-DB] Re: Spaces Problem php & mysql
> >
> > > > I've been pounding my head (and the keyboard with searches) over this.
> > > > Do
> > >
> > > I
> > >
> > > > have to take the first entry apart with string functions to get my
> > > > desired end, which is the entire name in one field in the database?
> > >
> > > ... make sure the value is enclosed in quotes when you try
> > > to insert it into the database, ie
> > >
> > > INSERT INTO table ( name ) VALUES ( '$name' )
> >
> > Make sure you escape out all single quotes in $name.
> >
> > $name = " This is Paul's field."
> > .
> > .
> > .
> > INSERT INTO table ( name ) VALUES ( '$name' )
> >
> > Will fail, because you have VALUES ('This is Paul');
> >
> > Post the full value of $name via var_dump($name) and
> > var_dump($query) and we'll see what we can find with it.
> >
> > 'Luck
> >
> > -Szii
> Thank you David and Szii. The urlencode solved the sending problem. But I've 
> had in the back of my mind to remember to deal with apostrophe's in names for 
> some time and just haven't done it. Good reminder. Is there any easier way to 
> do this than looping through each character in a string?
> 
> Paul


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




Re: [PHP-DB] Global Connection object

2002-05-02 Thread szii

Probably.  However, you'll have to global($connection_obj) in each function
to allow access to that.  I think newer versions of PHP have an auto registering
global namespace, however, and you may not need that global() call anymore.

Why would you want to?  I believe the PHP/Zend engine has pooling capabilities,
so it's not really any overhead to "reconnect."  If no pooling is available, then you
limit yourself (and your webserver) to a single connection. (Will kill your 
performance.)

HTH.

'Luck

-Szii

- Original Message - 
From: "Shaun Johnston" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 01, 2002 5:03 PM
Subject: [PHP-DB] Global Connection object


> Is it possible to make a MySQL connection object global, so that it doesn't
> need to be declared as a parameter to be accessed from individual functions?
> 
> 
> 
> -- 
> 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] Re: Spaces Problem php & mysql

2002-05-02 Thread szii

- Original Message - 
From: "Hugh Bothwell" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 02, 2002 6:23 AM
Subject: [PHP-DB] Re: Spaces Problem php & mysql


> > I've been pounding my head (and the keyboard with searches) over this. Do
> I
> > have to take the first entry apart with string functions to get my desired
> > end, which is the entire name in one field in the database?
> 
> ... make sure the value is enclosed in quotes when you try
> to insert it into the database, ie
> 
> INSERT INTO table ( name ) VALUES ( '$name' )

Make sure you escape out all single quotes in $name.

$name = " This is Paul's field."
.
.
.
INSERT INTO table ( name ) VALUES ( '$name' )

Will fail, because you have VALUES ('This is Paul');

Post the full value of $name via var_dump($name) and
var_dump($query) and we'll see what we can find with it.

'Luck

-Szii


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




Re: [PHP-DB] Session Problem, Please Help.....

2002-05-02 Thread szii

I believe it's because $CLIENTID is not set at ALL before you 
register it.  (ie, isset($CLIENTID) would fail)  Therefore it cannot
register the variable...there's nothing for it to register or track.

Try...

$CLIENTID = "";
session_register("CLIENTID");
$CLIENTID="SOMEVALUE";

- Original Message - 
From: "Hayan AL Mamoun" <[EMAIL PROTECTED]>
To: "PHPList (E-mail)" <[EMAIL PROTECTED]>
Sent: Thursday, May 02, 2002 3:15 AM
Subject: [PHP-DB] Session Problem, Please Help.


> Dear all, I have a strange problem:
> I'm using IIS / WINNT4, PHP4
> Please check these two files:
> --
> logon.phtml:
>  session_start();
> session_register("CLIENTID");
> $CLIENTID="SOMEVALUE";
> header("Location: clients/editclient.phtml");
> ?>
> --
> clients/editclient.phtml:
>  session_start();
> echo "CLient ID VALUE IS : $CLIENTID";
> ?>
> 
> When I run logon.phtml, it must create a session variable called CLIENTID
> and then move to the second page, which displays this variable.
> Each time I test this code I start a new instant of the IE and request
> logon.phtml (in order to create a new session), but it never works from the
> first time, while if I tested it a second time from the same instance of IE
> it works???!
> Please could anyone help, why it dosn't work from the first time?
> 
> thnkx
> Hayan
> 
> 
> -- 
> 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] selected problem

2002-04-26 Thread szii

When you build the list up, originally, you'll NOT put "selected" on Choose City, but
move it to "Alexandria."

-Szii

- Original Message - 
From: "its me" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 26, 2002 1:39 AM
Subject: [PHP-DB] selected problem


> i have the file:
> edit_profile.php
> 
> in it i have a form field like this:
> 
>Choose Cityvalue=10-Ramadan>10-Ramadanvalue="15 May">15 Mayvalue=6-October>6-Octobervalue="Abou Redes">Abou Redesvalue=Abou-Zabal>Abou-Zabalvalue="Al Arish">Al Arishvalue="Al Mahala">Al Mahalavalue="Al Tour">Al Tourvalue=Al-Natroun>Al-Natrounvalue=Alexandria>Alexandriavalue=Asuit>Asuitvalue=Aswan>Aswanvalue=Bader>Badervalue=Bani-Sweif>Bani-Sweifvalue=Belbis>Belbisvalue="Berkeit sabb">Berkeit sabbvalue=Cairo>Cairovalue=Dahab>Dahabvalue=Damanhour>Damanhourvalue=Disouk>Disoukvalue=Dumiat>Dumiatvalue="Ein Soukhna">Ein Soukhnavalue="El- Maniea">El- Manieavalue=Fayed>Fayedvalue=Fayoum>Fayoum High 
>   Dam Hurghada 
>   Inshasvalue=Ismaelia>Ismaeliavalue="Kafr Al Shiek">Kafr Al Shiekvalue=Katamia>Katamiavalue=Luxor>Luxorvalue=Mansoura>Mansouravalue=Marabella>Marabellavalue=Maraquia>Maraquiavalue="Marsa matrouh">Marsa matrouhvalue="Met Ghamr">Met Ghamrvalue=Monofia>Monofiavalue=Moustorod>Moustorodvalue=Nubieh>Nubiehvalue="Oubour City">Oubour Cityvalue="Port Sayed">Port Sayedvalue="Qanater El Khiraya ">Qanater El Khiraya 
>   Qliubvalue=Quana>Quanavalue=Quesna>Quesnavalue=Rafah>Rafah Ras 
>   Sidr Sadat 
>   City Saqaravalue="Sedi Krier">Sedi Kriervalue="Sharm el Shiek">Sharm el Shiekvalue="Shebin Al Koum">Shebin Al Koumvalue=Suhag>Suhagvalue=Suiez>Suiezvalue=Taba>Tabavalue=Tanta>Tantavalue=Tebin>Tebinvalue=Zafrana>Zafranavalue=Zagazik>Zagazik
>  
> 
> as you can see there is many options:)
> 
> and i got from my database:
> $location="Alexandria"
> so i wanted to appear selected,how can i do this??
> 
> 
> 
> 
> 
> 
> Rehab M.Shouman
> 
> 
> 
> 
> 
> -
> Express yourself with a super cool email address from BigMailBox.com.
> Hundreds of choices. It's free!
> http://www.bigmailbox.com
> -
> 
> -- 
> 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] FORM not inserting data

2002-04-26 Thread szii

put in a "var_dump($sql);die();"  right after

  $result = mysql_query($sql);

Then copy/paste it into mysql's command line util, and see what
you get.

-Szii

- Original Message -
From: "Neil" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 25, 2002 6:34 PM
Subject: [PHP-DB] FORM not inserting data


Help. Help

Please, Please tell me what I am  doing wrong here...I have a form to input data but 
it is not posting ithere is the code. It
seems to work no errors but a query show no new additions to the table.

$sql = "INSERT INTO employees (first,last,address,date_of_birth,sex,age,telephone,

parent_guardian_name,parent_guardian_workplace,work_telephone,emergency_information_contact,

list_physical_conditions_if_any,all_schools_previously_attended,examinations_passed,older_brothers,younger_brothers,older_sisters,yo
unger_sisters,
 names_sisters_or_brothers_attending_school) VALUES
('$first','$last','$address','$date_of_birth',$sex','$age','$telephone','$parent_guardian_name','$parent_guardian_workplace',

'$work_telephone','$emergency_information_contact','$list_physical_conditions_if_any','$all_schools_previously_attended','$examinati
ons_passed','$older_brothers','$younger_brothers','$older_sisters','$younger_sisters','$names_sisters_or_brothers_attending_school')
";
  $result = mysql_query($sql);
  echo "Thank you! Information entered.\n";
} else{

  // display form

  ?>



Neil



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




Re: [PHP-DB] Mssql/Sybase errors

2002-04-25 Thread szii

hehehe, you recoded PHP to reconnect to MSSQL, but you forgot
to redo your connection stuff.  "Sybase error:" means that you're 
connecting to Sybase and not MSSQL.  *wink*

'Luck

-Szii

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 25, 2002 10:18 AM
Subject: [PHP-DB] Mssql/Sybase errors


> Hello.
> 
> I have recently installed the freetds package and reconfigured PHP to
> connect to MSSQL.  I am running a simple join query on two tables and I get
> the following error.
> Warning:  Sybase error:  'REQ' is not a recognized OPTIMIZER LOCK
> HINTS option. (severity 15) in  myFile.php on line 29
> 
> REQ is one of the tables in the database.  here is the query, which works
> fine in MS Query Analyzer.  Anyone run up against this problem?
> 
> mssql_query("select REQ.DESCR, BUSINESS_AREA.DESCR, REQ_NUM from REQ INNER
> JOIN BUSINESS_AREA".
> "ON (REQ.BUSINESS_AREA = BUSINESS_AREA.BUSINESS_AREA) WHERE
> REQ.BUSINESS_AREA = '$area'");
> 
> I can run basic select queries, but came into this when i started using
> JOIN.
> 
> Many thanks,
> Jeff
> 
> my set up is PHP4.1.2/Apache/Unix/Freetds 0.53
> 
> 
> -- 
> 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] User getting superuser access. ack!

2002-04-24 Thread szii

It looks like $indinfo *may* get set to FALSE
and passed back on a failed query.  I'd vardump()
the $username in findLoginType() and make sure 
it's going in correctly, and that your output is not
FALSE coming out.

I also seem to remember something about 
"==" not being an equality operator for strings.
Seems like, and I may be incorrect here, that
$a == $b is only true if they reference the same
object in memory.  Perhaps there's something
about that for $a == 's'

For giggles, use strcmp() and see if it helps.
That "==" issue is about 1-2 years old by now,
and I'm not sure if it ever changed, or what the
status is currently.

'Luck!

-Szii

- Original Message - 
From: "J. Wharton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 24, 2002 8:51 AM
Subject: Re: [PHP-DB] User getting superuser access. ack!


> here's the code for findLoginType($username):
> 
> function findLoginType($username)
> {
>  $dbusername="foo";
>  $password="bar";
>  DBConnect($dbusername, $password); //sets up a connection with the mysql
> database
> 
>  $userquery="select * from users where username='$username'";
>  $theresultsplz=mysql_query($userquery) or die (mysql_error());
>  $indinfo=mysql_fetch_object($theresultsplz);
>  return $indinfo->usertype;
> }
> 
> 
> <[EMAIL PROTECTED]> wrote in message
> 01c701c1eb00$3fdf7120$[EMAIL PROTECTED]">news:01c701c1eb00$3fdf7120$[EMAIL PROTECTED]...
> > Well, that looks like a problem within the findLoginType()
> > call.  Since it's not been included, it's hard to help you. :)
> >
> > 'Luck
> >
> > -Szii
> >
> >
> > - Original Message -
> > From: "J. Wharton" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, April 23, 2002 11:09 AM
> > Subject: [PHP-DB] User getting superuser access. ack!
> >
> >
> > > I am having a problem where from certain browsers, a user gets the
> superuser
> > > access, but from mine, she gets normal access. Help!
> > >
> > > Here is a snippet of my code:
> > >
> > > //findLoginType returns a single character code stored in the user table
> for
> > > each user.
> > > //variable $username=$REMOTE_USER as previously defined.
> > >
> > > $hm=findLoginType($username);
> > > if ($hm=='s')
> > > {echo "";}
> > >
> > > else
> > > { //do normal user stuff}
> > >
> > >
> > >
> > >
> > >
> > > --
> > > 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] User getting superuser access. ack!

2002-04-23 Thread szii

Well, that looks like a problem within the findLoginType()
call.  Since it's not been included, it's hard to help you. :)

'Luck

-Szii


- Original Message - 
From: "J. Wharton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 23, 2002 11:09 AM
Subject: [PHP-DB] User getting superuser access. ack!


> I am having a problem where from certain browsers, a user gets the superuser
> access, but from mine, she gets normal access. Help!
> 
> Here is a snippet of my code:
> 
> //findLoginType returns a single character code stored in the user table for
> each user.
> //variable $username=$REMOTE_USER as previously defined.
> 
> $hm=findLoginType($username);
> if ($hm=='s')
> {echo "";}
> 
> else
> { //do normal user stuff}
> 
> 
> 
> 
> 
> -- 
> 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] please help!

2002-04-23 Thread szii

You're not evaluating the variable correctly...
Instead of... 
$site = ".row['site'].";   
It should be...
$site = $row["site"];
Or
$site = "$row['site']"

I'm not sure why you have leading and trailing
periods, either.  Looks like you were trying to 
do string appends, but they're not being used
correctly

'Luck

-Szii

- Original Message - 
From: "Evans, Josh" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 23, 2002 11:26 AM
Subject: [PHP-DB] please help!


> Database: sites
> 
> I have to columns: "id" and "site". I will have approx 800 entries in the db
> when I am finished and what I want it to do and start with 1st entry and
> ping the site and display in a table on the screen if it was able to ping
> site or not.
> 
> This is what I have so far. My problem is I am not sure how to make it
> select a entry, perform the ping, record the results, and then continue to
> the next entry.
> 
>  $db = mysql_connect("localhost","","") or die("Problem connecting");
> mysql_select_db("josh") or die("Problem selecting database");
> $query = "SELECT * FROM josh.sites";
> $result = mysql_query($query) or die ("Query failed");
> $numofrows = mysql_num_rows($result);
> for($i = 0; $i < $numofrows; $i++) {
> $row = mysql_fetch_array($result);
> if($i % 2) { //this means if there is a remainder
> 
> $site = ".row['site'].";   < its not pulling a site from the
> database?
> 
> 
> $host1 = `ping -n 4 $site`;
> 
> if (eregi("reply", $host1)) {
> echo "$site is up!";
> } else {
> echo ("$site is down!");
> }
> 
> echo ("");
> ?>
> 
> Please Help!
> 
> Josh Evans
> 
> 
> 
> -- 
> 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] auto-increment question

2002-04-23 Thread szii

This is more of a MySQL question, but you can set the column default for
the auto_increment column to something other than 1.

Look up the "SET DEFAULT" clause of the table create / alter table
calls.

-Szii

- Original Message - 
From: "Dan Swensen" <[EMAIL PROTECTED]>
To: "php" <[EMAIL PROTECTED]>
Sent: Monday, April 22, 2002 10:21 PM
Subject: [PHP-DB] auto-increment question


> Hi all,
> 
> I'm wondering if there is a way to start an auto-increment field at a number 
> other than 1. I'm working on a table meant to store large amounts of users, 
> each with their own unique ID, but my employer wants the UIDs to be a four-
> digit number, rather than starting at 1 -- but they still need to auto-
> increment. Can this be done, or do I need to find a workaround (and if so, 
> can anyone suggest anything?)
> 
> Thanks in advance,
> 
> Dan
> 
> -- 
> 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] Re: Retrieve information from mutiple tables

2002-04-22 Thread szii

mysql_fetch_array() brings back an associative array by default.

It's not "$result[0]" but instead "$results["column_name"]"

Also, you can use is_set() on subarrays.

if ((isset($result["col1"])) && 
 (is_array($result["col1"])) &&
 (sizeof($result["col1"])))
{
  // do stuff here
}

Remember that the above SEQUENCE is important.  If you deviate from it,
you may get "unknown variable" or other error messages.

-Szii

- Original Message - 
From: "Prodoc" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 22, 2002 2:38 PM
Subject: Re: [PHP-DB] Re: Retrieve information from mutiple tables


> 
> > 
> > Does the simple case (without specifying MainID) work?
> > 
> > And are you pretty sure that $row['MainID'] actually holds a valid value?
> > 
> > Have you tried printing the whole of the above query to see what it actually 
> > contains?
> > 
> > If it looks valid try copy-paste that query into the mysql command-line to 
> > see what comes up.
> > 
> 
> I tried the query in the mysql command-line and this does give me the 
> data I want to get.
> $row['MainID'] does hold a valid value is this should mean I doing 
> something wrong at displaying the values, doesn't it?
> I just started using mysql and php it will probebly be a stupid mistake 
> I made.
> I get one or more values back using the mysql command-line and I'm 
> trying to display the values one by one by using $result = 
> mysql_fetch_row (&res) (I tried mysql_fetch_array as well) but it only 
> displays one result by using $result[0].
> $result[1] or higher doesn't give me anything, what could be the problem?
> 
> 
> -- 
> 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] Complex (for me) table "join" - help please?

2002-04-19 Thread szii

Try

"SELECT TableA.Category, TableB.PersonID
FROM TableA LEFT JOIN TableB ON (TableA.CategoryID = TableB.TableAID)
  WHERE TableB.ClientID = $cid
 ORDER BY TableA.Category ASC"

LEFT JOIN states that you should return all "TableA," inserting NULL for TableB
if there is no match.

'Luck

-Szii



- Original Message -
From: "Peter Westergaard" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 19, 2002 2:46 PM
Subject: [PHP-DB] Complex (for me) table "join" - help please?


> I'm trying to perform a "join" that seems like it should be simple, but I'm just 
>ending up in a morass.  Hopefully someone who's
standing a step or two back from the problem can help me solve this one...
>
> What I have:
>
> Table A (Category): with a 3-tier category structure:
> -Nature
> -Category
> -Sub-Category
>
> Table B (Responsibility): with a reference to Table A, and a client id, and the id 
>of a person responsible for that Sub-category
for that client.
> -TableA-id
> -Client-id
> -Person-id
>
> So, what I want is a simple select which will fetch for me all rows in (Category) 
>with the relevant person from (Responsibility)
if there is one for a specific Client, but with a blank in that column if there isn't 
one.
>
> ie. (Category) has 10 entries (let's call them Ca-Cj), and (Responsibility) has 5 
>entries for Client 1 (Ca,Cb,Cc,Cd,Ce) and 3
entries for Client 2 (Cd,Ce,Cf).
>
> When I run the select for Client 1, I'd like to see...
> Ca - person
> Cb - person
> Cc - person
> Cd - person
> Ce - person
> Cf -
> Cg -
> Ch -
> Ci -
> Cj -
>
> And when I run the same select for Client 2 I'd like to see:
>
> Ca -
> Cb -
> Cc -
> Cd - person
> Ce - person
> Cf - person
> Cg -
> Ch -
> Ci -
> Cj -
>
> I tried a basic "outer join" type select, and of course for Client 1 I miss Cf, and 
>when I use it for Client 2 I miss Ca-Cc.
>
> Anyone able to sort me out here?
>
> I need to use a basic Select (instead of building a temp table or using variables in 
>a PHP script) because another database
process that I don't control needs to do the same thing.
>
> Think it's possible, or am I going to have to go and insert records into 
>"Responsibility" for every entry in Category for every
Client, resulting in (#Categories x #Clients) rows?  (The latter idea sure doesn't 
make me happy, but it would be 'easier' to build,
if not to maintain.  (And, as you can appreciate, since I'm not the one maintaining 
it, I'm like THAT CLOSE from just going that way
and saying 'screw em'!)
>
> Hopefully,
> -Peter Westergaard
>
>
>
> --
> 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] need some help...

2002-04-02 Thread szii

Not really a database question, but why not...

Step 1:  Clean up the code...
 a)  Convert all double-quote to single quotes in the HTML portion.
  I usually use doubles for PHP and singles for HTML.  I hate 
  having to escape quotes.
 b)  Use of spacing and indentation.

old
**
  

  

    - %s",$a["url"],$a["picurl"],$a["picurl"],$a["title"])
;
}
?>


  

  
**



new
**
  

  

  
  
  - 
  %s",$a["url"],$a["picurl"],$a["picurl"],$a["title"]);
}
?>


  

  
**

Since you have to put a string value, assign all output to a single string called 
$output.
Note that I moved your printf() to an echo, and simplified your output string by 
preassigning
variables.  An extra step, but greatly enhances readability and maintenance...
Also remember that the ".=" is an append operator whereas "=" is assignment.

even newer
**
 // Assign the stuff before...
 $output =
"
  

  

  
  
 ";

 
  
    - 
  
  $title
  
  ";
}
?>
  // finish the structure HTML
  $output .= "


  

  
";

// Now fopen() the file, fputs the $output, and fclose() the file.
**
http://www.php.net/manual/en/function.fopen.php
http://www.php.net/manual/en/function.fputs.php
http://www.php.net/manual/en/function.fclose.php

Party on!

-Szii


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




Re: [PHP-DB] Another Drop down question

2002-03-27 Thread szii

The easiest way...

> $getlist = mysql_query("SELECT distinct Writer FROM stories");
> echo " \n";

   echo "Search All";
 
> while ($row = mysql_fetch_array($getlist)) {
> echo ' '.$row["Writer"]."\n";
> }
> echo " \n";

-Szii

- Original Message - 
From: "Kim Kohen" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Wednesday, March 27, 2002 5:18 PM
Subject: [PHP-DB] Another Drop down question


> Hello all,
> 
> I'm trying for the first time to use a dynamically created popup menu from a
> mysql database.  The menu is of (article) writers' names and will be used in
> a select query.
> 
> Using snippets of code I've gleaned from here and the mysql list, I've the
> popup working fine but I'd like to include either a blank entry or a 'Search
> all Writers' entry in the menu and this is where I'm stuck.
> 
> The code I have is:
> 
> $getlist = mysql_query("SELECT distinct Writer FROM stories");
> echo " \n";
> while ($row = mysql_fetch_array($getlist)) {
> echo ' '.$row["Writer"]."\n";
> }
> echo " \n";
> 
> If anyone could point me in the right direction or direct me to appropriate
> documentation I'd be most appreciative.
> 
> Cheers and thanks
> 
> kim
> 
> 
> -- 
> 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] Learning PHP Sessions

2001-10-30 Thread Szii

You do not need to destroy session variables.  You can
session_unregister() them, if you'd like.

$session_start();
$foo = "Hi";
session_register("foo");

Next page...

if (isset($foo))
{
  echo "$foo"; // will print "Hi" if done correctly
  session_unregister("foo");
}

Sessions are automatically destroyed when the client-side browser
shuts down and the garbage collector runs.  If you want to "force"
a session deletion, use session_destroy().  Use it with caution, though,
since it's usually better to let the garbage collector do the work
periodically instead of cleaning up each session individually.

Check out http://www.php.net/manual/en/ref.session.php

'Luck

-Szii

- Original Message -
From: "Matthew Tedder" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 30, 2001 12:30 PM
Subject: [PHP-DB] Learning PHP Sessions


>  /*
> Hi,
>
> I'm new to PHP and am having trouble understanding how to use PHP
> sessions.  My book tells in near the beginning how to start them and
register
> session variables, but I can't figure out how to destroy a session or
later
> read those session variables.  I'm also trying to do this across frames,
but
> can't even get it to work within a single page.
>
> Here's what I've learned so far and what my problems are:
> */
>
> /* To start a session */
> session_start();
>
> /* To register a session variable */
> session_register("myvar");
> $myvar = "some value";
>
> /*
> PROBLEM #1:  From the above commands, I get a $PHPSESSID that seems to be
> globally available for use, but I cannot seem to read my values back out
of
> the registered session variable from anywhere...  I tried:
> */
>
> print "$myvar\n";   /* and absolutely nothing is printed */
>
> /* To destroy a session */
> session_destroy();
>
> /*
> PROBLEM #2:  This says there is no session to destroy.  It's rather
strange
> because I can still print the $PHPSESSID value..
>
> I've attached my code...
>
> */
> ?>






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




Re: [PHP-DB] Re: fulltext not for me/alternatives

2001-10-22 Thread Szii

In the source directory, there's a "myisam/ftdefs.h" file.  You can change
the
min word size there.

Note that you will have rebuild it, and reinstall.  Usually via "make/make
install."
Also you have to rebuild the indicies.  Easiest way is to drop and readd
them.

'Luck
-Szii

- Original Message -
From: "Mark Maunder" <[EMAIL PROTECTED]>
To: "Ben Edwards" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Sunday, October 21, 2001 8:11 AM
Subject: [PHP-DB] Re: fulltext not for me/alternatives


> Ben Edwards wrote:
>
> > I have a bit of a problem with using freetext indexes because there are
a
> > LOT of important 3 letter words in my database and as I am using shared
> > hosting so do not have the option to recompile MySql.  Can't quite
figure
> > why 3 is not the default (car, dog, cat war, man, bed, ).  Maybe so
you
> > would have to recompile to be able to find s_e_x ;).
>
> Is there a way to get mysql to change the default from 3 to 2 letter words
(or
> less) that are ignored in fulltext indexes?
> I'm running version 4 alpha. I checked the TODO and it's not listed. Is it
> possible to make this a config.h option? A minimum of 4 letters for a word
to be
> included in a fulltext index seems a bit restrictive.
>
> tnx!
>
>
>
>
> --
> 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]




Re: [PHP-DB] db's war

2001-09-18 Thread Szii

IMHO, having run all three, I summarize them like this...

MySQL, Postgres
  Fast, open source, free.  Good for projects, small-medium sized
businesses,
  and playing around.

DB2
  Good, solid database.  Their UI needs work (it's 100% java-based) and it's
  significantly more complex (and pricier) than the OpenSource ones.
However,
  it IS slower.  It can handle MUCH larger datasets.  It can be run in a
clustered
  environment.  It has the robustness for large business, but can be handled
by a
  medium sized one.

Oracle
  Often referred to as the "Cadillac of Databases," this thing's a beast.
Expect to not
  only pay through the nose for it, but also for help/contractors/DBAs to
set it up,
  tune it, maintain it, and handle the problems.  It -can- be setup by
smaller firms, but
  definately do your homework here.  Go with someone who's been doing it a
while
  and is in the enterprise space you want to be in.  It's also got a HUGE
set of
  applications and modules that can run on top of the raw database (no one
else really
  has this from a single vendor) but that's a whole new can of worms, costs,
problems,
  etc.

My personal favorite is DB2.  The key to DB2, though, is not the common
sense things
like "do the training classes" and "get a book."  The key is in their UI
stuff.  Ditch it.
Learn the command lines, the scripting tools, and the database connectivity
stuff.  Sure,
you can do simple things with their UI, but it's going to restrict you in a
lot of ways.
DB2 is big enough for "real enterprise work" but small enough not to get out
of hand.

However, DB2 is almost the cost of Oracle (purchasing) but your recurring
costs are
considerably cheaper.  Oracle does have the advantage of being "first" and
so the
knowledge base/finding people who know a bit about Oracle is easier, and
they DO have
all of the applications modules which DB2 currently does not have. (Rumors
are that they're
looking at expanding into that realm a little more, but I don't know
anything for sure.)

If you need a consolodated system for the whole company, well, Oracle wins
that hands down.
If you just need a super fast lightweight database, OpenSource.
For everything else, DB2.

And if you need a kick-arse track-anything-anywhere-anyhow system, look at
Camstar Systems,
which will handle backends of both DB2 and Oracle.  It's better than the
Oracle MES/tracking modules.

-Szii

- Original Message -
From: "Paul Gardiner" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "Sommai Fongnamthip" <[EMAIL PROTECTED]>
Sent: Tuesday, September 18, 2001 3:16 AM
Subject: Re: [PHP-DB] db's war


> Hi,
>
> I'm also very interested in other peoples thoughts and reactions to this.
> We've been hit twofold, we run on SCO which Caldera has now taken over and
> also use Informix which IBM have acquired, whom I'm sure will try to make
us
> move to DB2 at some point.
>
> The other trouble we have is a lot of our programs are written in Informix
> 4GL and so will be a pain to convert. I would have liked to of had a DB
> independent 4GL but this was already in place before I got here. The only
> real other choice like you say is Oracle but I've always heard bad things
> regarding pricing where they are concerned. They had a special offer on
for
> anyone who jumped over two them quickly but I like to 'look before you
leap'
> :)
>
> We plan to start looking at possible alternative's before we're forced to
> change and so would be glad to hear from anyone else who is in the same
boat
> so to speak.
>
> Best Regards,
> - Paul -
>
>
> - Original Message -
> From: "Sommai Fongnamthip" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, September 18, 2001 2:36 AM
> Subject: [PHP-DB] db's war
>
>
> > hi
> > I'd like to survey php commnunity about how do you think about merge
> > between informix and ibm?  Did there remain only 2 major dbms (oracle
and
> > db2)?  do you think MySQL will be the leader with next version 4?
> >
> > SF
> >
> >
> > --
> > 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 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 Modules and multiple database

2001-08-13 Thread Szii

Done both.

In fact, I create an object which has 2 database objects in it.
If I dump the objects, I can WATCH as they "merge" and point 
at the same database.

I go back to using mysql_db_query() and everything's fine.
It would appear that the mysql_select_db() is not persisting.
If you call it on two different links, it's seems to modify both
links.  Almost like it's global

*shrug*

-Szii

- Original Message - 
From: "Paul Burney" <[EMAIL PROTECTED]>
To: "Szii" <[EMAIL PROTECTED]>; "php mailing list" <[EMAIL PROTECTED]>
Sent: Monday, August 13, 2001 2:28 PM
Subject: Re: [PHP-DB] MySQL Modules and multiple database


> on 8/13/01 1:56 PM, Szii ([EMAIL PROTECTED]) wrote:
> 
> > Opening multiple databases on the same database machine
> > seems unsupported.  While you CAN do it, it has a tendency
> > to "reuse" the last connection even in lieu of a specific database.
> > Right now we're using mysql_db_query() to get around it, but
> > with that becoming deprecated, we need to find anothe solution.
> 
> Before each query (from a different database), you can call the function;
> 
> mysql_select_db($database_name, $connection_id)
> 
> You can also specify the connection id for your queries:
> 
> mysql_query($query, $connection_id)
> 
> Just make sure that you select the db before each query otherwise a query
> will use the last selected database.
> 
> Sincerely,
> 
> Paul Burney
> 
> +-+-+
> | Paul Burney | P: 310.825.8365 |
> | Webmaster && Programmer | E: <[EMAIL PROTECTED]>   |
> | UCLA -> GSE&IS -> ETU   | W: <http://www.gseis.ucla.edu/> |
> +-+-+


-- 
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] MySQL Modules and multiple database

2001-08-13 Thread Szii

Opening multiple databases on the same database machine
seems unsupported.  While you CAN do it, it has a tendency
to "reuse" the last connection even in lieu of a specific database.
Right now we're using mysql_db_query() to get around it, but
with that becoming deprecated, we need to find anothe solution.

Anyone have any ideas/thoughts?

Thanks.

-Szii 


-- 
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] Not Really A DB Question

2001-07-27 Thread Szii

This is not VB - this is better.  Probably want to name all of your text
fields something
similar, since they'll be mixed in with the drop downs, radio buttons,
etc...

Check $HTTP_POST_VARS and $HTTP_GET_VARS in your form's target.

-Szii


- Original Message -
From: "Peter J. Krawetzky" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 27, 2001 5:30 AM
Subject: [PHP-DB] Not Really A DB Question


How do you loop through all the text objects in a PHP script?  In
otherwords, I want use logic to check the value of each textbox without
specifically referencing the actual object name.  Visual Basic has this type
of logic.



-- 
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] kinda unrelated, but curious...

2001-07-02 Thread Szii

Most of the time, by word of mouth.  Other than that, scan the 'net, look on
the
job boards.  If you're new to the field, put your name in a couple
recruiters hands.
Sure, it's not freelance, and you won't make as much, but a couple jobs and
you
start to become known.  Once you're known, and have a portfolio, it just
gets
easier from there on out.

Also look for "part time work from home PHP jobs."  You can pick up some
"reputation" that way before quitting your REAL job.  These are a real PITA
to
find, but they do exist.

Oh, and let all your friends know that you're a PHP/web coder looking for
work.
It's amazing how many people know people that know people and you end up
with work. 8-)

-Szii


- Original Message -
From: "David Balatero" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 02, 2001 11:27 PM
Subject: [PHP-DB] kinda unrelated, but curious...


> ...where do you people pick up freelance jobs? Any input on this?
>
> -
> David Balatero
> [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 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] RE: Storing Code in a db?

2001-07-02 Thread Szii

XML would be perfect for this.  You store the XML in the database (usually a
BLOB/CLOB/Long VARCHAR/etc)
and your script pulls the XML out, and parses it there.

You can have a set of "input forms" written in PHP which'll generate the XML
for you.

Of course, this assumes some knowledge of XML, but theoretically you could
do it with
a "flat file format" (like comma/tilde delimited) and just store the string
in the database.

It's trivial to write a PHP script that generates PHP directly...

$str = "echo \"hi!\";"; // you can use single-quotes if you're more
comfortable with them
$str .= "echo \"Done!\";"; // note that it's got a ; INSIDE the
string...it's PHP in there, after all
eval($str);

If you wanted to pre-generate it, I don't see any reason why you couldn't
addslashes()
the code, and INSERT it that way.  Pull it back out, stripslashes() it, and
eval() it.

Voila!

-Szii

- Original Message -
From: "Mark McCray" <[EMAIL PROTECTED]>
To: "olinux" <[EMAIL PROTECTED]>; "php-db" <[EMAIL PROTECTED]>
Sent: Monday, July 02, 2001 5:54 PM
Subject: Re: [PHP-DB] RE: Storing Code in a db?


> Here was the application I was thinking of creating for my organization.
> We wanted to make an online survey tool.  Where you can create a survey,
> with sections, possibly subsections, questions, and acceptable answers.
>
> It's easy enough to create this stuff each and every time, but it's
> ridiculously tedious.
>
> So why not make an application that does it automatically.
>
> So we were thinking that you kind of have to define the different types of
> questions/answers that can be used in the survey. For example, a straight
> text field, multiline text field, 5 radio button selection, 5 option
> pull-down, Yes/No radio button, checkboxes, etc...
>
> So in defining the types of questions/answers, we thought it might be cool
> to define each type of answer and the code that goes along with generating
> it.  So when defining the survey questions, you tell it that the question
> has a 3 radio button answer, and the system would pull code from the
> database to help generate the question/answer html dynamically when
someone
> goes to the survey.
>
> I know you could store the functions as includes, but just thought it
would
> be cool if people could store the code in the database, because there
might
> just be an answer type that I haven't yet thought to program.
>
> Marky
>
>
>
> on 7/1/01 2:34 PM, olinux at [EMAIL PROTECTED] wrote:
>
> >
> > Couldn't you just store the php commands as a txt file and then use a
SSI
> > [server side include]?
> >
> > olinux
> >
> >> It would be very convenient to be able to store PHP (or any other
server
> >> side code) in a database, then retrieve and execute it.
> >>
> >> I store a lot of website content with embedded HTML commands in a
> > database.
> >> Being able to store PHP code in the database as well would be very
> >> convenient.
> > Lets think about something:
> > if we put some code in a field and then we out the of code from code put
in
> > temporal file and then include in our principal code :)))
> >
> > but i have a doubt eval funcion we work with functions printf,  echo? i
> > don't think so.
> >
> >
> >>
> >> The only way I can think of doing it would involve a lot of very messy
> >> parsing out of the php commands. I expect that would take way to much
> >> processing time. I don't imagine that would work for entire functions
> >> either. Maybe just individual PHP commands.
> >>
> >> Any ideas
> >>
> >> Thanks! Rita
> >>
> >
> >
> > _
> > Do You Yahoo!?
> > Get your free @yahoo.com address at http://mail.yahoo.com
> >
> >
>
>
> --
> 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]




Re: [PHP-DB] Need Database Design help

2001-05-18 Thread Szii

Hmmit may be easier to just do this...

Group Definition Table

DefID
GroupName



User Definition Table
---
UserID


GroupMember Table
---
MapID
UserID
GroupID

Then you can assign a user to a group by
inserting a new record into the GroupMember Table where UserID is the user,
and GroupID is
the new group.

If you want to search all users in Group "West" you could say
(assuming Group Definition Table is populated with
1  North
2  South
3  East
4  West
)
SELECT UserID from GroupMemberTable WHERE GroupID = 4;
or if you wanted to check multiple groups,
SELECT UserID from GroupMemberTable WHERE GroupID IN (4,2,3);

The map table may get huge depending on the number of users/groups,
but it's a possibility.

-Szii

- Original Message -
From: "Doug Schasteen" <[EMAIL PROTECTED]>
To: "php-db list" <[EMAIL PROTECTED]>
Sent: Friday, May 18, 2001 1:13 PM
Subject: [PHP-DB] Need Database Design help


I'll try to simplify my problem so that this isn't a long read and is easy
to understand.

Tree Table:
--
node_id
node_name
parent_id

I use the above table's rows to create an online tree in php and javascript.
The parent_id column is just a pointer to a the node_id of which the current
node branches off of. The tree is used to group users, which we store in
another table.

Users Table:

user_id
node_id

Now, if I wanted to compare side by side the users of one node to the users
of another node, I would do a select * from tree, users where users.node_id
= tree.node_id and node_id = 'x' for each node id. I created the database
this way so that I could do comparisons with polling results. My problem
comes when the tree gets large and I want to compare a group of nodes to
another group of nodes.  For instance, the tree splits out into southwest
and northwest divisions, and under each of those it splits out into the
groups where the users reside. There will be no users linked directly to the
southwest or northwest nodes, but I want to compare all the users that are
in groups that are PART of the northwest node to all users that are in
groups that are part of the southwest node. I could probably do a "Where
parent_id = 'node id of northwest division" but what if the tree splits up
even farther than that? What if the tree originally splits into North and
South divisions, and under each of those divisions it goes into East and
West, and then splits into groups. I'd have to be able to know the parent's
of the parents in a single SQL statement.

I don't see how I can do this without redesigning the database, and I'm not
even sure what I would need to change in order to get the database to work.
If anyone out there is a database design expert and can see my mistake right
away, please help me out.

- Doug Schasteen



-- 
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] Storing duplicate checkbox values

2001-05-17 Thread Szii

I got around it by using a "standard" naming scheme.

(This will work if you have LESS than $num_items, but not more.  If you
have LESS, then it'll just hit the "not set" while loop more.)

Oh, ignore the   They're just there to keep Win-based systems from
trying to interpret the code.


$num_items = 80;

for ($x = 0; $x < $num_items; $x++)
{
  echo "
}

This will give you "$num_items" checkboxes.

Then after the POST/GET, you can do this...

for($x = 0; $x < $num_items; $x++)
{
  $proto = 'f_checkbox_' . $x;
  if (isset($$proto)) // It's checked, therefore it's set - if it's not
checked, it's just not set.
  {
echo "Set\n";
  }
  else
  {
 echo "Not set\n";
   }
}



This will give you "Set"/"Not Set" lines 80 times.

G'luck..

-Szii

- Original Message -
From: "John Starkey" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 16, 2001 5:42 PM
Subject: [PHP-DB] Storing duplicate checkbox values


> Ok This one has me stumped.
>
> I'm working on a survey for an author. There is already a total of 35
> questions and their corresponding columns in the main table. She has three
> other questions that have identical checkboxes, 30 each. I want to put
> them in the second table and just make reference to the record_id from the
> main table and the question number, so that I don't end up with 90 columns
> in this second table.
>
> Anyone have any suggestions on a quick way to do this? Obviously the
> checkboxes will need to have unique names, but the columns won't. I'm
> pretty fried on this and ready to take the not so efficient route of
> having 90 columns.
>
> This is a MySQL/PHP4 job.
>
> Thanks,
>
> John
>
>
> --
> 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]




Re: [PHP-DB] mySQL Addition Problem

2001-05-16 Thread Szii

Sorry, last message was a little vague.

Your SQL will fail because of the ',' after the SET clause.
Therefore affected_rows shows 0, and inserts a new row.
Then when you match with the LIKE clause, it's going to match
multiple times.

Miles, you were SO close with #2.  =)

-Szii

- Original Message -
From: "Miles Thompson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 16, 2001 3:50 PM
Subject: Re: [PHP-DB] mySQL Addition Problem


>
> Dammit, that code looks right.
>
> So 
>
> 1. Have you  tried it at the mysql console? What results?
> 2. How accurately does day match $day? Have you tried "=" instead of LIKE?
> Maybe it's doing it twice?
> 3. Is day distinct? How do you know you have only one?
>
> When you tested with 2, assuming i had a value of 1, was the result 5 or
6?
>
> Strange - Miles Thompson
>
> At 05:43 PM 5/16/01 -0400, SubvertTRL wrote:
> >I am making a simple script that counts votes per day for a site and uses
a
> >simple database, All i want to do is increment the field by one.  the
first
> >time i run the script it works, after that it doubles it.  so instead of
1,
> >it adds 2. i know its doubling it because i tried adding 2, 3, and 4 and
it
> >doubled all those...  the field is a BIGINT UNSIGNED, i've tried it with
> >just INT, nothing seems to work,  i used to have PHP get the field value,
> >increment it, then update the row in the database with the new number, it
> >doubleed it that way. now i use straight mySQL code to do it all in one
> >shot, still doubles it.. can any one help me???
> >
> >heres my code... less database info :)
> >
> >$results = mysql_query("UPDATE trlvotes SET i=i+1,  WHERE day LIKE
'$day'");
> >if (mysql_affected_rows($results) == 0){
> >  mysql_query("INSERT INTO trlvotes (id, day, i) VALUES (null, '$day',
1)");
> >}
> >mysql_close();
> >
> >
> >you can email me at [EMAIL PROTECTED]
> >
> >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]
>
>
> --
> 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]




Re: [PHP-DB] mySQL Addition Problem

2001-05-16 Thread Szii

Remove the comma after the "SET" clause?

-Szii

- Original Message -
From: "Miles Thompson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 16, 2001 3:50 PM
Subject: Re: [PHP-DB] mySQL Addition Problem


>
> Dammit, that code looks right.
>
> So 
>
> 1. Have you  tried it at the mysql console? What results?
> 2. How accurately does day match $day? Have you tried "=" instead of LIKE?
> Maybe it's doing it twice?
> 3. Is day distinct? How do you know you have only one?
>
> When you tested with 2, assuming i had a value of 1, was the result 5 or
6?
>
> Strange - Miles Thompson
>
> At 05:43 PM 5/16/01 -0400, SubvertTRL wrote:
> >I am making a simple script that counts votes per day for a site and uses
a
> >simple database, All i want to do is increment the field by one.  the
first
> >time i run the script it works, after that it doubles it.  so instead of
1,
> >it adds 2. i know its doubling it because i tried adding 2, 3, and 4 and
it
> >doubled all those...  the field is a BIGINT UNSIGNED, i've tried it with
> >just INT, nothing seems to work,  i used to have PHP get the field value,
> >increment it, then update the row in the database with the new number, it
> >doubleed it that way. now i use straight mySQL code to do it all in one
> >shot, still doubles it.. can any one help me???
> >
> >heres my code... less database info :)
> >
> >$results = mysql_query("UPDATE trlvotes SET i=i+1,  WHERE day LIKE
'$day'");
> >if (mysql_affected_rows($results) == 0){
> >  mysql_query("INSERT INTO trlvotes (id, day, i) VALUES (null, '$day',
1)");
> >}
> >mysql_close();
> >
> >
> >you can email me at [EMAIL PROTECTED]
> >
> >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]
>
>
> --
> 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]




Re: [PHP-DB] 'the missing character' YIKES

2001-05-16 Thread Szii

Oh, btw, if you're splitting along chars, make sure you don't munge your
data TOO much.

Breaking mid-word can be annoying, esp if it's to be displayed as "a page."

I have a splitter I wrote that'll either break along word boundries, or
along sentance
boundries.

Haven't pounded it yet, but it seems to work...

-Szii

- Original Message -
From: "Jimmy Brake" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 15, 2001 9:58 PM
Subject: [PHP-DB] 'the missing character' YIKES


> I forgot to detail the problem, I loose a character every once in a while
basically every 3500 characters.
>
> Jimmy Brake
> Cool Tools and Stuff
> Critical Path Inc.
>
> "Making your job easier"
>
>
>
> --
> 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]




Re: [PHP-DB] Filling mysql db with access db

2001-05-16 Thread Szii

Export as a comma-delimited file, explode() the file one line
at a time along commas, and use insert via normal methods.

Not sure if MySQL has a parser for comma-delim (probably
does) but this way you have more control over how it goes in.

-Szii

- Original Message - 
From: "Gabriel" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 16, 2001 8:47 AM
Subject: [PHP-DB] Filling mysql db with access db


> How can i import data from an access database to a mysql db.
> 
> Thanks in advance,
> 
> Gabriel.
> 
> 


-- 
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] 'the missing character'

2001-05-16 Thread Szii

I don't understand xcount().
Instead of xcount(), why not use strlen()?

Say we have 7100 chars

If you step through, first pass

$i = 0
$chunk_count = 2
$start = 0
$final = 3500
$text[] is chars 0-3499

second pass

$i = 1 // from $i++
$chunk_count = 2
$start = 3501 // problem is here - note the endpoint of the last pass in
$text[]?
$final = 3499
$text[] is chars 3501-7000 // what happened to char 3500 itself?

Remember that substr() takes a start point, and an offset - not an endpoint.
So after the first pass, you've read in 0-3499 as is correct, but you have
an extraneous if() clause that inc's your start by one, and then adds 3500.

Drop the second if($start == 0) clause which sets $start to 1.

'Luck

-Szii





- Original Message -
From: "Jimmy Brake" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 15, 2001 9:54 PM
Subject: [PHP-DB] 'the missing character'


> Hi!
>
> Does anyone know of a function in php that will take a chunk of text and
seperate it into 'chunks' preferably returning it in an array?
>
> The reason being is that I have some columns(oracle) that are set to
varchar2(4000) and I have text that is 4000+ AND :-) I cannot change it to
another format.
>
> I was unable to find a chunk maker so I built one.
>
> function chunk_maker($text)
> {
> // have to count the number of characters, if over 3500 characters
need to split into chunks of 3500 characters
> $count = xcount($text);
> if($count > 3500)
> {
> $chunk_count = $count/3500;
> //need to clean up the $chunk_count by removing the
trailing decimals and
> //adding one to the total to make sure we do not loose in
characters
> $chunk_count = floor($chunk_count)+1;
> $i=0;
> $start=0;
> while($i != $chunk_count)
> {
> // err well this helps to make sure we get the
correct amount of characters
> if($start == 0)
> {
> $final = 3500;
> } else {
> $final = 3499;
> }
>
> //now we need to make the chunks and stick them in
an array
>
> $text2[]=substr($text,$start,$final);
>
> // err well this helps to make sure we get the
correct amount of characters
> if($start == 0)
> {
> $start=1;
> }
> $start=$start+3500;
> $i++;
> }
> } else {
> $text2[] = $text;
> }
> return($text2);
> }
>
> function xcount($text)
> {
> global $debug;
> foreach (count_chars($text) as $my_value)
$length=$length+$my_value;
> tracker($length);
> return($length);
> }
>
>
> If I just failed to find the right functions please let me know, otherwise
please help! :-)
>
>
> Jimmy Brake
>
>
> --
> 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]




Re: [PHP-DB] Flash+PHP search error

2001-05-14 Thread Szii

This is not really related to PHPDB

Send me the code .  It looks like you have an unbalanced double-quote.
Same thing's happening with your footer, too.

Should be an easy fix.

-Szii

- Original Message -
From: "Brian Tegtmeier" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, May 14, 2001 2:37 PM
Subject: [PHP-DB] Flash+PHP search error


> I am currently in the progress of setting up a page for my client located
at
> http://64.77.185.160/main.html which integrates a PHP search function to
> find keywords on a page. The problem I am running into now is when I goto
> that main.html page, I get this "\n", $header); } } ?>" message above my
> Flash movie and have no idea why it is causing it on the Unix server with
> PHP 4.05.
>
> The thing is the PHP search and the Flash movie work fine for searches
even
> with that message, its just that I'm looking for a way to remove it. The
> funny thing about it is it shows up only on IE and Netscape 6 for the
PC/Mac
> but Netscape 4.76 doesn't show that text. weird.
>
> P.S. If you notice the Search Results open in the top frameset, its ok
> becuase I know that already. I wanted to fix this before altering the
Flash
> to have it point to the bottom frame. Thanks for your time! :)
>
>
> __
> FREE Personalized Email at Mail.com
> Sign up at http://www.mail.com/?sr=signup
>
> --
> 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]




Re: [PHP-DB] Url link

2001-05-14 Thread Szii

I do the initial search, and store the results in a server-side
session cookie.

Next/Prev becomes

$firstRecord = "($pageNumber - 1) * $g_NumToDisplayPerPage"
$lastRecord = "$firstRecord + $g_NumToDisplayPerPage"

Make sure you don't get a HUGE result set.  Session cookies work
well if they're relatively small.  You're trading off multiple-searches
(1 per page) vs storing the results which is faster.  Some people
are against cookies, 'cause you can't guarantee that they're turned on.
Some people say you should load the whole thing into a JavaScript
array, but then you assume that the client has a large buffer available
on his/her machine.  Pick your poison.

Anything you do will have tradeoffs, I made this one - limit the search
results and use the session cookies.  If that gets too intensive, I can
break out the session stuff to it's own box - session cookies don't
transfer the whole thing on each page load, but it DOES load the
whole thing (since it's server-side) on each page load.  Make sure
you put a "clean-up" once they leave your search-results page, or
you'll have dozens of users all with search results after they're already
done searching and each one wasting cycles loading/reloading it.  =)
Global includes work well for this -

if (!isset($isSearchResult))
{
   unset($session_resultArray);
}

Anyone got any improvements on this?

Peace, love, code.

-Szii




- Original Message -
From: "Mark @ 10base-t.com" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, May 14, 2001 1:02 PM
Subject: [PHP-DB] Url link


> Hey there,
> I'm trying to build NEXT/PREV buttons on my search page.
> The only way I know to do it so far is via an url.
>
> So the link I create is the following:
>
>
>
http://monster/search1.php?offset=0&submit=submitted&where=historical_yn%3D%
>
27N%27+and+fname+like+%27%25%25%27+and+lname+like+%27%25%25%27+and+dept+like
> +%27%2510%25%27+and+locid+like+%27%25%25%27+
>
> I'm passing the where= portion as a variable to my query string.
>
> $query = "select blah from employee where $where order by blah limit blah"
>
> But it makes the where section into this:
>
> select id, lname, fname, extension, locid, email from employee where
> historical_yn=\'N\' and fname like \'%%\' and lname like \'%%\' and dept
> like \'%10%\' and locid like \'%%\' order by lname limit 1,20
>
>
> The problem is it's putting \'s in the where variable and it makes the
query
> fail.
>
> Does anyone know how best to get rid of the \'s or a better way to do
> next/prev buttons?
>
> Thanks!!!
>
> Mark
>
>
>
> --
> 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]




Re: [PHP-DB] Can't get my head around this problem...

2001-04-24 Thread Szii

Perhaps...?

$x = 0;
while ($x < 7)
{
  if (!isset($myArray[$x]))
  {
 $myArray[$x] =0;
  }
}

-Szii

- Original Message -
From: "Tyrone Mills" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 24, 2001 3:58 PM
Subject: [PHP-DB] Can't get my head around this problem...


> Hello all...
>
> I've got what is probably a stupid question, it's a problem I can't seem
to
> get my head around it. Any help will be greatly appreciated.
>
> I'm pulling a count of connections from a MySQL database and the day of
the
> week it occurred on. Now the result set doesn't include empty values, so
if
> there were connections on only 2 days, I only get 2 rows returned, if
there
> were connections on 4 days, I get 4 rows returned. You get the idea...
>
> Here is the PHP code I am using the get the data:
>
> $sql = "SELECT COUNT(*), (DAYOFWEEK(dialer_login_date) -1) AS DAYOFWEEK
FROM
> dialer_login WHERE dialer_id = $dialer_id AND
> WEEK(date_format(dialer_login_date, '%Y-%m-%d'),0) = WEEK('$last_week',0)
> GROUP BY DAYOFWEEK";
>
> $result = db_query($sql);
>
> while ($daily_count = db_fetch_array($result))
> {
>
> $lastweek[] = $daily_count["COUNT(*)"];
> $day[] = $daily_count["DAYOFWEEK"];
>
> }
>
> For the sake of this question, let's say that there were connections on
only
> 2 days, so we get a result set with 2 rows. Something like this:
>
> COUNT(*) DAYOFWEEK
> 8 2
> 3 4
>
> That's great, but I need the array $lastweek to have the value 8 in
element
> 2 and the value 3 in element 4 and all other elements (0,1,3,5,6) as zero.
> As it sits, they are in elements 0 and 1 respectively.
>
> I get this:
>
> $lastweek[] = 8,3
>
> I need this:
>
> $lastweek[] = 0,0,8,0,3,0,0
>
> Now I've written all manner of wild and wonderful loops that iterate
through
> either $lastweek or $day and try and build a proper array. Invariably
> something doesn't work right. I'm sure I'm grossly over complicating this,
> but I am at my wits end. Any thoughts or ideas are most welcome.
>
> Thanks!!
>
> Tyrone Mills
> 
> UNIX is user-friendly, it's just picky about who its friends are...
>
>
>
>
>
> --
> 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]




Re: [PHP-DB] reword my question

2001-04-20 Thread Szii

Read The Fine Manual?

exec();

-Szii
- Original Message - 
From: Paul S <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 20, 2001 4:13 PM
Subject: [PHP-DB] reword my question


> How do I execute a shell script in php?
> 
> I just started to use php and I am learning it on the
> fly for a project.
> 
> __
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/
> 
> -- 
> 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]




Re: [PHP-DB] PHP question needing info

2001-04-20 Thread Szii

*begins dousing Paul S with water before the flames start*

-Szii

- Original Message - 
From: Paul S <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 20, 2001 3:04 PM
Subject: [PHP-DB] PHP question needing info


> I have a question that I need help with.
> 
> The question is that how do I execute a script in PHP.
> 
> __
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/
> 
> -- 
> 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]




Re: [PHP-DB] MySQL transactions?

2001-04-18 Thread Szii

The newest MySQL code has transactions via their implementation of
Sleepcat's BDB tables.

If you use BDB tables instead of MyISAM you can do transactions.

Check the syntax on CREATE TABLE for details on how to create
BDB tables.

'Luck

-Szii

- Original Message -
From: Gary Huntress <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 18, 2001 8:36 PM
Subject: Re: [PHP-DB] MySQL transactions?


> a common question.  This might help
>
http://www.mysql.com/documentation/mysql/bychapter/manual_Compatibility.html
> #Missing_Transactions
>
> --
> Regards,
> Gary "SuperID" Huntress
> ===
> FreeSQL.org offering free database hosting to developers
> Visit http://www.freesql.org
>
> "Bas Cancrinus" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi,
> >
> > Is it possible to define a set of mysql function-calls as a transaction
> > that commits if no error occurs and rolls back otherwise?
> >
> > Thanks in advance,
> > Bas
> >
> >
> > --
> > 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 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] Updating multiple forms

2001-04-18 Thread Szii

Off the top of my head, and it's 3am local so take this with a grain of
salt, but I think that
 this will work...

Update Table1, Table2 SET Table1.column1 = 'blah', Table2.column1='foo'
WHERE
Table1.ID = x AND Table2.ID = y

'Luck
-Szii

- Original Message -
From: Lester June Cabrera <[EMAIL PROTECTED]>
To: Shahmat Dahlan <[EMAIL PROTECTED]>; PHP-DB <[EMAIL PROTECTED]>
Sent: Wednesday, April 18, 2001 2:29 AM
Subject: Re: [PHP-DB] Updating multiple forms


>
> Multiple tables with different fields? Hmm... I don't know of any shortcut
> in doing it.
>
>
> At 05:27 PM 4/18/01 +0800, Shahmat Dahlan wrote:
> >Yes, this is only applicable if I only have one table. What if I need to
> >update multiple tables?
> >
> >
> >Lester June Cabrera wrote:
> >
> > > I guess you need to use the UPDATE command
> > >
> > > UPDATE tablename
> > > SET column1 = 'some value'
> > > WHEREcolumn2 = 'another value';
> > >
> > > Did I get what you mean?
> > >
> > > Lester
> > >
> > > At 05:02 PM 4/18/01 +0800, you wrote:
> > > >Apologies...
> > > >Lemme rephrase my question,
> > > >How do I update data into multiple tables in MySQL?
> > > >
> > > >Shahmat
> > > >
> > > >Lester June Cabrera wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > What do you mean by updating data into multiple forms? Do you mean
> > > > > displaying data in multiple HTML forms?
> > > > >
> > > > > Lester
> > > > >
> > > > > At 04:53 PM 4/18/01 +0800, Shahmat Dahlan wrote:
> > > > > >How do I update data into multiple forms?
> > > > > >
> > > > > >Thanks in advance..
> > > > > >Shahmat
>
>
> --
> 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] mysql_insert_id()

2001-03-12 Thread szii

Is there a known way to "reset" this field?  If I make a call and it
succeeds,
then it should be set.  If it fails, shouldn't it at least be reset to 0
or -1 instead
of simply the last successful insert?  Is this the expected behavior?

-Szii


-- 
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] Tricky one - include($identifer);

2001-02-07 Thread szii

http://www.php.net/manual/en/function.eval.php

Couple of notes from the userbase show how to include HTML in 
a php $content passed to eval()

'Luck.

-Szii

At 05:07 PM 2/8/2001 +1300, Simon Helson wrote:
>Hey guys - I've been mulling this one over for a few days now - and still
>haven't come up with anything intelligent to sort it...
>
>I'm building a site where you can edit the content on the fly - basically
>allowing you to write code and add pages without touching a telnet or ftp
>session etc etc etc...
>
>So I end up with chunks of text stored in my database - which I then pull
>out and (currently) do the following with:
>
>
>echo $content;
>
>This works real nice when the text is plain HTML - makes setting up a site
>nice-n-easy.. however, I want certain people to be able to put php code in
>their snippets using  as you would when editing a normal php
>file.
>
>This is where my $echo falls over - none of the php code is executed (as
>you would expect). What I really want to be able to do is:
>
>include($content);
>
>I haven't been able to find any ways to do this though - eval() looks for
>just php code and include() and require() look for filenames. I really
>don't want to store my snippets as files - but I guess I may have to if I
>can't find a way to pull em out of a database and include() em.
>
>Any help would be much appreciated
>
>Cheers
>
>Simon 
>
>-- 
>THE WORST HOMING PIGEON
>
>This historic bird was released in Pembrokeshire in June 1953 and was
>expected to reach its base that evening.  It was returned by post, dead,
>in a cardboard box eleven years later from Brazil.
>   -- Stephen Pile, "The Book of Heroic Failures"
>
>
>-- 
>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]




Re: [PHP-DB] db2 with php

2001-02-04 Thread szii

Well, if it says that it's looking for it in /etc/httpd/modules then it's 
obviously not looking in /home/db2inst1/sqllib/lib, eh?

Try a symlink... 
"ln -s /home/db2inst1/sqllib/lib/libdb2.so.1
/etc/httpd/modules/libphp4.so/libdb2.so.1"

Or copy the library.
Or I think you can add a line into /etc/ld.so.conf too.

-Szii



At 11:08 PM 2/4/2001 -0500, Chris Book wrote:
>Hello,
>
>I've installed db2 and created the default instance at /home/db2inst1/.
>PHP is compiled with the --with-ibm-db2 option, however when I try to start
>apache I get the message:  "Cannot load /etc/httpd/modules/libphp4.so into
>server: libdb2.so.1: cannot open shared object file: No such file or
>directory" when I try to load the php4 module.  libdb2.so.1 exists in
>/home/db2inst1/sqllib/lib/ so I'm not sure why php can't find it.  Can
>anyone help me with this?
>
>Thanks,
>Chris Book
>[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 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] Connectivity to AS/400

2001-02-04 Thread szii

There's been a lot of talk about this recently.  Check the archives for the
last 2 months, and PHPBuilder.com

Last I heard, you needed DRDA(DB2 Connect) installed, as well as
the runtime client.

Also on the client - DB2 Application Development package.  Use this to
compile PHP --with-ibm-db2=.  Make sure you run the CATALOG
commands on the client so that it can find the AS400 database.

'Luck!

-Szii

At 10:41 AM 2/4/2001 -0800, Pete Lancashire wrote:
>I'm going to be trying to connect to the native DB2 database in a AS/400
>So far thats all I know about the IBM side.
>
>Can someone give me a short update on what options I have ?
>
>TIA !!!
>
>-pete
>
>-- 
>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] odbc_columns()

2001-01-22 Thread szii

Yo ho hoodbc_columns() on DB2!

Now, it returns a resource ID, as expected but you cannot call
odbc_fetch_row() on it or it'll segfault.  Hmm..

I filled out a report on this, since I cracked open the php_odbc.c file
and verified that all the data's coming back from DB2, and that the
bindcols() method is working.

After more playing, I still cannot seem to actually USE the results
of an odbc_columns() call on DB2 since just about everything
"fetch-related" segfaults.  Is there another method or set of methods
that I'm missing?

Thoughts?  Ideas?

-Szii

-- 
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] odbc_columns() and DB2

2001-01-19 Thread szii

Yeah, I'm using the Unified ODBC.  The abstraction layer over DB2's CLI
is faster than "real" ODBC.

-Szii

At 08:57 AM 1/19/01 -0500, Andrew Hill wrote:
>Regarding the wrapper - I assume you are using the built-in unified-odbc...
>which isn't really ODBC.
>As I understand it unified-odbc is just a common function set as a minimal
>abstraction to several databases whose syntax calls are fairly similar.
>
>Have you tried a 'real' ODBC layer?  e.g. compile iODBC driver manager in
>and drop in some drivers?
>iODBC is available at www.iodbc.org.  Drivers are availabe at
>www.openlinksw.com
>
>Let me know if you require assistance here.
>
>If this is NOT unified-odbc, then you can prob. trace the ODBC API calls.
>Typically the driver manager does this, so you will need to make an addition
>to the odbc.ini depending on the driver manager.
>
>Best regards,
>Andrew
>
>Andrew Hill
>Director Technology Evangelism
>OpenLink Software
>http://www.openlinksw.com
>XML & E-Business Infrastructure Technology Provider
>
>
>
>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>> Sent: Friday, January 19, 2001 1:59 AM
>> To: [EMAIL PROTECTED]
>> Cc: [EMAIL PROTECTED]
>> Subject: [PHP-DB] odbc_columns() and DB2
>>
>>
>> Okay, here's the problemo.
>>
>> I make a connection to the DB2 database, and run an
>> odbc_tables() call on it.  No problem.  I run an odbc_columns()
>> on it just fine.  Now I call a SECOND odbc_columns() (on a
>> different table) and get a SIGSEGV and a core dump.  *blink*
>>
>> I cracked open php_odbc.c and put some tracing code in.  The
>> SQLColumns() call returns a column count of -18- (which is too
>> many anyways) and returns code 100.  Oky.  So now
>> we run a SQLGetDiagRec() and look at the SQLSTATE.  Okay,
>> here we go!  It'sum  I'll also SIGSEGV if I put in any
>> SQLFetch() calls.  Obviously the SQLColumns() call is not working
>> correctly, and the 18 is just random (but consistant) memory.
>>
>> odbc_columns($link,"","",$tablename,"");
>> odbc_columns($link,"","",$tablename);
>>
>> They both eval to the same thing in the C code, and they both cause
>> SIGSEGV.  $tablename is valid, as is the resource.  I tried odbc_connect()
>> and odbc_pconnect() with no avail (although I DID notice that the resource
>> IDs were the SAME for odbc_connect() and varied for odbc_pconnect() with
>> seems backwards to me.)
>>
>> Also, if you "mess up" either odbc_columns() or odbc_tables() calls
>> you'll SEGV as well.
>>
>> This is against IBM DB2 v7.1 running under Linux.  I can make queries
>> and run "plain SQL" against it without any problems.  I'd post my
>> PHP version
>> but our ISP blows and our SmartJack isn't very smart so I can't access it
>> right now.  It's 4.0.4something and pulled down/built about 7-10 days ago.
>> With the T1 being down, I can't get access to newer builds, so
>> these problems
>> may have already been addressed.  That should change tomorrow. (*sigh*
>> Silicon Valley California and we can't keep either our T1s or our
>> power up.
>>  How
>> very ironic.)
>>
>> The other "scary" part is in my php code.  I have a loop that does,
>> effectively
>> this, in pseudo code...
>>
>> $result = odbc_tables();
>> $counter = 0;
>> while (odbc_fetch($result) > 0)
>> {
>>  Get a column name
>>  Run odbc_columns() on it
>>  $counter++;
>> }
>>
>> echo $counter;
>>
>>
>> Spooky part is, and I've pinned it down to the odbc_columns() calls,
>> $counter always ends up as -120!  Now, if I add one line, right below the
>> $counter++; line, like so
>>
>> $result = odbc_tables();
>> $counter = 0;
>> while (odbc_fetch($result) > 0)
>> {
>>  Get a column name
>>  Run odbc_columns() on it
>>  $counter++;
>>  echo $counter;  // < new string here
>> }
>>
>> echo $counter;
>>
>> Suddenly $counter comes out to +20, which is correct.  If I do
>> NOT add the
>> extra echo line but DO comment out the odbc_columns() call I get the
>> correct +20 as well.  It's not a scoping issue...nothing "should"
>> change by
>> adding in an echo...
>>
>> Memory overwrite that's compensated by t

[PHP-DB] odbc_columns() and DB2

2001-01-18 Thread szii

Okay, here's the problemo.  

I make a connection to the DB2 database, and run an
odbc_tables() call on it.  No problem.  I run an odbc_columns()
on it just fine.  Now I call a SECOND odbc_columns() (on a
different table) and get a SIGSEGV and a core dump.  *blink*

I cracked open php_odbc.c and put some tracing code in.  The
SQLColumns() call returns a column count of -18- (which is too
many anyways) and returns code 100.  Oky.  So now
we run a SQLGetDiagRec() and look at the SQLSTATE.  Okay,
here we go!  It'sum  I'll also SIGSEGV if I put in any
SQLFetch() calls.  Obviously the SQLColumns() call is not working
correctly, and the 18 is just random (but consistant) memory.

odbc_columns($link,"","",$tablename,"");
odbc_columns($link,"","",$tablename);

They both eval to the same thing in the C code, and they both cause
SIGSEGV.  $tablename is valid, as is the resource.  I tried odbc_connect()
and odbc_pconnect() with no avail (although I DID notice that the resource
IDs were the SAME for odbc_connect() and varied for odbc_pconnect() with
seems backwards to me.)

Also, if you "mess up" either odbc_columns() or odbc_tables() calls
you'll SEGV as well.

This is against IBM DB2 v7.1 running under Linux.  I can make queries
and run "plain SQL" against it without any problems.  I'd post my PHP version
but our ISP blows and our SmartJack isn't very smart so I can't access it
right now.  It's 4.0.4something and pulled down/built about 7-10 days ago.
With the T1 being down, I can't get access to newer builds, so these problems
may have already been addressed.  That should change tomorrow. (*sigh*
Silicon Valley California and we can't keep either our T1s or our power up.
 How
very ironic.)

The other "scary" part is in my php code.  I have a loop that does,
effectively
this, in pseudo code...

$result = odbc_tables();
$counter = 0;
while (odbc_fetch($result) > 0)
{
Get a column name
Run odbc_columns() on it
$counter++;
}

echo $counter;


Spooky part is, and I've pinned it down to the odbc_columns() calls,
$counter always ends up as -120!  Now, if I add one line, right below the 
$counter++; line, like so

$result = odbc_tables();
$counter = 0;
while (odbc_fetch($result) > 0)
{
Get a column name
Run odbc_columns() on it
$counter++;
echo $counter;  // < new string here
}

echo $counter;

Suddenly $counter comes out to +20, which is correct.  If I do NOT add the 
extra echo line but DO comment out the odbc_columns() call I get the
correct +20 as well.  It's not a scoping issue...nothing "should" change by
adding in an echo...

Memory overwrite that's compensated by the "echo..." line (padded like
a debug build?)

I'm going to keep trying to trace it, but if anyone's heard/seen such oddities
before or has any idea what's going on please drop me a line.  The next level
is the ODBC wrapper around the DB2 CLI calls...maybe something odd
happening in there.  Anyone have any hints where that level is?

Oh, one final touch - if I odbc_result_all() the first odbc_columns()
result, I
get a whole lot of what looks to be random strings.  I can see parameter
lists where there should be names or schemas for example.
Again, it looks like random memory.  If SQLColumns() is failing though,
when the bindcols() method is called it'll bind random stuff, so it's not
terribly unexpected.

Does PEAR use these same libraries, or is it a newer more robust
implementation?

Thanks in advance..

-Szii




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