Re: [PHP-DB] select query across multiple tables

2004-08-26 Thread jeffrey_n_Dyke


> I'm trying to pull all the records from the table class where classID is
> not equal to the value of classID in the table assignment.

> Currently, I have 'select class.classID, class.classDesc from class,
> assignment where assignment.classID >= class.classID and
> assignment.assignmentID=$assidn'. $assidn is value of
> assignment.assignmentID.

> When I do this query, I am missing a good chunk of records. What am I
> doing wrong?

You're only getting the rows that are less then or equal to class.classID,
i think you want <> or not equal to.
HTH
Jeff

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



RE: [PHP-DB] MySQL to EXCEL?

2004-08-17 Thread jeffrey_n_Dyke



>>
>> I don't know how you have it setup.
>>
>> But you can create a XLS file on the fly using PHP
>>
>> By using header...
>
>> header("Content-Type: application/vnd.ms-excel");
>> header("Content-Dispostion: attachemnt; filename='Project.xls'");
>> header("Pragma: no-cache");
>> header("Expires: 0");
>>
>>
>> Then just echo your results from your query, like normal...

> Could you expound on this?  What field delimiter are you using?

You can use

  


and each tr becomes an excel row and each td becomes a cell.  This may or
may not work in/before excel97??

If you're looking to create true excel files, then i highly suggest
spreadsheetwrite_excel,
It is an excellent codeset, enabling you to use many features of excel such
as colors, math, formats, etc.

doing it this way, is little to no different from exporting in csv format,
but it does work
as described.

HTH
Jeff


>
>
> You have just created a XLS from PHP...Which can be saved to a XLS
> Workbook...

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

2004-08-02 Thread jeffrey_n_Dyke



> I'd really like to find a Linux distro that is a LAMP system right out
> of the box.
> (Linux, Apache, MySQL, PHP)
> Are there any out there?

You should be able to activate all with Fedora and SuSe, from the disks.
You may still have to build PHP(on FC?), but IMO you'll want to do that
anyway based on what you wish to use it for.  If you're just looking for
the basics, get it from rpm.  from rpmfind.net

HTH
Jeff


> Cheers,
> Gav

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

2004-08-02 Thread jeffrey_n_Dyke


>Okay,  I am new to PHP but very good with many other scripting languages.


>I use 'mysql_connect("localhost" yada yada'

>to connect to a database from the domain but I want to put this code on a
few sites and have it access one database >on the primary domain.

>How do I write that command?  I googled for about an hour this morning at
3:00am so I might have missed it but if >someone can point me to where I
might find an example command?

Its same command, except you use your hosts address/DNS in lieu of
localhost
mysql_connect('123.132.123.123','yadda','yadda');
or
mysql_connect('mydomain.tld','yadda','yadda');

Of course you need to make sure that you can connect remotely to the MySQL
db, by assiging the appropriate permissions with GRANT, and ensure that any
firewall ports are opened, if applicable.

HTH
Jeff

>Thanks

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

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



Re: [PHP-DB] howto get PK id after INSERT??

2004-07-20 Thread jeffrey_n_Dyke



> I think I got it correct got the most part. I am having a problem with
> the urlencode function I believe.

> On page CustomerAddNew1.php ( page than handles form data ) im using:

> $last_id = mysql_query("SELECT LAST_INSERT_ID() from customerinfo");
> $last_id = urlencode ($last_id);

Why encode an integer?  even if the number is 123456789 it will still be
123456789

> header("Location: UserMain.php?custid='$last_id'");
How about ...
header("Location: UserMain.php?custid={$last_id}");  // { } - not needed

It looks like the URL you're requesting would be UserMain.php?custid='3'
Single quotes should not be used in a query string.  Take a look at the
location bar when on this page and see if the quotes are there(they may
have been encoded by the browser?), if so, they are in your mysql query.
either way, that is likely where the sql is failing.

HTH
Jeff

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



Re: [PHP-DB] fetch row DISTINCT

2004-07-08 Thread jeffrey_n_Dyke




> I'm using PHP with mySQL since a long time.
> But now I got a question:

> I need to generate a SQL-Statement to fetch rows with one DISTINCT
criteria.

> To make things clear: I don't want to fetch a single DISTINCT column, I
want
> to fetch the whole row, where one column is DISTINCT.

> Can someone explain me how to do this?

if i understand correctly this should work
--> select * from table group by distinct_col
hth
jeff
> Kind regards
> Lars Hilsebein


__
  [EMAIL PROTECTED]
--
mock&more i-net-solutions(r)
Horstmarer Landweg 107
D-48149 Muenster
Tel.  +49 251 14490-200
Durchwahl 14490-201
Fax   14490-240
mobil +49 177 3295900
Mail [EMAIL PROTECTED] 
==

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



Re: [PHP-DB] Date problem: data is current as of yesterday

2004-07-02 Thread jeffrey_n_Dyke


accidentally replied only to karen.

> The database queries all the sources at night after everyone has gone
home. That means the data was current as of yesterday. This little snippet
below returns yesterday's date, except that the first day of the month
returns "0" for > the day. Now, I know why this is happening, but I can't
find out how to fix it (in VBA or SQL Server I would just > say,
"date()-1":

> $today = getdate();
> $month = $today['month'] ;
> $mday = $today['mday'] -1;
> $year = $today['year'];
> echo "Data is current  as of  $month $mday, $year";

you can do the same thing with php.

I'd use a timestamp and subtract 86400 (24 hours of seconds)

$yesterday_at_this_time = date("Y-m-d H:i:s", time() - 86400);

hth
Jeff
-
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!

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



Re: [PHP-DB] addslashes replacement?

2004-06-30 Thread jeffrey_n_Dyke




> I'm using php addslashes to store data into MySQL and php stripslashes
when
> pulling it back out, but I'm running into trouble when people enter HTML
> code.  Do you have any recommendations?

> Here's an example of what I'm talking about:
> ">
> An error occurs if the entry has a value of:
> this is a test.  Are we having FUN
yet?
> Any ideas or recommendations?

I guess it depends on what you want to do with that data.  if you want the
html to remain you could run htmlspecialchars against the input which would
convert characters based in the list at the top of this
page...http://www.php.net/manual/en/function.htmlspecialchars.php.

or if you want to get rid of the html use strip_tags()

or if neither work for you...addcslashes maybe good for you.  (i'm guesting
this is what you want, as there is also a corresponding stripcslashes() )

hth
jeff

> Thanks,

> -Ed

--
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] [slightly OT] OOP syntax

2004-06-30 Thread jeffrey_n_Dyke



On Wed, 30 Jun 2004 14:20:52 -0400, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> I have some procedural code that i'm wanting to convert into classes(and
> i'm a bit greeen to OOP), hopefully to offer them to the PHP community.
I
> keep all my config data in arrays of arrays, which i'd like to keep when
i
> move to a class model, but can't seem to find out the correct defintion
> syntax.
>
> for example, here is a portion of the array storing connection info to a
> mssql db(keeping it in db land)
> $srvr['etime'] = array();
> $srvr['etime']['server']= '27.22.1.5:1433';
> $srvr['etime']['db']  = 'dbmaster';
> $srvr['etime']['user']  = 'uname';
> $srvr['etime']['pass']  = 'pword';
> $srvr['etime']['title']   = 'eTime';
> $srvr['etime']['dfltch']= 'N';
> $srvr['etime']['optional']  = false;
>

>> var $srvr = array('etime' => array('server' => '27.22.1.5:1433',
>> 'db' => 'dbmaster',
>> etc.),
>> 'atime' => 'a value');

oh okay, thanks.  thats what i needed.

>> BTW, this looks like DB abstraction data. Have you looked into PEAR
>> DB, MDB, DB_DataObject, etc?

Its actually not DB Abstration data( i do use ADODB for that ).  This is
one db server and the rest of the servers in this code are ldap and ssh
connections to other servers(*nix and NT), but i wanted to keep it
db-related, if only slightly.

Thanks Justin

Jeff

> How would this need to be defined at the top of a class to taken on as a
> class variable/array.  Am i thinking of this wrong?
>
> I can add them all as scalar variables, but i'd rather work with arrays,
as
> i use the arrays to loop for other functions.  I've tried a variety of
> syntaxes, but keep getting parse errors.
>
> thanks for any info you can provide.
> Jeff
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> !DSPAM:40e3028f186817955031138!
>
>


--
paperCrane --Justin Patrin--

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



[PHP-DB] [slightly OT] OOP syntax

2004-06-30 Thread jeffrey_n_Dyke
I have some procedural code that i'm wanting to convert into classes(and
i'm a bit greeen to OOP), hopefully to offer them to the PHP community.  I
keep all my config data in arrays of arrays, which i'd like to keep when i
move to a class model, but can't seem to find out the correct defintion
syntax.

for example, here is a portion of the array storing connection info to a
mssql db(keeping it in db land)
$srvr['etime'] = array();
$srvr['etime']['server']= '27.22.1.5:1433';
$srvr['etime']['db']  = 'dbmaster';
$srvr['etime']['user']  = 'uname';
$srvr['etime']['pass']  = 'pword';
$srvr['etime']['title']   = 'eTime';
$srvr['etime']['dfltch']= 'N';
$srvr['etime']['optional']  = false;

How would this need to be defined at the top of a class to taken on as a
class variable/array.  Am i thinking of this wrong?

I can add them all as scalar variables, but i'd rather work with arrays, as
i use the arrays to loop for other functions.  I've tried a variety of
syntaxes, but keep getting parse errors.

thanks for any info you can provide.
Jeff

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



Re: [PHP-DB] PHP with Javascript tutorials?

2004-06-25 Thread jeffrey_n_Dyke



> Hi there everyone,
Hello.
> I've been looking on Google for PHP Javascript tutorials but I can't find
> any.  I'm new to Javascript but can use PHP for what I need.  I was
hoping
> someone would know of a tutorial that would show how to use PHP to get
2-3
> datasets which javascript can then use in forms.  For example, say I have
3
> pulldown boxes, one would have countries - such as UK, USA etc .. If you
> selected the UK it would bring up countries in the UK, and if you select
a
> country the third pulldown would show the cities in that country (This is
> just an example to hopefully explain what I need) but I don't want the
page
> to refresh everytime I select an option which it does if you just use
PHP.

Since they are two seperate languages, all you can really do is use PHP to
write dynamic Javascript or assign values to javascript variables with
php..  if you want the drop downs to be dynamic then you'll need to write a
function that makes a database call, gathers all the data and then writes
it to static arrays in a file that you can then read with Javascript and
create the drop downs from the arrays.

They are seperate, don't think of them as being able to work together to
much.  except that you can build JS using PHP.

HTH
Jeff

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



Re: [PHP-DB] Date Select

2004-06-25 Thread jeffrey_n_Dyke



>How can I query a MySQL table to get the latest results from a date field?
>Basically, I am inserting several records at a time at the end of each
week.
>I want to have a page that displays the results for the last week only.
>The date format in the field is -MM-DD


if you want the latest row -
  select * from table order by max(date_column) limit 1;

if you want rows in a range of dates there are lots o ways, and instead of
showing one or two, I'd suggest taking a look at the manual on dates
http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html, and seeing
what fits your needs best.  Seems like you may want to look at BETWEEN

And if you don't want to use those, you are always free to use
  select * from table where date_column < '-mm-dd' and date_column
< '-mm-dd' order by date_col desc

HTH
Jeff

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



Re: [PHP-DB] Value Error in execution

2004-06-23 Thread jeffrey_n_Dyke




>Dear all,
>Can you aswer for the Query as follow :
>if(isset(_POST['VARIABLE1']$$(_POST['VARIABLE2'])
>{>print "testing";
>STATEMENTS;
>}

I'm not sure how this is not throwing a fatal error.  Why do you have two
$'s in the middle and no $ preceeding variable names?

does this work?
if(isset($_POST['VARIABLE1']) && isset($_POST['VARIABLE2']) ) {
  print "testing";
}

HTH
Jeff


-
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!

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



Re: [PHP-DB] value error in PHP form

2004-06-21 Thread jeffrey_n_Dyke




>>Hi. You left out the 'php' after the '

See if that helps any.
~Philip

> 
> 
> 
> 
>  print $action;
> print $Name;
> ?>
> 
> 
> 

--
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] no temp var for mysql_fetch_array results

2004-05-12 Thread jeffrey_n_Dyke




>  Warning: mysql_result(): Unable to jump to row 0 on MySQL result index
4...

> Now this makes some sense; the manual says that

>   mysql_result ( resource result , int row )

> will jump to row $row in the output but says nothing about returning me a
> given fields.

> Any other thoughts?
Hey David...

Does this mean you are potentially brining back more then one row, and
mysql_result doesn't know where to get it from?  Does this change if you
add, LIMIT 1 to the query.

Most of the time when i have problems with mysql_result, it has to do with
more data coming back then i expected, or is a bad query, but you seem to
have the same one...

HTH
Jeff

>TIA again & HAND
>:-D
--
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

(See attached file: atteqfnd.dat)



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

Re: [PHP-DB] Linux/PHP/Access Database - oh boy :(

2004-05-12 Thread jeffrey_n_Dyke



>Hello all,


>Am I right in thinking I have very few options?   I don't want to move
over to ASP (would that even help?) because it means learning VBScript and
I don't have a >lot of time.  Also, I can't use another database (e.g.
MySQL) cos the server admin is NOT helping me and won't install anything
new.


ok.  I have not entirely thought this through, but if you're running a
linux machine and can install stuff in your web space, then potentially you
have another option.  But _only_ if PHP is already compiled with mysql
support.  Couldn't you grab a mysql binary from mysql.com(that matches your
client version compiled into PHP), and install it in your web space?  And
then use your linux user as the mysql user, and assign appropriate
permissions to the directory per the INSTALL-BINARY document in the
distrobution.  or, even better, if you know the name of your web user
(apache user)..you could also start it as that user, removing the security
hole of using yours (which i'm sure has elevated rights).


And i didn't think you could run COM on anything but a Widoze PHP build?
adn you're on Linux?


anyway... just an idea and maybe not a good one.  But looks like you're
stuck.  There are potential issues, but  well, again..just an idea.


HTHGood Luck!


Jeff








Alex Gemmell


¦:¦ Reply-to: [EMAIL PROTECTED] ¦:¦





Or call me for free using Skype:











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



Re: [PHP-DB] no temp var for mysql_fetch_array results

2004-05-11 Thread jeffrey_n_Dyke



>Hi, all --

>I have some code which looks about like

>  if ( $_POST['signup']['referrer'] )   # a friend?
 > {
 >   $q = "select InvitedBy from customer where EMail
= '{$_POST['signup']['referrer']}'" ;
 >   $r = mysql_query($q,$dbro) ;
 >   $row = mysql_fetch_array($r) ;
 >   $i = $row[0] ;
 > }
 > else
 # no referrer supplied
 >   { $i = '' ; }

>and I would really prefer not to have to use $row just to set $i.  Since
>mysql_fetch_array() returns an array, and I know I want a field from just
>this one row (not looping), could I just

>  $i = mysql_fetch_array($r)[0] ;

Hi David
  How about:
  $i = mysql_result(mysql_query($q,$dbro),0);
HTH
Jeff

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



Re: [PHP-DB] Edit with notepad

2004-05-10 Thread jeffrey_n_Dyke


hi,

>header("Content-type: application/vnd-ms.word"); is not what my customers
>want. They may or may not want to save it in their harddisk.. but having
the
>header at the beginning of my page will force them to save it in their
>harddisk. Some of the customers just want to view it on the web while
others
>want to view it in Word and possibly edit it and then save it.. how can i
>achieve such flexibility for them?

This box is harldy ever a single option only.  There is usually both Open
and Save.
If you wish to give them the choice, create two links, one which goes to a
page with header() and one without.  Other ways i'm sure could be
built...JS Popup that reloads the parent window the the appropriate
action...

  HTH
  Jeff

>thank you!!

>regards,
>hwee

- Original Message -
From: "Neil Smith [MVP, Digital media]" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, May 11, 2004 2:25 AM
Subject: [PHP-DB] Re: Subject: Edit with notepad


> Send before any content, an MS-Word header :
>
> header("Content-type: application/vnd-ms.word");
>
> Then output your HTML.
> Cheers - Neil.
>
>
> At 07:41 10/05/2004 +, you wrote:
>
> >Message-ID: <[EMAIL PROTECTED]>
> >From: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
> >To: "DBList" <[EMAIL PROTECTED]>
> >Date: Mon, 10 May 2004 15:40:27 +0800
> >MIME-Version: 1.0
> >Content-Type: multipart/alternative;
> >boundary="=_NextPart_000_00D2_01C436A5.1E3B4100"
> >Subject: Edit with notepad
> >
> >Hi
> >
> >My customers would like to save my php outputs in a word document file
and
> >so I have added a meta tag 
in
> >my php files. However, my File->Edit button in IE6 is greyed out. why? i
> >see that other php files on other websites allow Edit, why is it that my
> >programs don't allow it??
> >
> >thanx for any insights!!
> >
> >regards,
> >Hwee Hwee

--
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 (not works)

2004-05-10 Thread jeffrey_n_Dyke



>Thanks pepole.

>I've tried but still does not work.

>when I put the varaibles name between ' '

>I found this error:
>Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
>`T_NUM_STRING'.

>I typed in this way

> print "VALUE='$_POST[UserName]'>"; 

This is pre register_global concerns...
try ..
print ";
or
print ";
for a little better HTML.

HTH
Jeff

_
Use MSN Messenger to send music and pics to your friends
http://www.msn.co.uk/messenger

--
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] Problem with update-command

2004-04-22 Thread jeffrey_n_Dyke




>$result=mysql_db_query("usr_172_1","UPDATE artikel SET Preis='\$preis\'
WHERE ID='\$id\'");
>//mysql_error($result);

Here you're escaping the $ and then the ', have you tried

$result=mysql_db_query("usr_172_1","UPDATE artikel SET Preis='{$preis}'
WHERE ID='{$id}'");
with those escapes this is the actual query you're sending
"UPDATE artikel SET Preis='$preis\' WHERE ID='$id\'"

HTH
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] Graphing - bar charts

2004-04-06 Thread jeffrey_n_Dyke



>Hi there:
Hello,
>I am looking for an open source and simple PHP script that will graph
>(bar) a few MySQL fields.  Does anyone have any recommendations?

I'd suggest the jpgraph OO lib.  Very easy to get simple graphs up and
running.  so long as you have gd/jpeg available to your php.  With some,
not alot, more work you can start utilizing many of its features for more
complex graphs.

HTH
jeff
__
Craig Hoffman - eClimb Media

v: (847) 644 - 8914
f: (847) 866 - 1946
e: [EMAIL PROTECTED]
w: www.eclimb.net
_

--
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] to many files!

2004-03-31 Thread jeffrey_n_Dyke


>I am accumulating way to many PHP files in my home directory.  It is
>very difficult to sift through all the files.
>I use a lot of "includes" and "requires" so it is difficult to organize
>them in folders even if I change back a directory with my requires
>using  "..\".
>Does anyone know of a better way to organize a huge spiderweb of
documents?

Sounds like you need to use the global include path, or set your own in
php.ini.
Then you can organize how you wish and never need to know what web dir
you're in
just use:

require_once 'file.php' in the root and
require_once 'folder/file.php' in subdirectories.

this folder is /path/to/php/lib/php or c:\php\lib\php (though i don't use
windoze)
It is also the folder where all Pear classes are held.

HTH
Jeff

>Matt

--
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: Recursive photo gallery removal problem.

2004-03-26 Thread jeffrey_n_Dyke


>No solutions or feedback?
>:(
>-Tom Reed
>[EMAIL PROTECTED]

_
How do you select _all_ the images from Folder B?  Can you show that
statement?

In every delete you're able to do against a database table,  you should
first be able to run a select and basically replace 'select [stuff]'  with
delete.
Now this rule is a little shakey when it comes to deleting from multiple
tables using joins, but similar logic applies.

I'm a little confused by your structure, this looks to me that it may have
been more appropriate to use multiple tables to build relationships.  Thats
not to say i'm right...cause i may not be.

HTH
Jeff



"Tom Reed" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I designed a photo gallery system, in which I allow users to create
> recursive photo "folders."  The trouble I am having is being able to
delete
> a photo folder, and all folders/photos within it.
>
> Example structure:
>
> Main Folder
>   - Folder 1
>  - Folder a
>  - Folder b
>  - Folder i
>  - Folder ii
>- Folder aa
>-Folder bb
>   - Folder 2
>   - Folder 2a
>...
>
> I am having trouble creating code to delete all folders within the folder
> they choose to delete.
>
> Say I want to delete "Folder b."  In addition to deleting "Folder b," the
> code also needs to delete folders "Folder i," "Folder ii," "Folder aa,"
and
> "Folder bb."
>
> Here's how I've setup the photo gallery table:
>
> CREATE TABLE `gallery` (
>   `uniqueid` int(11) unsigned default NULL,
>   `gallery` int(11) default NULL,
>   `image` varchar(255) default NULL,
>   `height` int(11) default NULL,
>   `width` int(11) default NULL,
>   `thumbnail` varchar(255) default NULL,
>   `title` varchar(150) default NULL,
>   `description` text,
>   `location` int(11) unsigned default NULL,
>   `uploaded_by` int(11) default NULL
> ) TYPE=MyISAM;
>
> uniqueid is the id of the folder.
> gallery is the folder depth (0=photo, 0=main folder, 1=sub folder level
1,
> 2==sub folder level 2...)
> location is the folder this sub-folder is located in
>
> Seems this code may be fairly complex.  I've made about three attempts,
with
> no success and I figured this would be the best place to ask.
>
> Any help would be appreciated.
>
> -Tom Reed
> [EMAIL PROTECTED]

--
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] Strange problem with mySQL

2004-03-25 Thread jeffrey_n_Dyke




>I am trying to update a database that I use to store user names and the
hashed values of passwords. The database name is Login, the table is
"users".


>I have the following commands in my php file.


>@ $db=mysql_pconnect('localhost','apache','password');
>mysql_select_db('Login');
>  $query="UPDATE users set pw='$hash' WHERE id='$user'";
>$results = mysql_query($query);


>The result is always false. If I enter the value of $query into a console
(such as mysqlcc). The command works fine. Any ideas?


If it is false, mysql must be compaining about something, have your
tried.
$results = mysql_query($query) or die(mysql_error() . "  on query --> "
.$query);

hth
Jeff


>Thanks!


Craig --
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] exporting data to excel

2004-03-25 Thread jeffrey_n_Dyke




Do you set the content-type in the response header like in JSP and
servlets?
I've been reading the PHP Manual; where do you find stuff like this?

take a look at the header function
http://php.net/header
an example...ymmv

header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$filename" );
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
header("Pragma: public");

If you want to generate excel files with more features, take a look on
phpclasses.org.
There is a PHP port of the Perl Module SpreadsheetWriteExcell...

HTH
Jeff
___

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



Re: [PHP-DB] tick mark `

2004-03-22 Thread jeffrey_n_Dyke




Why is it when I have this ` tick mark in my query it works fine, but
when I remove them it I get an error?

___
This tells to mysql to NOT treat the word as the reserved word that it
_may_ be, but use it literally. and interval, i believe, is a reserved
word.  It is much like escaping special characters with \

HTH
Jeff



v: (847) 644 - 8914
f: (847) 866 - 1946
e: [EMAIL PROTECTED]
w: www.eclimb.net
_

--
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] mySQL Parse Error

2004-03-22 Thread jeffrey_n_Dyke




I have a table:

CREATE TABLE `cashmire` (`id` smallint(3) unsigned NOT NULL auto_increment,
`itemcode` varchar(25) NOT NULL default '', `collection` char(2) NOT NULL
default 'cl',
`promotion` char(1) default 'n', `bestSeller` char(1) default 'n',
`newArrival` char(1) default 'n', `size` varchar(15) default NULL, `colour`
varchar(30) default NULL,
`image` varchar(7) default NULL, `currency` char(3) default 'MRS', `price`
mediumint(8) unsigned NOT NULL default '0', `description` text, `purchased`
smallint(3) unsigned default NULL,
PRIMARY KEY (`id`), UNIQUE KEY `itemcode` (`itemcode`), ) TYPE=MyISAM;

When i run this SQL:

insert into cashmire ('itemcode', 'collection', 'promotion', 'bestSeller',
'newArrival', 'size', 'color', 'image', 'currency', 'price', 'description',
'purchased') values ('31474', 'cl', 'n', 'n', 'y', 'S-M-L-XL', 'AQ-BL-EC',
'', 'MRS', '8400', 'Long sleeve chunky roll neck cardigan (12 ply) with
high
ribbed welt and turn-back cuffs, authentic coconut buttons', '0')

I get:

You have an error in your SQL syntax. Check the manual that corresponds to
your MySQL server version for the right syntax to use near ''itemcode',
'collection', 'promotion', 'bestSeller', 'newArriva
_

Its dying on your first column, which i don't think should be quoted.  They
don't seem to be in the manual pages.

http://www.mysql.com/doc/en/INSERT.html

HTH
Jeff
_


I can't understand... tried googling but still no answer!

Can someone help me please,

regards,

nadim attari

--
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] Processing a fetched external page

2004-03-18 Thread jeffrey_n_Dyke


I'm working on a project that takes the content of a URL and does stuff
with the content. I've managed to extract the target url's html, and am
using str_replace to fix links, stylesheets etc. However, i'm stumped when
it comes to processing the text content.

Would anyone know how to isolate displayed text (anything in the body,
paragraph text, headings etc) and then manipulate this text on a word by
word basis?

_
Doesn't have much to do with databases, you may want to ask on php-general
for more help...but if you're looking for elements on a page then you may
want to parse the page for the specific elements with regular expressions
seeking out those individual tags.  or you can take in the entire page as a
string and use strip_tags.

http://www.php.net/strip_tags

HTH
jeff
___

Any suggestions appreciated,

Don

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



Re: [PHP-DB] javascript question

2004-03-08 Thread jeffrey_n_Dyke
   
 
  Gamze Başaran
 
  <[EMAIL PROTECTED]To:   "Php-Db ([EMAIL PROTECTED])" 
<[EMAIL PROTECTED]> 
  aat.com.tr>  cc: 
 
   Subject:  [PHP-DB] javascript question  
 
  03/08/2004 08:49 
 
  AM   
 
   
 
   
 








Hi everyone;

First of all I'm sorry maybe I musn't send this mail to this list but I
think that someone can help me. Here is my problem:

I use pear templates. In my html template file there is an javascript like
this:

function validateAll (objForm){   if
(objForm.comp_prg.selectedIndex == 0) {
 alert ("You must choose something");
 return false;
 }
  Return true;
}

This code is true. But I want to use php variable in this code. Alert
sentence must be a php_variable. I try

Alert(); or
Alert();


The tags are not valid php opening/closing tags, you alse have PHP and
Javascript sytax errors.  probably php-general is the best place for this
post.  Although this should work.

if you don't use a qoute(') in JS alerts then JS will think its a variable
name and not a string to be alerted.
Alert(''); or
Alert('');

hth
Jeff
---
But I it isn't work. Can anybody help me??

--
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] No data being put into the DB

2004-03-03 Thread jeffrey_n_Dyke



On Thursday 04 March 2004 08:08, Rich Hutchins wrote:

> Oh, and, normally, you reference the variables like so:
$_POST["varname"].
> I typically use the following syntax:
>
> "INSERT INTO tablename
> VALUES('".$_POST["varone"]."','".$_POST["vartwo"]."');

>>IMO it is better to use the braces syntax:
>>"insert into show
>>values('','{$_POST['Accnt_name']}','{$_POST['acc_num']}', ...)"

I'm not second guessing at all, just curious as to why?  Is it less work on
the parser?
Do you find it cleaner?  I've often used Richard's method myself, for the
color coding that shows
in my editors(Ultraedit and VIM) when concatenating with . , mainly for
readability...but have found myself, of late, using the braces more...

Thanks
Jeff

> In your query you have omitted the quotes. Don't know if that causes
> problems, but echoing out $addtocart would show that anyway.

>>Also ...

> mysql_close();
> $error = mysql_error();

>>call mysql_error() before you close the connection.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
If you give Congress a chance to vote on both sides of an issue, it
will always do it.
 -- Les Aspin, D., Wisconsin
*/

--
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's wrong with this query?

2004-02-26 Thread jeffrey_n_Dyke





An interesting thought. I tried this:

echo "Term: $search, Returns: $arrayword, UserIP: $ip";
$logit = mysql_query("INSERT INTO log SET term='$search',
returns='$arrayword', time=CURTIME(), date=CURDATE(), ip='$ip'");
echo "Query Value: $logit";

And got this on the page:

Term: skater, Returns: 312, UserIP: 192.168.1.234
Query Value:


-
mysql_query returns a Resource, which is not a printable 'string', You
could print_r($logit), or var_dump($logit) and you would most likely see
Resouce ID #3 (or some other number). So even if you're query excecutes
properly printing $logit will always show as you've written above.  The
same would hold true of an array, when just using print.

the returned value preceeds the function call in the manual.
from php.net/mysql_query
  resource mysql_query ( string query [, resource link_identifier])


hth
jeff
-


Notice that the variables are set with appropriate values, but the
$logit variable is blank. This, I think is the problem. The question is
why would it do this and not return any type of error? By the way, I
tried this using the other syntax people where suggesting and I got the
same results. I gotta tell you, this one is really kicking my ass. It's
the last piece of an update that I can't release until it's finished.

Nick

Hutchins, Richard wrote:

>Been kind of following this thread off and on...
>
>If the syntax is acceptable by MySQL, which it appears to be, is it
possible
>that the variables you are using within the query string are not set to
>anything? Or is it possible that there is something broken immediately
>before the query string is fired?
>
>Most times, when I run into query problems, immediately before I send the
>query to the database, I'll echo the statement out to the browser so I can
>see the exact string that's being sent to the db.
>
>So can you do this:
>
>$sql = "INSERT INTO log SET term='$search', returns='$arrayword',
>time=CURTIME(), date=CURDATE(), ip='$ip'";
>
>echo $sql;
>
>$logit = mysql_query($sql) or
>die(mysql_error());
>
>
>And check out what gets spit out to the browser when $sql is echoed? Maybe
>that'll point out something that's going wrong. If nothing is apparent,
post
>the results of echo $sql back to the list and maybe one of us will find
>something.
>
>HTH.
>
>Rich
>
>
>
>>-Original Message-
>>From: Axel IS Main [mailto:[EMAIL PROTECTED]
>>Sent: Thursday, February 26, 2004 2:37 PM
>>To: PHP DB
>>Subject: Re: [PHP-DB] What's wrong with this query?
>>
>>
>>Ok, ok. I get the message about the syntax. Since I've used
>>this syntax
>>for a long time and so far there hasn't been a problem I'll assume
>>that's not the problem. I will, however, review this and
>>probably make
>>some changes for the sake of compliance if nothing else. In
>>any event,
>>the syntax is NOT why it is failing, smart ass comments by people who
>>think two years is a long time not withstanding.
>>
>>As to the useful questions that where asked. There is no
>>error reported.
>>Error reporting is set to E_ALL & ~E_NOTICE. I removed the
>>notice part
>>so I would get everything and still nothing showed up. I'm
>>also logging
>>errors and nothing is showing up in the log either. Not all PHP/MySQL
>>errors are reported. Sometimes what happens is not considered
>>an error,
>>even though it does not do what you would expect it to do. If
>>the query
>>syntax was wrong, I would get a syntax error. There is no
>>error, it just
>>doesn't write to the table. I can go into phpMyAdmin and with
>>the same
>>syntax insert into the table all day long.
>>
>>--
>>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's wrong with this query?

2004-02-26 Thread jeffrey_n_Dyke




Ok guys, I found the problem. It's actually something I've run into
before. If you take a look at the query you'll notice that one of the
fields is named "returns". When I created the test table with phpMyAdmin
it created it and everything seemed fine. Then I decided to try
something. I tweaked my install script to add creation of the new log
table and ran it. It failed on that field. When I changed the name of
the field it worked. I've seen this before when I tried to create a
field for another database called "group". Apparently these are MySQL
reserved words and you can't use them as names for fields. Go figure.
Anyway, that solves the problem. When I run it the data is put into the
table, and the line where I echo the $logit var displays a 1. By the
way, I changed the name of the returns field to "found".


just as an FYI, although i would have changed the name as well, if you're
using, or think you are using, a reserved word, you can enclose it in
`backticks` and mysql will treat it as a regular word, which is how
PHPMyAdmin creates and uses all fields. That being said, your solution of
changing the field is better.

Jeff
-


Nick

Micah Stevens wrote:

>Right.. a resource.. sorry.
>
>On Thursday 26 February 2004 12:55 pm, [EMAIL PROTECTED] wrote:
>
>
>>An interesting thought. I tried this:
>>
>>echo "Term: $search, Returns: $arrayword, UserIP: $ip";
>>$logit = mysql_query("INSERT INTO log SET term='$search',
>>returns='$arrayword', time=CURTIME(), date=CURDATE(), ip='$ip'");
>>echo "Query Value: $logit";
>>
>>And got this on the page:
>>
>>Term: skater, Returns: 312, UserIP: 192.168.1.234
>>Query Value:
>>
>>
>>-
>>mysql_query returns a Resource, which is not a printable 'string', You
>>could print_r($logit), or var_dump($logit) and you would most likely see
>>Resouce ID #3 (or some other number). So even if you're query excecutes
>>properly printing $logit will always show as you've written above.  The
>>same would hold true of an array, when just using print.
>>
>>the returned value preceeds the function call in the manual.
>>from php.net/mysql_query
>>  resource mysql_query ( string query [, resource link_identifier])
>>
>>
>>hth
>>jeff
>>-
>>
>>
>>Notice that the variables are set with appropriate values, but the
>>$logit variable is blank. This, I think is the problem. The question is
>>why would it do this and not return any type of error? By the way, I
>>tried this using the other syntax people where suggesting and I got the
>>same results. I gotta tell you, this one is really kicking my ass. It's
>>the last piece of an update that I can't release until it's finished.
>>
>>Nick
>>
>>Hutchins, Richard wrote:
>>
>>
>>>Been kind of following this thread off and on...
>>>
>>>If the syntax is acceptable by MySQL, which it appears to be, is it
>>>
>>>
>>possible
>>
>>
>>
>>>that the variables you are using within the query string are not set to
>>>anything? Or is it possible that there is something broken immediately
>>>before the query string is fired?
>>>
>>>Most times, when I run into query problems, immediately before I send
the
>>>query to the database, I'll echo the statement out to the browser so I
can
>>>see the exact string that's being sent to the db.
>>>
>>>So can you do this:
>>>
>>>$sql = "INSERT INTO log SET term='$search', returns='$arrayword',
>>>time=CURTIME(), date=CURDATE(), ip='$ip'";
>>>
>>>echo $sql;
>>>
>>>$logit = mysql_query($sql) or
>>>   die(mysql_error());
>>>
>>>
>>>And check out what gets spit out to the browser when $sql is echoed?
Maybe
>>>that'll point out something that's going wrong. If nothing is apparent,
>>>
>>>
>>post
>>
>>
>>
>>>the results of echo $sql back to the list and maybe one of us will find
>>>something.
>>>
>>>HTH.
>>>
>>>Rich
>>>
>>>
>>>
-Original Message-
From: Axel IS Main [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 26, 2004 2:37 PM
To: PHP DB
Subject: Re: [PHP-DB] What's wrong with this query?


Ok, ok. I get the message about the syntax. Since I've used
this syntax
for a long time and so far there hasn't been a problem I'll assume
that's not the problem. I will, however, review this and
probably make
some changes for the sake of compliance if nothing else. In
any event,
the syntax is NOT why it is failing, smart ass comments by people who
think two years is a long time not withstanding.

As to the useful questions that where asked. There is no
error reported.
Error reporting is set to E_ALL & ~E_NOTICE. I removed the
notice part
so I would get everything and still nothing showed up. I'm
also logging
errors and nothing is showing up in the log either. Not all PHP/MySQL
errors are reported. Sometimes what happens is not considered
an error,
even though it does not do what you would expect it to do. If
the query
syntax was wrong, I would get a syntax error. There is no
>>>

Re: [PHP-DB] Strange DB Error

2004-02-25 Thread jeffrey_n_Dyke
   

   

   









>Error trapping is not really relevant here as the server is properly
configured so the errors are going to show up in either event. In fact,
using the die() >function on my server just makes thing worse.

---
it'll definitely make it worse, but hopefully only to find the problem and
make it better.  you should be able to find the query on which this is not
a valid resource run that agains't mysql and find out why its failing,
if you can't see that from $qry being in die().  but yes, a bad idea in
production.   send the output to a file on error and see what your
getting.the error that you want is from mysql_query, the error that you're
showing is from mysql_fetch_array(), so if the server is configured to show
them elsewhere then the answer should be right before the error below


hth
jeff


In any case, the var_dump was a good idea as I was able to find out that
what is happening is when this loops up after the first run through the
array is blank. It doesn't reinitialize the array with the new values. As
far as the $cat, or any of the other variables go, they're always the same
when returning to he index. Whether I initialize them from the query
string, or in the index itself as in the case when it is loaded without any
parameters. The question is, why wouldn't the array be redefined on the
second loop? Hell if I know.

Nick

[EMAIL PROTECTED] wrote:





When returning to the main page of my script sometimes I'll get
the
following error:



Warning: mysql_fetch_array(): 8 is not a valid MySQL result
resource in
/home/nick/http/search/includes/main.inc on line 13



This happens only AFTER the first element in the resource has
been
processed. Here's the code that is causing the problem:


  First, i'd place an... or die (mysql_error()) after your mysql call.
  so
  you can see what mysql is complaining about.  basically your sql is
  failing.  I also like to split the first two items, when debegging,
  to see
  what the actual query was.  i.e.
  
  $qry = "SELECT * FROM categories WHERE length(cat)='2'";
  $s = mysql_query($qry) or die (mysql_error() . "\n"" . $qry .
  "\n");
  


  The only time i saw the error on your page the 'cat' GET variable was
  defined as 0.  Is this really a static query like below, or is it
  based on
  what is passed to the page in the query string?  The URL when it
  died...
  http://www.icesource.com/index.php?depth=0&cat=0&index=main.inc,
  which to
  me looks like a bad querystring, but may indeed be valid values.



  If that doesn't lend itself to any useful information, try
  var_dump($t); in
  your while loop, to see what has been processed and what is failing.

  HTH
  Jeff


$s = mysql_query("SELECT * FROM categories WHERE
length(cat)='2'");
while($t = mysql_fetch_array($s)){>$cat = $t["cat"];
   $name = $t["name"];
   if($tstruc == $dirwidth){>echo "";
   $tstruc = 0;
   }
   echo "$name";




   $subcat = mysql_unbuffered_query("SELECT * FROM categories
WHERE
length(cat)='4' && substring(cat,1,2)='$cat' ORDER BY cat");
   while($ct = mysql_fetch_array($subcat)){>$scats

  = $ct["name"];

   $dcats = $dcats . $scats . ", " ;
   }
   $dcats = trim(substr($dcats, 0, 28)) . trim("...");
   if($dcats != "..."){>echo "" . $dcats . "";
   }
   $dcats = "";
   echo "";
   ++$tstruc;
}



You can go to the site http://www.icesource.com to see this
script in
action. This is an intermittent problem so you may not see it
at the
site, but it does happen there sometimes. If you click on one
of the
categories on the list there, and to two or three deep, then
hit the
Home link at the top left of the listings there's a pretty good
chance
you'll see the problem. I've been trying to figure this out for
a long
time, and nothing seems to work. Any ideas out there would be
greatly
appreciated.



Nick

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

Re: [PHP-DB] Strange DB Error

2004-02-25 Thread jeffrey_n_Dyke





>When returning to the main page of my script sometimes I'll get the
>following error:

>Warning: mysql_fetch_array(): 8 is not a valid MySQL result resource in
>/home/nick/http/search/includes/main.inc on line 13

>This happens only AFTER the first element in the resource has been
>processed. Here's the code that is causing the problem:

First, i'd place an... or die (mysql_error()) after your mysql call.  so
you can see what mysql is complaining about.  basically your sql is
failing.  I also like to split the first two items, when debegging, to see
what the actual query was.  i.e.

$qry = "SELECT * FROM categories WHERE length(cat)='2'";
$s = mysql_query($qry) or die (mysql_error() . "\n"" . $qry .
"\n");


The only time i saw the error on your page the 'cat' GET variable was
defined as 0.  Is this really a static query like below, or is it based on
what is passed to the page in the query string?  The URL when it died...
http://www.icesource.com/index.php?depth=0&cat=0&index=main.inc, which to
me looks like a bad querystring, but may indeed be valid values.

If that doesn't lend itself to any useful information, try var_dump($t); in
your while loop, to see what has been processed and what is failing.

HTH
Jeff

>$s = mysql_query("SELECT * FROM categories WHERE length(cat)='2'");
>while($t = mysql_fetch_array($s)){>$cat = $t["cat"];
>$name = $t["name"];
>if($tstruc == $dirwidth){>echo "";
>$tstruc = 0;
>}
>echo "serif,helvetica\" size=\"3\">href=\"index.php?index=directory.inc&cat=$cat&name=$name&depth=0\">$name";

>$subcat = mysql_unbuffered_query("SELECT * FROM categories WHERE
>length(cat)='4' && substring(cat,1,2)='$cat' ORDER BY cat");
>while($ct = mysql_fetch_array($subcat)){>$scats
= $ct["name"];
>$dcats = $dcats . $scats . ", " ;
>}
>$dcats = trim(substr($dcats, 0, 28)) . trim("...");
>if($dcats != "..."){>echo "size=\"1\">" . $dcats . "";
>}
>$dcats = "";
>echo "";
>++$tstruc;
>}

>You can go to the site http://www.icesource.com to see this script in
>action. This is an intermittent problem so you may not see it at the
>site, but it does happen there sometimes. If you click on one of the
>categories on the list there, and to two or three deep, then hit the
>Home link at the top left of the listings there's a pretty good chance
>you'll see the problem. I've been trying to figure this out for a long
>time, and nothing seems to work. Any ideas out there would be greatly
>appreciated.

>Nick

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



Re: [PHP-DB] PHP export to CSV

2003-12-22 Thread jeffrey_n_Dyke

using mysql as an example, this is what i do.

---UNTESTED CODE --
$sql = "SELECT * FROM TABLE";
$res = mysql_query($sql) or die(mysql_error() . "".$sql);
$fp = fopen("file_to_create.csv", "w");

while ($rs = mysql_fetch_row($res)) {
  $write_string = "\" . implode("\",\"", $rs) . "\" \n";
  fwrite($fp, $write_string);
}
fclose($fp);

This would produce a fully quoted csv file.  edit to you liking.

hth
Jeff




   
 
  "John Greco" 
 
  <[EMAIL PROTECTED]>To:   [EMAIL PROTECTED]   

   cc: 
 
  12/22/2003 10:20 Subject:  [PHP-DB] PHP export to CSV
 
  AM   
 
  Please respond to
 
  "John Greco" 
 
   
 
   
 




Anyone ever get some code to select from the DB and drop into a CSV file?

--
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] Get Names of columns of a table

2003-12-17 Thread jeffrey_n_Dyke

http://www.php.net/mysq_list_fields

hth
Jeff


   
 
  "Shaun"  
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  .com>cc: 
 
   Subject:  [PHP-DB] Get Names of columns 
of a table   
  12/17/2003 08:30 
 
  AM   
 
   
 
   
 




Hi,

is there a PHP function that wil return the names of the columns for a
given
table?

Thanks for your help

--
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] MySQL: getting latest record

2003-12-14 Thread jeffrey_n_Dyke

you've just about got it in your question.

SELECT * FROM MyTable WHERE Field1='test' OR Field2='test2' ORDER BY
TIMSTAMP DESC LIMIT 1

hth
Jeff


   

  "ShortStay"  

  <[EMAIL PROTECTED]To:   <[EMAIL PROTECTED]>  
  
  ondon.com>   cc: 

   Subject:  [PHP-DB] MySQL: getting 
latest record 
  12/14/2003 10:47 

  AM   

   

   





My application is that I am getting the latest quote for a price where more
than one quote may have been made.

I've got a timestamp colum and I want to get the latest record where
certain
columns have certain values.  Eg

SELECT * FROM MyTable WHERE Field1='test' ...?  something about the
timestamp

I may also have an OR in the condition, like WHERE Field1='test1' OR
Field2=test2'...'test1' and test2' would be different products.

Do I have to use ASCending or DESCending on the timestamp column and LIMIT?

Never done this before so suggestions gratefully received.

Thanks,

John

--
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 - RH Linux - Interbase

2003-12-06 Thread jeffrey_n_Dyke

Hey Todd.

I'm no guru...but have some familarity with these packages.  i think you
could remove the php rpm with rpm --erase php* and then recompile.  being
from other OS's myself, mainly solaris, i find it easier to build my own,
mainly b/c i know when it works and when it does not.(still a RH newbie)
but you don't have to remove it..  another option is to just install a new
version of PHP in another location.

when you configure PHP, use the two flags you mentioned and PHP *usually*
will modify the apache config file (httpd.conf) during `make install`.  If
it does not you need to make sure that the following lines are in
httpd.conf

LoadModule php4_modulelibexec/libphp4.so
AddModule mod_php4.c
AddType application/x-httpd-php .php

if you have apache in a special location(other then /usr/local) make sure
you give php the full path to apxs (--with-apxs=/path/to/apache/bin/apxs)

You should not need to tell apache where interbase is, only PHP will need
to know.

Hope this helped.
Jeff


   

  Todd Cary

  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
  
  are.com> cc: 

   Subject:  Re: [PHP-DB] PHP - RH Linux - 
Interbase   
  12/06/2003 08:21 

  PM   

   

   





Glen Webber wrote:
> Hi Todd,
>
> I'm running interbase, php,...  on deb.
> Happy to help if I can.
> Whats the issue your dealing with?
>
> G/
>
> Todd Cary wrote:
>
>> I am looking for someone that is running RH 9 Linux with Php &
>> Interbase...
>>
>> Todd

Glenn -

I greatly appreciate the offer to help.  Linux is NOT my usual OS, but I
do have 30 yrs experience (not to impress you, but just to let you know
that I have a pretty good understanding of programming - at least Delphi ).

I just just installed Fedora and there appears to be a problem running
rpm with rpm's created on other versions of Linux, so i may need to put
RH 9 back on and wait.  So, with that out of the way, here is where I
get confused:

1) How to remove the pre-installed version of php with all of the
dependencies.

2) Should I even do that?

3) If I configure the compile with "--with-interbase=/opt/interbase
--with-apxs", what do I need to do to Apache so that it knows where to
get the Interbase information, or do I need to do anything?

4) Though I have PHP and Interbase running on another Linux 9 box, I
lost the paper that told me how to do it.  That install used an
Interbase.so file that someone gave me.

5) Hopefully, you have the patience to get me cleared up on what I need
to do *and* this time I will put the notes in a safe place !!

Todd

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

2003-12-02 Thread jeffrey_n_Dyke

the web process does not have access to write the directory that oyu're
moving the file to.  in this case ./images/exec/.  most likely you'll need
to either chmod o+w ./images/exec (give the world the write right) or
change the owner of that directoyr to be the web process.  both come with
their owon security implications (from your path structure you look to be
on *NIX).

HTH
JEff


   
 
  "Hugh Dickinson" 
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  r.ac.uk> cc: 
 
   Subject:  [PHP-DB] Uploading files  
 
  12/02/2003 04:06 
 
  PM   
 
   
 
   
 




I'm trying to upload image files to the server using http file upload. The
files seem to make it to the sever okay, but once they're ther and I try to
move them to where I want them, I get the following error:

Warning: move_uploaded_file(./images/exec/Editor.jpg): failed to open
stream: Permission denied in
/home/hudson/misc/dtr8hcj/public_html/changeexec.php on line 24

Is this my fault, or is it due to some sever configuration beyond my own
control. The line of code the error refers to is:

if(move_uploaded_file($_FILES[$imagename]['tmp_name'],$imageurl))

where $_FILES[$imagename]['tmp_name'] is a valid variable, and the path
specified by $imageurl definitely exists.

Any help would be greatly appreciated.

Cheers

Hugh Dickinson

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

2003-11-25 Thread jeffrey_n_Dyke

www.php.net/mail




   
 
  redhat   
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  ic.com>  cc: 
 
   Subject:  [PHP-DB] send email   
 
  11/25/2003 08:43 
 
  AM   
 
   
 
   
 




I have created a simple form that dumps input information into a mysql
database.  The person that I created it for said it would be nice if it
would also notify him by email that an entry was added to the database.
I have no idea where to begin with that - any ideas?
thanks,
DF

--
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] how obtain last id past insert?

2003-11-20 Thread jeffrey_n_Dyke

if you're using mysql
  php.net/mysql_insert_id

if you're not, there may be a variant for you db

hth
Jeff


   
 
  "Webmaster   
 
  D.G.R.E.R."  To:   <[EMAIL PROTECTED]>   
  
  <[EMAIL PROTECTED]cc:
  
  ios.gov.ar>  Subject:  [PHP-DB] how obtain last 
id past insert?   
   
 
  11/20/2003 02:52 PM  
 
   
 
   
 




Hi:
How i obtain inmediatly the id of last insert ?
For example i have a forum, when the user post a question, i send a
mail
to administrator, but i want to refer the id from this insert, how i do
this
?
Well i think to make a select max(id) inmediatly but i beliebe that
must
have any colision from other user that post other question.
Thank you.

--
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] Linux/PHP with M$/SQL Server

2003-11-20 Thread jeffrey_n_Dyke

you can use freetds (http://freetds.org) i think there is even an rpm...
Then you just use the mssql_* functions built into php

hth
Jeff


   
 
  Matt Giddings
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  clink.net>   cc: 
 
   Subject:  [PHP-DB] Linux/PHP with 
M$/SQL Server  
  11/20/2003 09:40 
 
  AM   
 
   
 
   
 




Has anybody been able to bridge a Linux/php setup to a M$/SQL Server
database?  Is this possible using JDBC or a Unix ODBC connection to the
SQL Server?  Any pointers in the right direction would be greatly
appreciated.

Thanks,
Matt

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

2003-11-19 Thread jeffrey_n_Dyke

this is usually based on what your passing this function.  it can be a
result of a bad query or just a bad variable.  do you have the correct
variable that is holding a result of an ifx_query() call.

if you could post the prior lines of this that would probably make it
clearer.

also try var_dump($var); where the variable is what you are passing into
ifx_fetch_row.

it looks like you have passed in an variable  holding (int) 4

hth
Jeff


   
 
  Adam Williams
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  ate.ms.us>   cc: 
 
   Subject:  [PHP-DB] informix error   
 
  11/19/2003 01:01 
 
  PM   
 
   
 
   
 




Hi, I was wondering if anyone has seen this informix error before.  It has
me stumped.  Searching on google didn't reveal anything.  Running my query
in informix returns the proper results, so I'm not sure what the problem
is.

Warning: ifx_fetch_row(): 4 is not a valid Informix Result resource in
/usr/local/apache2/htdocs/alephpub/rg2a.php on line 86

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

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



[PHP-DB] Paradox tables

2003-11-11 Thread jeffrey_n_Dyke
if you can connect via odbc, you can use php with it.

i just googled -> paradox, database, php
and the first link will answer your question.

ps. Rosen  your email bouncesunknown user.
error --> 550 5.1.1 <[EMAIL PROTECTED]>... User unknown

hth
jeff
- Forwarded by Jeffrey N Dyke/CORP/Keane on 11/11/2003 07:49 AM -
   
 
  "Rosen"  
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  .com>cc: 
 
   Subject:  [PHP-DB] Paradox tables   
 
  11/11/2003 08:39 
 
  AM   
 
   
 
   
 




Hi,
Is there a way with PHP to process data from Paradox tables ?

Thanks,
Rosen

--
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] dynamic graph on web site

2003-11-10 Thread jeffrey_n_Dyke

jpgraph does a fantastic job of this, and is very easy to use.  I highly
reccomend it!!
http://www.aditus.nu/jpgraph/.



hth
Jeff


   
 
  "Hull, Douglas D"
 
  <[EMAIL PROTECTED]>  To:   "Note To php mysql List 
(E-mail)" <[EMAIL PROTECTED]>   
   cc: 
 
  11/10/2003 02:36 Subject:  [PHP-DB] dynamic graph on web 
site 
  PM   
 
   
 
   
 




In php/mysql is there a way to create a bar graph and/or a pie chart
dynamically and then push the chart to the web?  So depending on what
information was selected during the filtering process would determine what
data would be used to create the particular graph.

Thanks,
Doug

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

2003-11-10 Thread jeffrey_n_Dyke

i'd be curious what your actual problem is?

here's a question though.,...would these ever work?.
>>
if ((!isset($_POST['edit'])) or ($_POST = "")) {
 $_SESSION['table'] = "t_items";
 call_user_func("db_retrieve");
} elseif ((isset($_POST['edit'])) or (!$_POST = "")) {
<>>

You're basically setting a superglobal array equal to an empty string ->
 "".  this should at least be $_POST == ""...but
instead, i'd use
if ((!isset($_POST['edit'])) or (empty($_POST)) {
<--and -->
} elseif ((isset($_POST['edit'])) or (!empty($_POST))) {

hth
jeff



   
 
  "jas"
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  .com>cc: 
 
   Subject:  [PHP-DB] form not working...  
 
  11/10/2003 12:38 
 
  PM   
 
   
 
   
 




For some reason my form to edit selected items is not working, I think I
need a new set of eyes.
Any help is appreciated...
Jas

// inc.php
function db_retrieve() {
 require 'dbase.inc.php';
 $tble = $_SESSION['table'];
 $show = @mysql_query("SELECT * FROM $tble LIMIT 0, 15",$db)or
die(mysql_error());
   while ($row = @mysql_fetch_array($show)) {
@list($nItemSKU, $bActive, $nUserID, $nItemConfig, $tItemType,
$tDepartment, $blSerialNumber, $nPropertyNumber, $blHostName, $nIPID,
$tRoomNumber, $tNotes) = $row;
 $_SESSION['table'] .= "$nItemSKU
 $bActive
 $nUserID
 $nItemConfig
 $tItemType
 $tDepartment
 $blSerialNumber
 $nPropertyNumber
 $blHostName
 $nIPID
 $tRoomNumber
 $tNotes
 
"; }
 $_SESSION['number'] = mysql_num_rows($show); }


   
   $bActive
   $nUserID
   $nItemConfig
   $tItemType
   $tDepartment
   $blSerialNumber
   $nPropertyNumber
   $blHostName
   $nIPID
   $tRoomNumber
   $tNotes
   
  "; }
}
?>





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

2003-11-05 Thread jeffrey_n_Dyke

sweet.  thanks for hte correction.  i try, sometimes i fail. :)




   
 
  "CPT John W. 
 
  Holmes"  To:   "Dillon, John" <[EMAIL 
PROTECTED]>, <[EMAIL PROTECTED]>  
  <[EMAIL PROTECTED]cc:   <[EMAIL PROTECTED]>  
   
  rter.net>Subject:  Re: [PHP-DB] number_format 
problem 
   
 
  11/05/2003 11:56 
 
  AM   
 
  Please respond to
 
  "CPT John W. 
 
  Holmes"  
 
   
 
   
 




From: <[EMAIL PROTECTED]>
> could you cast as a float/double before inserting?  $number = (double)
> $string;
>
> don't know what would happen to the comma, but i assume it would just get
> removed??

Everything after and including the first non-number character would be
dropped.

So "$12,000.34" would end up as zero. "12,445" would end up as 12, etc...

---John Holmes...

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



Re: [PHP-DB] RE: [PHP] Re: Adding a log file

2003-11-05 Thread jeffrey_n_Dyke

 if you want actual errors that PHP generates and not logic based errors,
then writing your own error handling function and calling it with
set_error_handler() at the top of your scripts may work for you.  in your
function you'd just need to use $errorstr, $errorfile and $errline and log
it using error_log().


hth
jeff


   
 
  "Robert Sossomon"
 
  <[EMAIL PROTECTED]To:   <[EMAIL PROTECTED]>, <[EMAIL 
PROTECTED]>
  com> cc: 
 
   Subject:  [PHP-DB] RE: [PHP] Re: Adding 
a log file   
  11/05/2003 11:02 
 
  AM   
 
   
 
   
 




Like I said, syntactically bogus, I was trying to write it out fast
while I was away from the actual scripts...  Like I said, for the MOST
part the pieces are working, however on some items it is acting
correctly yet the items are not showing up in the shopping cart or in
the database anywhere.

Here's the script pieces.
//addtocart.php
   $addtocart = "insert into store_shoppertrack
values('','$_POST[SESSID]','$_POST[sel_item_id]','$_POST[sel_item_qty]',
'$_POST[sel_item_price]','$item_desc', now())";

   mysql_query($addtocart);

   //redirect to showcart page
   header("Location: showcart.php");

//Additem.php
   $addtocart = "insert into store_shoppertrack
values('','$_POST[SESSID]','$_POST[sel_item_name]','$_POST[sel_item_qty]
','$_POST[sel_item_price]','$item_desc', now())";

   mysql_query($addtocart);

//Addspec.php
   //add info to cart table
   $addtocart = "insert into store_shoppertrack
values('','$_POST[SESSID]','$_POST[sel_item_id]','$_POST[sel_item_qty]',
'$_POST[sel_item_price]','$_POST[sel_item_desc]', now())";

   mysql_query($addtocart);

//Seestore.php
/*
  The following code allows for the addition of a non-stock item.  All
information is added automatically to the quoter for the salesman.
*/

$display_block .= "Input a new item: Item ID:Description:Quantity: ";
$display_block .= "01";
for ($i=2; $i < 301; $i++){
 $display_block .= "$i";
}
$display_block .= "Price:";

$display_block .= "";

/*
  The following code allows for the addition of a stocked item.  All
information is added automatically to the quoter for the salesman.
*/

$display_block .= "Input item: ";
$display_block .= "Item ID:Quantity: ";
$display_block .= "01";
for ($i=2; $i < 301; $i++){
 $display_block .= "$i";
}
$display_block .= "";
$display_block .= "";
$display_block .= "Price:";
$display_block .= "";
$display_block .= "";

//categories.php
$display_block .= "$item_name
 - $item_desc";
$display_block .= "01";
for ($i=2; $i < 301; $i++){$display_block .= "$i";
}
$display_block .= "
~~~
A bachelor can only chase a girl until she catches him.


-Original Message-
From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 05, 2003 11:00 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP] Re: Adding a log file


$Addcart() -- is Addcart() a function (in which case you should remove
the dollar sign) or are you specifically trying to do some magic there
by running a function whose name is stored in that variable?

Bogdan

Robert Sossomon wrote:

> I am seeing some errors with a program I wrote and I need to write
> everything to a log file that the program is doing.
>
> The following syntax I KNOW is wrong, but not sure they are important
> to put here correctly yet. //script addtocart $Addcart (info1, info2)
> Mysqlquey($addcart)
>
> I am seeing random items NOT being added to my shopping cart.  The
> reason, I have no clue. I can pull another catgory of items and the
> first 20 will do fine, I go back to the first category I have and the
> script seems to work correctly but the data is not written to the
> shopping cart.  Problem with the shopping cart???  I wouldn't think
> so. Problem with the add page, I don't see how.  So where is the error

> coming from?  No clue, which is why I want to log everythi

Re: [PHP-DB] number_format problem

2003-11-05 Thread jeffrey_n_Dyke

could you cast as a float/double before inserting?  $number = (double)
$string;

don't know what would happen to the comma, but i assume it would just get
removed??

just a guess/thought
Jeff


   
 
  "Dillon, John"   
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  o.uk>cc: 
 
   Subject:  [PHP-DB] number_format 
problem 
  11/05/2003 10:29 
 
  AM   
 
   
 
   
 




I want to show a number from a database in the format x,xxx.00 in a
textfield, then if it is changed by the user I want to post the value of
the
number to a decimal field.  However, once you number_format the number it
becomes a string, and numbers like 3,379.90 give a value of 3 when posted
to
the database, which is hinted at in the notes on number_format.  I suppose
I
need a string to number function - can someone tell me what this might be
called please?

Regards,

John








































   http://www.cantor.com
CONFIDENTIAL: This e-mail, including its contents and attachments, if any,
are confidential. If you are not the named recipient please notify the
sender and immediately delete it. You may not disseminate, distribute, or
forward this e-mail message or disclose its contents to anybody else.
Copyright and any other intellectual property rights in its contents are
the sole property of Cantor Fitzgerald.
 E-mail transmission cannot be guaranteed to be secure or error-free.
 The sender therefore does not accept liability for any errors or
 omissions in the contents of this message which arise as a result of
 e-mail transmission.  If verification is required please request a
 hard-copy version.
 Although we routinely screen for viruses, addressees should check this
 e-mail and any attachments for viruses. We make no representation or
 warranty as to the absence of viruses in this e-mail or any
 attachments. Please note that to ensure regulatory compliance and for
 the protection of our customers and business, we may monitor and read
 e-mails sent to and from our server(s).

For further important information, please read the  Important Legal
Information and Legal Statement at
http://www.cantor.com/legal_information.html

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

2003-11-04 Thread jeffrey_n_Dyke

this should fix ya..

http://www.mysql.com/doc/en/Resetting_permissions.html

hth
Jeff


   
 
  Joffrey Leevy
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  ahoo.com>cc: 
 
   Subject:  [PHP-DB] phpmyadmin screwup   
 
  11/04/2003 04:30 
 
  PM   
 
   
 
   
 




Hi all:

I was trying to use phpmyadmin for the first time and messed up when trying
to give the [EMAIL PROTECTED] a password.  I did that because phpmyadmin told
me something about lax security using "root" with no password.  Anyhow
something went wrong.

Now I can't do anything with phpadmin or mysql client.The message is -
"Error 1045:  Access Denied for User:  (Using Password:No).  Grateful for
anyone's help.

Thanks


-
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard

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



RE: [PHP-DB] Re: Page counter from a query ?

2003-11-04 Thread jeffrey_n_Dyke

not to belabour this topicbut, that i know.  i was just curious as to
why that class is written like that still?

it seems that if PEAR does this for you(extract), that _may_ be a security
concern for those that are not being security concious.

Not that i'm saying, or know, that PEAR does this...but was hte reason for
my post.






   
 
  "Gary Every" 
 
  <[EMAIL PROTECTED]To:   <[EMAIL PROTECTED]>, "pete 
M" <[EMAIL PROTECTED]>
  inment.com>  cc:   <[EMAIL PROTECTED]>   
  
   Subject:  RE: [PHP-DB] Re: Page 
counter from a query ?   
  11/04/2003 10:48 AM  
 
   
 
   
 




Just do an extract on your $_GET var (if security concerns are negligible)

Say you get line is:
?sid=123&form=12
// Execute this
extract($_GET)

// You end up with:
$sid == "123";
$form == "12";


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
"Pay It Forward"
mailto:[EMAIL PROTECTED]
http://accessingram.com


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 04, 2003 9:01 AM
> To: pete M
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Re: Page counter from a query ?
>
>
>
> question/comment...
>
> i don't use PEAR currently.  but i noticed this class expects
> register_globals=on and would therefore not to work on my system.
>
> Or does another parent class take care of the translation
> between $form and
> $_GET['form']?
>
>
> Jeff
>
>
>
>
>
>
>
>   pete M
>
>
>   <[EMAIL PROTECTED]To:
> [EMAIL PROTECTED]
>
>   >cc:
>
>
>Subject:
> [PHP-DB] Re: Page counter from a query ?
>
>   11/04/2003 09:53
>
>
>   AM
>
>
>
>
>
>
>
>
>
>
>
>
> I use PEAR db to make my life easy..
> here's their pager class
> http://vulcanonet.com/soft/index.php?pack=pager
>
>
> pete
>
> Larry Sandwick wrote:
> > Is there a way to limit the number of pictures being display from a
> > query?
> >
> >
> >
> > Example.
> >
> >
> >
> > Let say I have 100 pictures and I would like to display only 20. How
> > would I put the numbers at the bottom of the page?
> >
> >
> >
> > 1 2 3 4 5
> >
> >
> >
> > When you click on 1 you get 1 - 20, and when you click on 2
> you get 21 -
> > 40. I believe I can use the limit command for the query, I
> just do not
> > understand how to put the query on the number.
> >
> >
> >
> > Any help would greatly be appreciated!!!
> >
> >
> >
> > TIA
> >
> >
> >
> >
> >
> > Larry Sandwick
> >
> > Sarreid, Ltd.
> >
> > Network/System Administrator
> >
> > phone: (252) 291-1414 x223
> >
> > fax  : (252) 237-1592
> >
> >
> >
> >
>
> --
> 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: Page counter from a query ?

2003-11-04 Thread jeffrey_n_Dyke

question/comment...

i don't use PEAR currently.  but i noticed this class expects
register_globals=on and would therefore not to work on my system.

Or does another parent class take care of the translation between $form and
$_GET['form']?


Jeff




   
 
  pete M   
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  >cc: 
 
   Subject:  [PHP-DB] Re: Page counter 
from a query ?   
  11/04/2003 09:53 
 
  AM   
 
   
 
   
 




I use PEAR db to make my life easy..
here's their pager class
http://vulcanonet.com/soft/index.php?pack=pager


pete

Larry Sandwick wrote:
> Is there a way to limit the number of pictures being display from a
> query?
>
>
>
> Example.
>
>
>
> Let say I have 100 pictures and I would like to display only 20. How
> would I put the numbers at the bottom of the page?
>
>
>
> 1 2 3 4 5
>
>
>
> When you click on 1 you get 1 - 20, and when you click on 2 you get 21 -
> 40. I believe I can use the limit command for the query, I just do not
> understand how to put the query on the number.
>
>
>
> Any help would greatly be appreciated!!!
>
>
>
> TIA
>
>
>
>
>
> Larry Sandwick
>
> Sarreid, Ltd.
>
> Network/System Administrator
>
> phone: (252) 291-1414 x223
>
> fax  : (252) 237-1592
>
>
>
>

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

2003-11-03 Thread jeffrey_n_Dyke
'tested'  is the key.  hopefully you don't test in production ;-)  his
point has been that you may not notice the problems until the servers get
under heavy load.

i've got two such setups running myself.  but not in production.

jeff




   
 
  Lester Caine 
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  uk>  cc: 
 
   Subject:  Re: [PHP-DB] Apache 2 
 
  11/03/2003 10:23 
 
  AM   
 
   
 
   
 




> lots of people seem to post/think different things, but each time Rasmus
> posts to these lists, he says PHP/Apache2 is not a production ready
combo.
> if you search the PHP-INSTALL archives for his name or Apache2, you'll
find
> his posts.

That said - I have not had any problems with PHP4, and am
now running PHP5 on a test rig - again no problems coming up.

If it's not getting tested how will we know anyway?

--
Lester Caine
-
L.S.Caine Electronic Services

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

2003-11-03 Thread jeffrey_n_Dyke

lots of people seem to post/think different things, but each time Rasmus
posts to these lists, he says PHP/Apache2 is not a production ready combo.
if you search the PHP-INSTALL archives for his name or Apache2, you'll find
his posts.


hth
Jeff

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



Re: [PHP-DB] removing space ?

2003-10-28 Thread jeffrey_n_Dyke

ahh, yes...but you didn't say mysql...sorrythey all have this function.


   
 
  [EMAIL PROTECTED]
 
  ane.com  To:   <[EMAIL PROTECTED]>   
   
   cc:   [EMAIL PROTECTED] 
  
  10/28/2003 05:16 Subject:  Re: [PHP-DB] removing space ? 
 
  PM   
 
   
 
   
 





there are trim functions in both mysql and php.
both they are called the same...trim, ltrim and rtrim.  trim takes off both
sides, and the r and l take the right and left respectively, but yes, this
is possible in the query.

http://www.mysql.com/doc/en/String_functions.html
php.net/trim
php.net/ltrim

hth
Jeff



  "Larry Sandwick"
  <[EMAIL PROTECTED]>To:
  <[EMAIL PROTECTED]>
   cc:
  10/28/2003 05:11 Subject:  [PHP-DB] removing
  space ?
  PM
  Please respond to
  lgs






When I select data from my data base I have spaces on the lead side for
example the data that is stored is "  33.jpg".  Spaces included,
exclude the quotes, quotes are example only to show the spaces.



I would like to remove these spaces. Is there a way to do this?



Can it be done in the query?



Any help would be appreciated.



Larry Sandwick

Sarreid, Ltd.

Network/System Administrator

phone: (252) 291-1414 x223

fax  : (252) 237-1592

--
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] removing space ?

2003-10-28 Thread jeffrey_n_Dyke

there are trim functions in both mysql and php.
both they are called the same...trim, ltrim and rtrim.  trim takes off both
sides, and the r and l take the right and left respectively, but yes, this
is possible in the query.

http://www.mysql.com/doc/en/String_functions.html
php.net/trim
php.net/ltrim

hth
Jeff


   
 
  "Larry Sandwick" 
 
  <[EMAIL PROTECTED]>To:   <[EMAIL PROTECTED]> 

   cc: 
 
  10/28/2003 05:11 Subject:  [PHP-DB] removing space ? 
 
  PM   
 
  Please respond to
 
  lgs  
 
   
 
   
 




When I select data from my data base I have spaces on the lead side for
example the data that is stored is "  33.jpg".  Spaces included,
exclude the quotes, quotes are example only to show the spaces.



I would like to remove these spaces. Is there a way to do this?



Can it be done in the query?



Any help would be appreciated.



Larry Sandwick

Sarreid, Ltd.

Network/System Administrator

phone: (252) 291-1414 x223

fax  : (252) 237-1592

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



Re: [PHP-DB] txt to db, file() bug? - solved err..worked around

2003-10-24 Thread jeffrey_n_Dyke

The crux of the problem seemed to be that i was ftp'ing files down from
remote servers(1 to 4 depending how many are currently active), saving them
locally and then parsing those files in the same script.  When i removed
the ftp process from the code and broke the process out into two seperate
code files, one will run after the other quite nicely without incurring any
of these irregularities.  As soon as i added the ftp portion back, the
problem returned.

the ftp process is somehting i should have mentioned in the first post...

It seems to be a memory allocation issue, but there was no pattern to the
irregularities... i don't htink there is a way to really prove this. If i
dumped the arrays before processing they looked fine, then i would assign
them to variables and add them to the sql statements and there they would
get jumbled.

hopefully this will help(??) someone searching hte archives one day.

Thanks to those that responedor even silently pondered.

Jeff




   
 
  [EMAIL PROTECTED]
 
  ane.com  To:   [EMAIL PROTECTED] 
  
   cc: 
 
  10/23/2003 02:21 Subject:  [PHP-DB] txt to db, file() 
bug?
  PM   
 
   
 
   
 




OS Solaris8
php4.3.2 and php 4.2.3.  running as CLI from cron and command line.

I have a log file that i'm processing that i need to in turn insert only
certian fields into the database.  I open the files using
file(filename.csv),which returns the array for me to process.  i process
all the lines of the file with:
while(list($line_number, line) = each($fp)) {
  $line_array = explode(",",$line);
etc

There are 15 comma seperated 'columns' in the csv file, of which i only
need to input 6.  every once in a while i don't get all of the data within
the fields, or the comma (,) becomes part of the field.  But then the other
95% of the rows process correctly.

Below is some sample data, i'm happy to provide more to anyone with
questions.  thansk for any opinions.  I hope this makes [some] sense.

Jeff

The assignment of the values that i'm putting into my queries are
simply

$query = "INSERT INTO TA_RAFEED_JD SET ".
   "LoggedAt = '".$line_array[0]. "', ".
   "User_Name = '".$line_array[2]."', ".
   "Network_Device_Group = '".$line_array[3]."', ".
   "Group_Name = 'Dial', ".
   "Caller_Id = '".$line_array[4]. "', ".
  "elapsed_time = ".$line_array[6];

trims 0's off values and changes them.???
 Good log line prior to error'd line--
Log File--
10/22/2003,07:34:23,000512,Dial-VPN,5022278197/8885326281,stop,2135,ppp,56671,46034,581,243,89602,192.168.98.218,Async190,10.1.1.28,

DB Query - INSERT INTO TA_RAFEED_JD SET LoggedAt = '2003-10-22', User_Name
= '000512', Network_Device_Group = 'Dial-VPN', Group_Name = 'Dial',
Caller_Id = '5022278197/8885326281', elapsed_time = 2135
 trimmed the two leading zeros off the string 002375 and made
it 22375---
LogFile --
10/22/2003,07:34:42,002375,Dial-VPN,7877910505/8885326281,stop,1055,ppp,150304,196686,419,317,89607,192.168.98.115,Async55,10.1.1.28,

Db query -- INSERT INTO TA_RAFEED_JD SET LoggedAt = '2003-10-22', User_Name
= '22375', Network_Device_Group = 'Dial-VPN', Group_Name = 'Dial',
Caller_Id = '7877910505/8885326281', elapsed_time = 1055
--same as above --
10/22/2003,16:52:59,007138,Dial-VPN,2122011073/8885326281,stop,205,ppp,28543,51643,171,113,89784,192.168.98.232,Async100,10.1.1.28,

INSERT INTO TA_RAFEED_JD SET LoggedAt = '2003-10-22', User_Name = '17138',
Network_Device_Group = 'Dial-VPN', Group_Name = 'Dial', Caller_Id
= '2122011073/8885326281', elapsed_time = 205

chooses the WRONG value..the value that its putting in the 'User_Name'
field is a contatenation of other fields, not being processed.???
correct line prior to error --
10/22/2003,08:02:21,002357,Dial-VPN,5072878991/8885326281,stop,3580,ppp,650218,6754168,6947,6858,89604,192.168.98.65,Async23,10.1.1.28,INSERT
 I
NTO TA_RAFEED_JD SET LoggedAt = '2004-10-22', User_Name = '002357',
Network_Device_Group = 'Dial-VPN', Group_Name = 'Dial', Caller_

Re: [PHP-DB] Re: txt to db, file() bug?

2003-10-23 Thread jeffrey_n_Dyke

hmmm.  thanks for this.  the file actually does not have quoted entries
between the commas.  it is just:
text,text,text . ,text \n

that does not take away from the assitance...gives me more things to think
about.

thank you.
jeff


   

  Justin Patrin

  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
  
  com> cc: 

   Subject:  [PHP-DB] Re: txt to db, 
file() bug?   
  10/23/2003 04:19 

  PM   

   

   





You may be having problems with your delimiter (,) being within quotes.
This can be a problem both for your ',' splitting and for the file()
splitting (\n). fgetcsv() seems to do some of this, but I'm not sure of
its completeness. Here's a function I wrote and some possible code for you:

/**
  * does a regular split, but also accounts for the deliminator to be
within quoted fields
  *  for example, if called as such:
  *   splitQuoteFriendly(',', '0,1,2,"3,I am still 3",4');
  *  it will return:
  *   array(0 => '0',
  * 1 => '1',
  * 2 => '2',
  * 3 => '"3,I am still 3"',
  * 4 => '4');
  * @param string deliminator to split by
  * @param string text to split
  * @param string text which surrounds quoted fields (defaults to ")
  * @return array array of fields after split
  */
function splitQuoteFriendly($delim, $text, $quote = '"') {
   $strictFields = split($delim, $text);
   for($sl = 0, $l = 0; $sl < sizeof($strictFields); ++$sl) {
 $fields[$l] = $strictFields[$sl];
 $numQuotes = 0;
 while(fmod($numQuotes += substr_count($strictFields[$sl], $quote),
2) == 1) {
   ++$sl;
   $fields[$l] .= $delim.$strictFields[$sl];
 }
 ++$l;
   }

   return $fields;
}

$text = file_get_contents($filename);
$lines = splitQuoteFriendly("\n", $text, "'");
foreach($lines as $line) {
   $parts = splitQuoteFriendly(',', $line, "'");
}


Justin Patrin


Jeffrey N Dyke wrote:

> OS Solaris8
> php4.3.2 and php 4.2.3.  running as CLI from cron and command line.
>
> I have a log file that i'm processing that i need to in turn insert only
> certian fields into the database.  I open the files using
> file(filename.csv),which returns the array for me to process.  i process
> all the lines of the file with:
> while(list($line_number, line) = each($fp)) {
>   $line_array = explode(",",$line);
> etc
>
> There are 15 comma seperated 'columns' in the csv file, of which i only
> need to input 6.  every once in a while i don't get all of the data
within
> the fields, or the comma (,) becomes part of the field.  But then the
other
> 95% of the rows process correctly.
>
> Below is some sample data, i'm happy to provide more to anyone with
> questions.  thansk for any opinions.  I hope this makes [some] sense.
>
> Jeff
>
> The assignment of the values that i'm putting into my queries are
> simply
>
> $query = "INSERT INTO TA_RAFEED_JD SET ".
>"LoggedAt = '".$line_array[0]. "', ".
>"User_Name = '".$line_array[2]."', ".
>"Network_Device_Group = '".$line_array[3]."', ".
>"Group_Name = 'Dial', ".
>"Caller_Id = '".$line_array[4]. "', ".
>   "elapsed_time = ".$line_array[6];
>
> trims 0's off values and changes them.???
>  Good log line prior to error'd line--
> Log File--
>
10/22/2003,07:34:23,000512,Dial-VPN,5022278197/8885326281,stop,2135,ppp,56671,46034,581,243,89602,192.168.98.218,Async190,10.1.1.28,

> DB Query - INSERT INTO TA_RAFEED_JD SET LoggedAt = '2003-10-22',
User_Name
> = '000512', Network_Device_Group = 'Dial-VPN', Group_Name = 'Dial',
> Caller_Id = '5022278197/8885326281', elapsed_time = 2135
>  trimmed the two leading zeros off the string 002375 and made
> it 22375---
> LogFile --
>
10/22/2003,07:34:42,002375,Dial-VPN,7877910505/8885326281,stop,1055,ppp,150304,196686,419,317,89607,192.168.98.115,Async55,10.1.1.28,

> Db query -- INSERT INTO TA_RAFEED_JD SET LoggedAt = '2003-10-22',
User_Name
> = '22375', Network_D

Re: [PHP-DB] Can't copy file to another server

2003-10-23 Thread jeffrey_n_Dyke

do you just need a /
$AcceptedFolder= 'F:/';





   
 
  Karen Resplendo  
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  ahoo.com>cc: 
 
   Subject:  [PHP-DB] Can't copy file to 
another server 
  10/23/2003 02:22 
 
  PM   
 
   
 
   
 




Apache on Windows web server.
After file upload and validation I would like to copy it to a folder on a
Win 2K Server machine.
We have created the folder and shared it and mapped a drive(F:) on the
Webserver to it:

$AcceptedFolder= 'F:';
$AcceptedFileAndPath=$AcceptedFolder.$HTTP_POST_FILES['userfile']['name'];
copy($uploadfileandpath,$AcceptedFileAndPath);

We get this error:
Warning:  Unable to create 'F:Apr05-08-2002.txt':  Permission denied in
C:/Program Files/Apache13 14/Apache/htdocs/file_upload.php3 on line 165

Sure could use some help.




-
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search

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



[PHP-DB] txt to db, file() bug?

2003-10-23 Thread jeffrey_n_Dyke
OS Solaris8
php4.3.2 and php 4.2.3.  running as CLI from cron and command line.

I have a log file that i'm processing that i need to in turn insert only
certian fields into the database.  I open the files using
file(filename.csv),which returns the array for me to process.  i process
all the lines of the file with:
while(list($line_number, line) = each($fp)) {
  $line_array = explode(",",$line);
etc

There are 15 comma seperated 'columns' in the csv file, of which i only
need to input 6.  every once in a while i don't get all of the data within
the fields, or the comma (,) becomes part of the field.  But then the other
95% of the rows process correctly.

Below is some sample data, i'm happy to provide more to anyone with
questions.  thansk for any opinions.  I hope this makes [some] sense.

Jeff

The assignment of the values that i'm putting into my queries are
simply

$query = "INSERT INTO TA_RAFEED_JD SET ".
   "LoggedAt = '".$line_array[0]. "', ".
   "User_Name = '".$line_array[2]."', ".
   "Network_Device_Group = '".$line_array[3]."', ".
   "Group_Name = 'Dial', ".
   "Caller_Id = '".$line_array[4]. "', ".
  "elapsed_time = ".$line_array[6];

trims 0's off values and changes them.???
 Good log line prior to error'd line--
Log File--
10/22/2003,07:34:23,000512,Dial-VPN,5022278197/8885326281,stop,2135,ppp,56671,46034,581,243,89602,192.168.98.218,Async190,10.1.1.28,
DB Query - INSERT INTO TA_RAFEED_JD SET LoggedAt = '2003-10-22', User_Name
= '000512', Network_Device_Group = 'Dial-VPN', Group_Name = 'Dial',
Caller_Id = '5022278197/8885326281', elapsed_time = 2135
 trimmed the two leading zeros off the string 002375 and made
it 22375---
LogFile --
10/22/2003,07:34:42,002375,Dial-VPN,7877910505/8885326281,stop,1055,ppp,150304,196686,419,317,89607,192.168.98.115,Async55,10.1.1.28,
Db query -- INSERT INTO TA_RAFEED_JD SET LoggedAt = '2003-10-22', User_Name
= '22375', Network_Device_Group = 'Dial-VPN', Group_Name = 'Dial',
Caller_Id = '7877910505/8885326281', elapsed_time = 1055
--same as above --
10/22/2003,16:52:59,007138,Dial-VPN,2122011073/8885326281,stop,205,ppp,28543,51643,171,113,89784,192.168.98.232,Async100,10.1.1.28,
INSERT INTO TA_RAFEED_JD SET LoggedAt = '2003-10-22', User_Name = '17138',
Network_Device_Group = 'Dial-VPN', Group_Name = 'Dial', Caller_Id
= '2122011073/8885326281', elapsed_time = 205

chooses the WRONG value..the value that its putting in the 'User_Name'
field is a contatenation of other fields, not being processed.???
correct line prior to error --
10/22/2003,08:02:21,002357,Dial-VPN,5072878991/8885326281,stop,3580,ppp,650218,6754168,6947,6858,89604,192.168.98.65,Async23,10.1.1.28,INSERT
 I
NTO TA_RAFEED_JD SET LoggedAt = '2004-10-22', User_Name = '002357',
Network_Device_Group = 'Dial-VPN', Group_Name = 'Dial', Caller_Id = '507287
8991/8885326281', elapsed_time = 3580
--errord record -- instead of inserting ka1497 to 'User_Name' i got
'stop7'--
10/22/2003,08:17:50,ka1497,Dial-VPN,4169249221/8885326281,stop,5127,ppp,738105,4533604,4701,4603,89600,192.168.98.85,Async186,10.1.1.28,INSERT
INTO TA_RAFEED_JD SET LoggedAt = '2003-10-22', User_Name = 'stop7',
Network_Device_Group = 'Dial-VPN', Group_Name = 'Dial', Caller_Id = '416924
9221/8885326281', elapsed_time = 5127
same as above.  inserted stop1 instead of 001691-
10/22/2003,12:02:19,001691,Dial-VPN,4142713011/8885326281,stop,754,ppp,65008,243490,419,365,89696,192.168.98.114,Async124,10.1.1.28,INSERT
 INTO
 TA_RAFEED_JD SET LoggedAt = '2003-10-22', User_Name = 'stop1',
Network_Device_Group = 'Dial-VPN', Group_Name = 'Dial', Caller_Id
= '4142713011
/8885326281', elapsed_time = 754


if you've got this far...again.  thank you!

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



Re: [PHP-DB] How do I get quotes around strings to display?

2003-10-21 Thread jeffrey_n_Dyke

$fieldarray = array("one","Two", "three", "four");
$line = "\"".implode("\",\"",$fieldarray) ."\"";
 this will print out "one","Two","three","four"

hth
jeff


   

  Karen Resplendo  

  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
  
  ahoo.com>cc: 

   Subject:  [PHP-DB] How do I get quotes 
around strings to display?   
  10/21/2003 07:24 

  PM   

   

   





My ascii file coming in has quotes around each comma delimited item. After
reading the rows into array these quotes are gone. Can't figure out how to
put them back in the array items when displaying the fields. Rows are saved
to table and bad rows are displayed in browser. Hope this fits this list:

//
//now print out the fields in one row
//don't print last comma in row of fields

For ($c=0; $c < $fieldcount; $c++) {
   if ($c==10)
   {
$displayrows.=$fieldarray[$c];
   }
   Else
   {
$displayrows.=$fieldarray[$c].",";
   }
}  //end of for loop


-
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search

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



Re: [PHP-DB] Using two colomns of mysql data as key/value pairs in arrays

2003-10-20 Thread jeffrey_n_Dyke

$qry = "SELECT id, name FROM a_table";
   $result = mysql_query($qry) or die(mysql_error());
   while ($rs = mysql_fetch_row($result)) {
  $myarray[$rs[0]] = $rs[1];
   }

   is that waht you need?

   hth
   Jeff




   
 
  Devon
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  .net>cc: 
 
   Subject:  [PHP-DB] Using two colomns of 
mysql data as key/value pairs in arrays  
  10/20/2003 09:30 
 
  AM   
 
   
 
   
 




I have been scouring the online documentation and experimenting for
hours trying to find a solution. I just can't do it.

I have two colomns of data that I am retrieving from MySQL:

   SELECT id, name FROM a_table;

I just cannot figure out how to get that data from the resource handle
into an associative array with the 'id' colomn making up the keys and
the 'name' colomn making up the values.

Any help would be wonderful! :)



Using PHP 4.3.3 on Linux if it matters.

--
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 and MySQL and PostgresSQL at the same time

2003-10-02 Thread jeffrey_n_Dyke

I use Apache with PHP using MSSQL and MySQL at the same time...

You'd just need to connect to different databases, the platform should not
matter.

hth
Jeff


   
 
  "Morten  
 
  Gulbrandsen" To:   [EMAIL PROTECTED] 
  
  <[EMAIL PROTECTED]cc:
  
  e>   Subject:  [PHP-DB] php and MySQL and 
PostgresSQL at the same time
   
 
  10/02/2003 07:22 
 
  AM   
 
   
 
   
 




Is it possible to use PHP under one Apache WEB application in order to
access

MySQL and at the same time PostgreSQL?



different databases ?



Yours Sincerely



Morten Gulbrandsen

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

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



[PHP-DB] stripping carrige returns with SQL

2003-09-26 Thread jeffrey_n_Dyke
I have a query that is pulling user comments, supplied by via web
internface and creating a text file out of them.  In these comments are all
sorts of carrige returns.  I've tried stripping them out with the following
queries, but once imported into excel, the carrige returns are still there.
so obviously i'm doing something wrong

I tried doing with the ASCII number .(no idea if this is valid)

SELECT Business_Unit.Business_Unit, Category.Category_Name,
REPLACE(Comment_Original, ASCII(10),ASCII(32)) FROM `Comment` INNER JOIN
Cat
egory ON Comment.Category_ID = Comment.Category_ID INNER JOIN
Survey_Response ON Comment.Survey_Key = Survey_Response.Survey_Key INNER
JOIN Business_Unit ON Survey_Response.BUKey = Business_Unit.BUKey WHERE
Comment_Original <> ' ' AND Category.Category_Name IS NOT NULL GROUP BY
Business_Unit.BUKey, Category.Category_Name, Comment_Original ORDER BY
Business_Unit.BUKey, Category.Category_ID ASC INTO OUTFILE
'/export/home/jdyke/comments_NoB.csv' fields terminated by ',' OPTIONALLY
ENCLOSED BY '"' lines terminated by '\n';

Also with the escaped charatcer.
SELECT Business_Unit.Business_Unit, Category.Category_Name,
REPLACE(Comment_Original, '\n',' ') FROM `Comment` INNER JOIN Category ON
Co
mment.Category_ID = Comment.Category_ID INNER JOIN Survey_Response ON
Comment.Survey_Key = Survey_Response.Survey_Key INNER JOIN Business_UnitON
Survey_Response.BUKey = Business_Unit.BUKey WHERE Comment_Original <> ' '
AND Category.Category_Name IS NOT NULL GROUP BY Business_Unit.BUKey,
Category.Category_Name, Comment_Original ORDER BY Business_Unit.BUKey,
Category.Category_ID ASC INTO OUTFILE '/export/home/jdyke/comments_NoB.csv'
fields terminated by ',' OPTIONALLY ENCLOSED BY '"' lines terminated by
'\n';

Is REPLACE the right SQL Function to use?  is there a better way to
determine this character?

Thanks
Jeff

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



Re: [PHP-DB] sql optimizing assistance

2003-09-19 Thread jeffrey_n_Dyke

Thanks Jeff!

You were correct the Question_Key was set second in the Primary key...i
changed that and the query went down to 2.41seconds.  very nice.

Thanks for the help.
Jeff

ps.  you're also correct about the LIKE, of course...that was being used
horribly. i'd forgoten it changed to an INT, and i was using a string
function on it.  it is now using that appropritately as well.



   

  Jeff Shapiro 

  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
  
  >cc:   [EMAIL PROTECTED] 
 
   Subject:  Re: [PHP-DB] sql optimizing 
assistance
  09/19/2003 05:42 

  PM   

   

   






What is the exact order of columns in your PRIMARY KEY in the Response
table? If Question_Key is not the first column listed in the key, then
MySQL won't use it.

Try the following:
SELECT Question.Text_Long, AVG( Response )
FROM `Response` USE INDEX (Question_key)
JOIN Question ON Response.Question_Key = Question.Question_Key
WHERE Question.Question_Key LIKE '2003%'
GROUP BY Response.Question_Key
ORDER BY Question.Question_Key ASC

This should force MySQL to use your index.

According to the MySQL manual the LIKE function does use indexes when
you use it the way that you are using it. For more info:
http://www.mysql.com/doc/en/MySQL_indexes.html


On Fri, 19 Sep 2003 16:01:34 -0400, [EMAIL PROTECTED] spoke
thusly about Re: [PHP-DB] sql optimizing assistance:
>
> i new i forgot to include something.
>
> here this is the ouput.  it looks like its using none of my indexes in
the
> Response, which is where i would think it would need it the most.
>
>
+++---++-++++

>>  table  | type   | possible_keys | key| key_len | ref| rows   |
> Extra  |
>
+++---++-++++

>>  Response| ALL| [NULL]| [NULL] | [NULL]  | [NULL] | 126732 |
> Using temporary; Using filesort|
>>  Question| eq_ref | PRIMARY   | PRIMARY| 4   |
> Response.Question_Key| 1  | where used|
>
+++---++-++++

>
> even on the second query where there is no join, its not using the keys.
>
+++---++-++++

>>  table  | type   | possible_keys | key| key_len | ref| rows   |
> Extra  |
>
+++---++-++++

>>  Response| ALL| [NULL]| [NULL] | [NULL]  | [NULL] | 126732 |
> Using temporary|
>
+++---++-++++

>
> Thanks,
> Jeff
>
>
>
>   "CPT John
>
W.
>   Holmes"  To:
> <[EMAIL PROTECTED]>,
> <[EMAIL PROTECTED]>
>   <[EMAIL PROTECTED]
>
cc:
>   rter.net>Subject:  Re: [PHP-DB]
> sql optimizing assistance
>
>   09/19/2003
>
03:59
>
>
PM
>   Please respond
>
to
>   "CPT John
>
W.
>
>
Holmes"
>
>
>
>
>
>
> From: <[EMAIL PROTECTED]>
>
>
>>  I have two tables and am running a simple join between them to get
>>  questions and their repsective response averages from a survey.  The
>>  question table has 49 rows and the Response table has 126,732.  I'd
like
> to
>>  cut down on the time its taking to run this specific query...as i'll be
>>  running many like it to generate reports. The query below is the
> selecting
>>  the most data, normally this will be limited to specific groups by
> joining
>>  more tables.
>>
>>  I am executing the following query
>>  SELECT Question.Text_Long, AVG( Response ) FROM `Response` INNER JOIN
>>  Question ON Question.Question_Key = Response.Question_Key WHERE
>>  Question.Question_Key LIKE '2003%' GROUP BY Response.Question_Key ORDER
> BY
>>  Question.Question_Key ASC
>
> What does EXPLAIN tell you for this query? Is it using your indexes?
>

Re: [PHP-DB] sql optimizing assistance

2003-09-19 Thread jeffrey_n_Dyke

i new i forgot to include something.

here this is the ouput.  it looks like its using none of my indexes in the
Response, which is where i would think it would need it the most.

+++---++-++++
| table  | type   | possible_keys | key| key_len | ref| rows   |
Extra  |
+++---++-++++
| Response| ALL| [NULL]| [NULL] | [NULL]  | [NULL] | 126732 |
Using temporary; Using filesort|
| Question| eq_ref | PRIMARY   | PRIMARY| 4   |
Response.Question_Key| 1  | where used|
+++---++-++++

even on the second query where there is no join, its not using the keys.
+++---++-++++
| table  | type   | possible_keys | key| key_len | ref| rows   |
Extra  |
+++---++-++++
| Response| ALL| [NULL]| [NULL] | [NULL]  | [NULL] | 126732 |
Using temporary|
+++---++-++++

Thanks,
Jeff


   

  "CPT John W. 

  Holmes"  To:   <[EMAIL PROTECTED]>, <[EMAIL 
PROTECTED]>
  <[EMAIL PROTECTED]cc:
 
  rter.net>Subject:  Re: [PHP-DB] sql optimizing 
assistance
   

  09/19/2003 03:59 

  PM   

  Please respond to

  "CPT John W. 

  Holmes"  

   

   





From: <[EMAIL PROTECTED]>


> I have two tables and am running a simple join between them to get
> questions and their repsective response averages from a survey.  The
> question table has 49 rows and the Response table has 126,732.  I'd like
to
> cut down on the time its taking to run this specific query...as i'll be
> running many like it to generate reports. The query below is the
selecting
> the most data, normally this will be limited to specific groups by
joining
> more tables.
>
> I am executing the following query
> SELECT Question.Text_Long, AVG( Response ) FROM `Response` INNER JOIN
> Question ON Question.Question_Key = Response.Question_Key WHERE
> Question.Question_Key LIKE '2003%' GROUP BY Response.Question_Key ORDER
BY
> Question.Question_Key ASC

What does EXPLAIN tell you for this query? Is it using your indexes?

---John Holmes...

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



[PHP-DB] sql optimizing assistance

2003-09-19 Thread jeffrey_n_Dyke
I have two tables and am running a simple join between them to get
questions and their repsective response averages from a survey.  The
question table has 49 rows and the Response table has 126,732.  I'd like to
cut down on the time its taking to run this specific query...as i'll be
running many like it to generate reports. The query below is the selecting
the most data, normally this will be limited to specific groups by joining
more tables.

I am executing the following query
SELECT Question.Text_Long, AVG( Response ) FROM `Response` INNER JOIN
Question ON Question.Question_Key = Response.Question_Key WHERE
Question.Question_Key LIKE '2003%' GROUP BY Response.Question_Key ORDER BY
Question.Question_Key ASC

Everything i've done so far leaves this query taking about 7-8 seconds to
excecute...and i'm trying to cut that time down.  If i leave out the join
and just execute
-->SELECT Question_Key, AVG( Response ) FROM `Response` GROUP BY
Question_Key
it takes about 3 seconds...is there anything i can do to speed the join up?

i've tried using string functions instead of LIKE, but none of them proved
to be faster.  i've also changed the table that i'm requesing the data from
and grouping by(Question and response)...all with mimimal impact.

I'm running MySQL.  3.23

Thanks for any help/thoughts you may have.
have a good weekend.
Jeff


the table layout is
mysql> describe Response;
+--++--+-+-+---+
| Field| Type   | Null | Key | Default | Extra |
+--++--+-+-+---+
| Question_Key | int(11)|  | PRI | 0   |   |
| Survey_Key   | int(11)|  | PRI | 0   |   |
| Response | tinyint(4) |  | MUL | 0   |   |
+--++--+-+-+---+
3 rows in set (0.00 sec)

mysql> describe Question;
+-+--+--+-+-+---+
| Field   | Type | Null | Key | Default | Extra |
+-+--+--+-+-+---+
| Question_Number | int(11)  |  | | 0   |   |
| Text_Long   | varchar(255) | YES  | | NULL|   |
| Text_Short  | varchar(255) | YES  | | NULL|   |
| Category_ID | int(11)  | YES  | | NULL|   |
| SurveyID| int(11)  | YES  | | NULL|   |
| End_Date| datetime | YES  | | NULL|   |
| Question_Key| int(11)  |  | PRI | 0   |   |
+-+--+--+-+-+---+
7 rows in set (0.00 sec)

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



Re: [PHP-DB] JOIN across db's in MySQL

2003-09-18 Thread jeffrey_n_Dyke

i asked this same question once and somehwere in the archives is a post by
John Holmes that shows an example of how mysql allows db joins.  its from
last month i believe

http://marc.theaimsgroup.com/?l=php-db

but in short, mysql does support this using . db.table.field

hth
Jeff


   
 
  "Mike Tallroth"  
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  exus.com>cc: 
 
   Subject:  [PHP-DB] JOIN across db's in 
MySQL 
  09/18/2003 10:47 
 
  AM   
 
   
 
   
 




In the big scheme of things, I need several functions to be performed by a
web interface / database system.  In an attempt to maintain some sense of
order, I'm hoping to divide common data into a seperate MySQL database away
from the function specific data.  For example, I need to do project
allocation and vendor quality tracking.  These functions are generally
unrelated but call on similar data (people in the group).

My plan was to create a MySQL database called "admin" which contained
people, customers, locations, addresses, etc, and seperate databases for
each of the other functions projectallocation, vendorquality, etc.

The problem I'm seeing is that there is no clean way of creating queries
across database boundaries.  Does PHP support this and I'm not seeing it?
Does anyone know of third party code that accomplishes this "manually"?  Am
I out in left field on my desire to setup the database structure this way?

thanks,

--
Mike Tallroth
Engineering Supervisor
Test DesignCenter
Plexus Technology Group
Neenah, WI
mike.tallroth @plexus.com
920-751-5418

--
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] Whios request record in database

2003-09-12 Thread jeffrey_n_Dyke

couple possible problems.
1. register globals being off and you're using variables like $name instead
of $_POST['name'].
2.  you're not asking that anything be written to the database, only
selecting
  $insert="select * from $table";
  $db_query=mysql_db_query($db_name,$insert);

3. you're cheking if $name exists in the same code block that you've only
entered if $name does NOT exist.  you have some overlapping/unlclosed if
brackets

hth
Jeff



   
 
  "IS" 
 
  <[EMAIL PROTECTED]>To:   <[EMAIL PROTECTED]> 

   cc: 
 
  09/12/2003 07:31 Subject:  [PHP-DB] Whios request record 
in database  
  AM   
 
   
 
   
 




I want to record the whois requests people do, not the whois output, in
a MySQL database.

The following code I'm playing with, but it doesn't write anything to my
table. What's wrong?


  
  
  ");
  $db_name='dbname';
  $db_user='username';
  $db_password='password';
  $table='tablename';
  // Connect to the database
  $db_conn = mysql_connect("localhost",$db_user,$db_password);
  if (!$db_conn)
  {
   die ("ERROR: Cannot connect to the database.");
   //exit();
  }
  $ip = $REMOTE_ADDR;
  $insert="select * from $table";
  $db_query=mysql_db_query($db_name,$insert);
  if($name)
  {
   if($dbquery)
   { print("Done.");
   }
   else
   { print("Didn't work.");
   }
  }
 }
?>

--IS

--
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] MYSQL Table Dump

2003-09-10 Thread jeffrey_n_Dyke

http://www.mysql.com/doc/en/mysqldump.html


   
 
  "John Ryan"  
 
  <[EMAIL PROTECTED]>To:   [EMAIL PROTECTED]   

   cc: 
 
  09/10/2003 04:23 Subject:  [PHP-DB] MYSQL Table Dump 
 
  PM   
 
   
 
   
 




Is there any way *from the command line* to get a dump of a mysql table and
have it saved to a local file, instead of standard output

--
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] foreach() & db brainiacs please help?

2003-09-09 Thread jeffrey_n_Dyke

couldn't this be accomplished with a Left Join? Depending on how your
tables are arranged you should be able to get all (sub)sub-names out and in
the same result set using the top_name with a Left Join.  any key that
relates to the parent key would be returned.

it looks like you have them all in the same table thoughwhich may
furuther complicate things, if so, how is the relatoinship maintained in
the table(s)?

Jeff


   
 
  "Peter Sharpe"   
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  .com>cc: 
 
   Subject:  [PHP-DB] foreach() & db 
brainiacs please help? 
  09/09/2003 03:17 
 
  PM   
 
  Please respond to
 
  "Peter Sharpe"   
 
   
 
   
 




I have a database full of names. each name could be linked to any number of
sub-names, each sub-name could be linked to any number of sub-sub-names, to
infinity (unlikely but possible).

I need to iterate through this nest of names starting with a main name;
lets
call the main name Peter. Peter could have John, Tim & Mike working for
him.
Tim could have Greg working for him.

function select_names($current_top_name){
global $dbh;

$sql = "
SELECT
 name_id_fk
FROM
 name_relation
WHERE
 top_name_id_fk = '".$current_top_name."'
";
$rs = pg_query($dbh, $sql);

if(($num_rows = pg_num_rows($rs)) > 0){

for($i=0;$i<$num_rows;$i++){
$row = pg_fetch_row($rs, $i, PGSQL_ASSOC);
$associated_names[] = $row['name_id_fk'];
}

pg_free_result($rs);

} // end if(($num_rows = pg_num_rows($rs)) > 0)

return $associated_names;

} // end function select_names()

$current_top_name = 'Peter';

while(!$stop){

$assoc_names = select_names($current_top_name);

foreach($assoc_names as $key => $val){
print($val);
$more_assoc_names = select_names($val);
if($more_assoc_names){
ARG HELP IM NOT SMART ENOUGH
}

} // end while(!$stop)

} // end foreach($assoc_names as $key => $val)

--
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] Determining if checkbox is selected in PHP

2003-09-09 Thread jeffrey_n_Dyke


you could first check for isset($_POST['keyword']) and then if that passes
check what keywords you have.  or you could write an additional html tag to
the page like.  .  This
would force the $_POST['keyword'] array to exist and then you'd have to
strip that from your array when processing it

hth
Jeff


   
 
  Keith Wilkinson  
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  be.ne.jp>cc: 
 
   Subject:  [PHP-DB] Determining if 
checkbox is selected in PHP
  09/09/2003 08:09 
 
  AM   
 
   
 
   
 




I'm storing the values from a groups of checkboxes
in an array "keyword[]", but $_POST['keyword'] is
undefined if none of the checkboxes is checked.
I tried using "in_array()" with $_POST to determine
if any of the group of 'keyword' checkboxes is checked,
but can't get it to work;  does anyone have any
suggestions?

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

2003-09-08 Thread jeffrey_n_Dyke

the value will be what ever you set the value to be in your html tag.

if checked $_POST['color'] will equal "red".  if unchecked, the index
'color' will not be in the $_POST array.

hth
Jeff


   
  
  "Hutchins, Richard"  
  
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  ngeusa.com>   cc:
  
Subject:  RE: [PHP-DB] 2 problems  
  
  09/08/2003 08:30 AM  
  
   
  
   
  




Not really sure of the second part of your question, but, if I remember
correctly, check boxes only appear in the POST vars if they're checked. And
I'm pretty sure their values are ON. So, if you have a color checkbox named
"red" and tha user checks it, it should show up as $_POST['color'] = ON. If
the checkbox is not checked, you won't see it in the POST vars at all.

> -Original Message-
> From: Balaji H. Kasal [mailto:[EMAIL PROTECTED]
> Sent: Monday, September 08, 2003 8:24 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] 2 problems
>
>
>
> Hi,
>
>  I am facing 2 problems while using PHP along with form based
> HTML file.
> It takes inputs from the user and updates the DB.
>
> Problems,
> 1) Not able to grab and store the checkbox status.
> 2) Not able to check the correctness of entered interger
> value. I realized
> that form always submits (POST) the value as text.
>
>  Thanks in advance!
>
> --
> Regards,
> --Balaji
>
> --
> 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] Modify MySQL Record

2003-09-05 Thread jeffrey_n_Dyke

looks like you stopped putting commas after your fields at
  $field_str .= " formation = '$formation' ";
  $field_str .= " perfs = '$perfs' ";
  $field_str .= " event = '$event' ";
  $field_str .= " fluid = '$fluid' ";

  hth
Jeff


   
 
  "Jeff"   
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  >cc: 
 
   Subject:  [PHP-DB] Modify MySQL Record  
 
  09/05/2003 12:28 
 
  PM   
 
   
 
   
 




Hell!

I'm having a small problem with modifying the data in a MySQL DB.

And here's the error:

(After I click the "Submit Changes" button) Error: 1064: You have an error
in your SQL syntax near '(10-10-10-10)' kwo='1235', lsd='10-10-10-10',
date='2003-05-05', well' at line 1

Here's the code:

function edit_record() {
  global $default_dbname, $gradient_tablename, $access_log_tablename;
  global $new_lsd, $kwo, $lsd, $date, $well, $field,
   $uni, $license, $formation, $perfs, $event, $fluid, $mode,
   $type, $vhd, $file, $kb, $grd, $open, $sour, $tube,
  $landed, $casing, $landed2, $shut_date, $shut_time, $pres, $tag;

  if(empty($kwo)) error_message('Empty Gradient!');

  $link_id = db_connect($default_dbname);
  if(!$link_id) error_message(sql_error());

  $field_str = '';
  if($kwo != $new_kwo) $field_str = " kwo = '$new_kwo', ";
  if(!empty($lsd)) {
$field_str .= " lsd = other_lsd('$lsd') ";
  }

  $field_str .= " kwo = '$kwo', ";
  $field_str .= " lsd = '$lsd', ";
  $field_str .= " date = '$date', ";
  $field_str .= " well = '$well', ";
  $field_str .= " field = '$field', ";
  $field_str .= " uni = '$uni', ";
  $field_str .= " license = '$license', ";
  $field_str .= " formation = '$formation' ";
  $field_str .= " perfs = '$perfs' ";
  $field_str .= " event = '$event' ";
  $field_str .= " fluid = '$fluid' ";
  $field_str .= " mode = '$mode' ";
  $field_str .= " type = '$type' ";
  $field_str .= " vhd = '$vhd' ";
  $field_str .= " file = '$file' ";
  $field_str .= " kb = '$kb' ";
  $field_str .= " grd = '$grd' ";
  $field_str .= " open = '$open' ";
  $field_str .= " sour = '$open' ";
  $field_str .= " tubing = '$tubing' ";
  $field_str .= " landed = '$landed' ";
  $field_str .= " casing = '$casing' ";
  $field_str .= " landed2 = '$landed2' ";
  $field_str .= " shut_date = '$shut_date' ";
  $field_str .= " sut_time = '$shut_time' ";
  $field_str .= " pres = '$pres' ";
  $field_str .= " tag = '$tag' ";


  $query = "UPDATE $gradient_tablename SET $field_str WHERE kwo = '$kwo'";

  $result = mysql_query($query);
  if(!$result) error_message(sql_error());

  $num_rows = mysql_affected_rows($link_id);
  if(!$num_rows) error_message("Nothing changed!");
  if($lsd != $new_kwo) {
$query = "UPDATE $access_log_tablename SET kwo = '$new_kwo' WHERE kwo =
'$kwo'";
$result = mysql_query($query);
if(!$result) error_message(sql_error());

user_message("All records regarding $lsd have been changed!",
 "$PHP_SELF?action=view_record&kwo=$new_kwo");
  }
  else {
user_message("All records regarding $lsd have been changed!");
  }
}

--
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] Populating an array from mysql db

2003-08-28 Thread jeffrey_n_Dyke

I'd worry about the empty dates after. and use something like.

$qry = "select date1, date2 from table";
$result = mysql_query($qry) or die(mysql_error());
while ($rs = mysql_fetch_row($result)) {
//this array could be built a number of ways, one is
  $bookdate[] = array($rs[0],$rs[1]);
}

if i've not misunderstood, that should work
hth
jeff



   
 
  mike karthauser  
 
  <[EMAIL PROTECTED]To:   <[EMAIL PROTECTED]>  
   
  m.co.uk> cc: 
 
   Subject:  [PHP-DB] Populating an array 
from mysql db 
  08/28/2003 08:01 
 
  AM   
 
   
 
   
 




I have a course booking system that allows the client to add courses and
then specify how long they run for. The admin system I have built allows
the
client to add up to 30 dates for each instance of the course and these are
adding to a database row in the form date1, date2, date3, daten etc.

What I am trying to achieve now is to extract this data into an array so I
can count how many dates have been added and to display the dates.

If the course runs for eg. 2 days - values of date1 and date2 would be
populated as date1=2003-09-01, date2=2003-09-02 - all other dates would be
default to -00-00 and I wish to ignore these.

I'm trying to work out how to set up a loop to extract positive dates from
my db so I end up with

$bookdate[0] = '2003-09-01';
$bookdate[1] = '2003-09-02'; etc

Can anyone provide me with some help in this extraction?

Thanks in advance.

--
Mike Karthauser
Managing Director - Brightstorm Ltd

Email   >> [EMAIL PROTECTED]
Web >> http://www.brightstorm.co.uk
Tel >> 0117 9426653 (office)
   07939 252144 (mobile)

Snailmail   >> Unit 8, 14 King Square,
   Bristol BS2 8JJ

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

2003-08-27 Thread jeffrey_n_Dyke

$_SERVER['HTTP_REFERER']

hth
jeff


   
 
  Diana Cassady
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  .com>cc: 
 
   Subject:  [PHP-DB] Simple Referrer  
 
  08/27/2003 12:10 
 
  PM   
 
   
 
   
 




Hi. This seems like it should be simple. I've had no problem doing this
in other languages, but can find no reference to this function in the
PHP manual.

How can I get PHP to return the referring URL?

Thanks.

Diana
[EMAIL PROTECTED] "Will Work for Chocolate"
http://www.vivaladata.com   (and its worth every byte!)

--
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] MySQL query failing on apostrophe in data

2003-08-27 Thread jeffrey_n_Dyke

if you're using php to generate this query you could use addslashes() to
the piece that is holding 11301201 0603A HKA 3902 #3708_JD's
AE Exp.   this will escape the slashes making them \'

similarly if you're getting \' in your return values you can use
stripslashes()

www.php.net/addslashes
www.php.net/stripslashes

hth
jeff



   
 
  "Dillon, John"   
 
  <[EMAIL PROTECTED]To:   'PHP-DB' <[EMAIL PROTECTED]> 
   
  o.uk>cc: 
 
   Subject:  [PHP-DB] MySQL query failing 
on apostrophe in data 
  08/27/2003 12:59 
 
  PM   
 
   
 
   
 




How do I avoid the problem in the subject hereto?  SELECT query uses
variable in the WHERE clause.  Fails on the following query:

SELECT Tbl.fld FROM Tbl WHERE Tbl.fld2='11301201 0603A HKA 3902 #3708_JD's
AE Exp' AND ...

John











































   http://www.cantor.com
CONFIDENTIAL: This e-mail, including its contents and attachments, if any,
are confidential. If you are not the named recipient please notify the
sender and immediately delete it. You may not disseminate, distribute, or
forward this e-mail message or disclose its contents to anybody else.
Copyright and any other intellectual property rights in its contents are
the sole property of Cantor Fitzgerald.
 E-mail transmission cannot be guaranteed to be secure or error-free.
 The sender therefore does not accept liability for any errors or
 omissions in the contents of this message which arise as a result of
 e-mail transmission.  If verification is required please request a
 hard-copy version.
 Although we routinely screen for viruses, addressees should check this
 e-mail and any attachments for viruses. We make no representation or
 warranty as to the absence of viruses in this e-mail or any
 attachments. Please note that to ensure regulatory compliance and for
 the protection of our customers and business, we may monitor and read
 e-mails sent to and from our server(s).

For further important information, please read the  Important Legal
Information and Legal Statement at
http://www.cantor.com/legal_information.html

--
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] Logic Help...

2003-08-27 Thread jeffrey_n_Dyke

if its never entering hte test process maybe you're not holding what you
think you are in the arrays.  each time through the loop, before the if
statemetn, just add a
print_r($shell[$cntr]) and/or print_r($grp[$cntr] == ""). for that matter
you could print_r both arrays so you can see exactly what they contain.

they must be getting set to something if that logic does not work.  Do you
possibly have default values in the HTML?  are these checkboxes, which
don't get added to the POST/GET arrays if they are not checked?

hth
jeff


   
 
  "NIPP, SCOTT V   
 
  (SBCSI)" To:   "CPT John W. Holmes" <[EMAIL 
PROTECTED]>, [EMAIL PROTECTED]  
  <[EMAIL PROTECTED]> cc:  

   Subject:  RE: [PHP-DB] Logic Help...
 
  08/27/2003 10:04 
 
  AM   
 
   
 
   
 




 Thanks for the feedback.  This seems to have helped, but something
is still not working with the logic.  Here is the updated code:

Sorry, but your request was not filled out completely.  Please
resubmit this request ensuring that you have selected a Primary Group and
Default Shell.";
  echo "Please
follow this http://ldsa.sbcld.sbc.com/DW/NewUser/newuser.php\";>link to
return
to the beginning of the request process.";
   exit;
 }
  }
?>

 Now, the test conditions never seem to enter into this portion of
code.  I am unable to figure out why at this point.  Thanks again for the
help.

-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 26, 2003 9:15 AM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Logic Help...


From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]>


> This isn't specifically a DB related question, but...  The following
> code snippet is not functioning for me.  I keep receiving a parse error
on
> the "if" line.  Basically I want to stop execution of this page if either
of
> the conditions in the "if" statement exist.  Thanks in advance.
>
>
> #  while($cntr != 0) {
> #if (($shell[$cntr] eq "") || ($grp[$cntr] eq "Primary Gr")) {

Umm... you don't use 'eq' in PHP, you use == (that's two equal signs).

---John Holmes...

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

2003-08-27 Thread jeffrey_n_Dyke

use mysqldump.  you can dump all databases (--all-databases) or list them
individually.

http://www.mysql.com/doc/en/mysqldump.html

hth
Jeff


   
 
  "Chris Payne"
 
  <[EMAIL PROTECTED]To:   "php" <[EMAIL PROTECTED]>
   
  ene.com> cc: 
 
   Subject:  [PHP-DB] Database backup  
 
  08/26/2003 05:46 
 
  PM   
 
   
 
   
 




Hi there everyone,

Is there a quick way I can backup all my databases on Linux so I can
download them to my HD/Burn them onto CD?

I've started a very large travel project and there is going to be over 100
DB's in the end, each with who knows how many tables and going through
PHPMyADMIN and exporting 1 DB at a time is going to take forever.

My Server is the Rehat Linux 8.0 with Apache and MySQL and PHP.

Thanks, any help would be really appreciated (And save me alot of
headaches).

Chris

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



Re: [PHP-DB] Failure to interact with MySQL in Redhat 9 ?

2003-08-22 Thread jeffrey_n_Dyke

do you get anything helpful if you set error_reporting(E_ALL) and rerun the
search.  could this be a register_globals issue?  can you print_r($_GET) or
print_r($_POST) depending on how you have defined the FORM action...and if
you can is there anything in those arrays?

hth
Jeff


   
 
  David Haines 
 
  <[EMAIL PROTECTED]To:   <[EMAIL PROTECTED]>  
   
  .net>cc: 
 
   Subject:  [PHP-DB] Failure to interact 
with MySQL in Redhat 9 ?  
  08/22/2003 01:07 
 
  PM   
 
   
 
   
 




Hello all. I hope this is the best place to ask this (!)

Problem: verified that PHP, MySQL and Apache are all working fine.
My first little project, and search.html and results.php is not working in
Redhat 9.
If I fail to enter a search term, I get the expected error message, but
that
is just Apache, it's not even executing any PHP. When I enter a search
term,
the results.php page loads with the proper page title, but the rest of the
page is blank.

**However**, the exact same project files work just as expected on my Mac
running OS X though... hmm: which is running Apache 1.3, PHP 4.1.2 and
MySQL
4.1.2

So I have to wonder, what am I missing in Redhat ?

What I've done, what I'm doing:

I am learning MySQL and PHP, working through a lovely O'Reilly text.

I have MySQL and PHP and Apache all working fine on an istall of Redhat
Linux 9. I can work with MySQL in the terminal (command-line), and have
even
installed MySQL Control Center (a fairly nice GUI).

My "hello.php" loads fine and returns "Hellow world" in my web-browser when
I load http://localhost/hello.php

The default Apache page loads, as do a simple index.html file when I put
one
in place.

Apache 2 is running, PHP is version 4.2.2, MySQL is 4.0

I checked permissions and ownership of the "search.html" and "results.php"
files. My "results.php" file is setup the same (ownership & executable
flags) as my "hello.php" file (which does work).

My Apache error log offers nothing helpful. I cannot find any MySQL error
log in Redhat (checked and triple-checked), and
I can't seem to find any php error log. The php.ini file really doesn't
help, in terms of knowing where to look for an error log

===
I know this is long, but I've been as thorough as I know how to be - please
help ! (TIA)



--
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 across databases - how to select databases?

2003-08-22 Thread jeffrey_n_Dyke

to my knowledge this is not possible in MySQL.  There are only joins at the
table level.  I've been curious about this in the past myself, so if i'm
incorrect, i'm hoping to hear it via this post.

hth
jeff


   
 
  Moshe Weitzman   
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
  
  ourmet.org>   cc:
 
Subject:  [PHP-DB] join across 
databases - how to select databases? 
  08/22/2003 11:16 AM  
 
   
 
   
 




I have looked all over the web but can't find an example *in php* for
connecting to a mysql server, selecting database(s), and issueing a query
which joins across databases. I already know the SQL required to achieve a
multiple database query. My question is about how many calls to
mysql_select_db() are required, does order matter, etc.


--
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] Saving MySQL data as an Excel Spreadsheet...?

2003-08-20 Thread jeffrey_n_Dyke

if you're looking for a little more control over your documents, i'd try
this class.  Its based on the WriteExcel Perl Module.  Perl class docs can
be found
here--->http://search.cpan.org/author/JMCNAMARA/Spreadsheet-WriteExcel-0.41/WriteExcel.pm.

 I've found _very_ few things for my needs that the PHP version does not
support.

http://phpclasses.iplexx.at/browse.html/package/767.html

hth
Jeff


   
   
  "Griffiths, Daniel"  
   
  <[EMAIL PROTECTED]To:   "Ramil Sagum" <[EMAIL 
PROTECTED]>, <[EMAIL PROTECTED]> 
  onconf.org>cc:   
   
 Subject:  RE: [PHP-DB] Saving MySQL 
data as an Excel Spreadsheet...? 
  08/20/2003 05:34 AM  
   
   
   
   
   




you can also send the appropraite headers to output directly to excel from
the browser, i.e something like this:-



this needs to be at the very start of the page and before any output to the
browser, also in this case you'll need to send FORMAT=XLS in the GET array
but you can of course take that bit out if you want the data to be in excel
format always.

if you already have tables outputing to html then this will convert it
excel and open an excel window and display the tables. Any formating you do
to the html will be shown in the excel file as well. seems to easy to be
true but it is!

change 'inline' to 'attachment' to simply download the file, or give the
user the choice of what to do.



-Original Message-
From: Ramil Sagum [mailto:[EMAIL PROTECTED]
Sent: 20 August 2003 10:23
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Saving MySQL data as an Excel Spreadsheet...?


have you tried saving the data as a set of comma separated values (CSV
file)?

Microsoft Excel can open/import these files.

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 20, 2003 4:58 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Saving MySQL data as an Excel Spreadsheet...?
>
>
> I've just done a search on goolge for this, and found several products
> that do it, but I'm convinced there's gotta be an open source option?
> Anyone able to point me in the right direction with this?
>


--
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] Help with filling a second drop down List from a prior listselection in the same page

2003-08-18 Thread jeffrey_n_Dyke

Sounds like you're on the right track. in the  list, add -->
onChange="document.form.submit()"  <-- this will submit the form when the
user selected the an option from the list, then you could catch the
submitted variable and pass it to the second drop down list and third and
so on.  Realizing htat you'll also get unwanted fields in this submission
*if* they already exist on the form, so you'll have to deal with those as
well, or just ignore them.

hth
Jeff


   
 
  Allens   
 
  <[EMAIL PROTECTED]> To:   [EMAIL PROTECTED]  
 
   cc: 
 
  08/18/2003 03:47 Subject:  [PHP-DB] Help with filling a 
second drop down List from a prior list selection 
  PMin the same page   
 
   
 
   
 




Hello,
   Have tried for a day to figure out how to dynamically fill a second
drop-down list from the first using PHP and Javascript. Still new to
both would greatly appreciate some direction. Below is an example.
Thanks in advance. :)

All of this is inside an HTML form so that the user can add a request
for computer equipment.
1. Drop-down list one is of vendors that I've acquired from a php call
to mysql to select all vendors in a table.
2. Want the second drop-down list to dynamically acquire from mysql the
vendor contacts for the vendor chosen in drop-down list 1.

The rest of the form I can handle. Will PHP allow me to do this without
Javascript? I know that I could just have a page list the drop-down
list of the vendors inside a form and have submit button there. Then
$_post that value in another page to fill the second list and display
the remaining html to get the remaining data, but it would be nice if I
could do both lists on one page. I've searched the web all day looking
for examples of using php and mysql with Javascript to do this, but
haven't found any that I can get a handle on. Any help would be greatly
appreciated. :)

On Monday, August 18, 2003, at 07:11  AM,
[EMAIL PROTECTED] wrote:

>
>
>
> php-db Digest 18 Aug 2003 11:11:40 - Issue 1987
>
> Topics (messages 29926 through 29934):
>
> Re: AGONIZING Mysql Select DB issue.
> 29926 by: Micah Stevens
>
> test - Please ignore
> 29927 by: vish.kohli
>
> Query runs fine on Console but not in PHP
> 29928 by: vish.kohli
>
> mysql date select statement
> 29929 by: Wendell Frohwein
> 29930 by: John W. Holmes
> 29931 by: Shahmat Dahlan
>
> Is there a better way to write this?
> 29932 by: Chris Payne
>
> Popup menu problem
> 29933 by: Kim Kohen
> 29934 by: John W. Holmes
>
> Administrivia:
>
> To subscribe to the digest, e-mail:
> [EMAIL PROTECTED]
>
> To unsubscribe from the digest, e-mail:
> [EMAIL PROTECTED]
>
> To post to the list, e-mail:
> [EMAIL PROTECTED]
>
>
> --
>
>
>
>
>
> From: Micah Stevens <[EMAIL PROTECTED]>
> Date: Sun Aug 17, 2003  4:56:24  PM US/Eastern
> To: Thomas Deliduka <[EMAIL PROTECTED]>, PHP-DB List
> <[EMAIL PROTECTED]>
> Subject: Re: [PHP-DB] AGONIZING Mysql Select DB issue.
>
>
>
> Try using the SQL to select which database.
>
> example, instead of:
>
> select * from table1
>
> use:
>
> select * from database1.table1
>
> if that works, and the php command doesn't that may mean the the mysql
> client
> lib is broken, although, I've been using it with mysql 4 and it seems
> to work
> fine.
>
> -Micah
>
>
> On Sunday 17 August 2003 1:49 pm, Thomas Deliduka wrote:
>> I'm not making two connections, I'm making one and only one call to
>> mysql_connect.  Also, there is no way in that function as per the
>> definition page of it (http://us3.php.net/mysql_connect) to have the
>> database selected as per your example below.
>>
>> With my connection though, when I do:
>> $dbh = Mysql_connect(blah, blah, blah)
>> Mysql_select_db("db1")
>>
>> I do call:
>> Mysql_query("query", $dbh);
>>
>> For some reason even though I am calling mysql_select_db("db1") it is
>> latching onto the first available database it has access to (or not
>> as the
>> case/permissions may be) and chooses "db2" instead.
>>
>> I don't know why, connecting to the MySQL 3.23 it selects the right
>> data

RE: [PHP-DB] array issue

2003-08-17 Thread jeffrey_n_Dyke

This may or may not make sense for your issue.  but if you have the whole
array in memory you can serialize()  it and write the string that the
function returns to the file.

$fp = fopen("yourfilename.txt", "w");
$my_array_s = serialize($my_array);
if (isset($fp)) {
  fwrite($fp, $my_array_s);
}

//to get it back into the same array as it was written, use
$fp_cache = fopen("yourfilename.txt", "r") or die("can't open file");
$fp_readc = fread($fp_cache, filesize("yourfilename.txt");
$my_array_new = unserialize($fp_readc);

the data is exactly as it was returned from the db after you looped through
the record set.

another idea. --http://www.php.net/manual/en/function.serialize.php
hth
jeff


   

  "Aaron Wolski"   

  <[EMAIL PROTECTED]To:   "'OpenSource'" <[EMAIL 
PROTECTED]>, "'PHP-DB'" <[EMAIL PROTECTED]>  
  z.com>   cc: 

   Subject:  RE: [PHP-DB] array issue  

  08/17/2003 11:33 

  AM   

   

   





First, are you sure there is data in $my_array?

Add this after you set the array:

echo """.print_r($my_array)."";

You'll need to loop through the array , writing each line in the file at
a time.

Something like:

//open the file stuff here
foreach ($my_array AS $values)
{

 fputs($fp, $value);

}
//close the file stuff here

HTH

Aaron

> -Original Message-
> From: OpenSource [mailto:[EMAIL PROTECTED]
> Sent: August 17, 2003 11:31 AM
> To: PHP-DB
> Subject: [PHP-DB] array issue
> Importance: High
>
> hi ya'll
>
> I am having a nightmare on this issue of mine.
> I've got this array that I need to write to a file...
>  sample code below 
>
> while (something);
> {
> query data base
>
> $r_ul=ifx_fetch_row($sideQuery4);
>
> $type1 = array($rotation."\n");
>
> switch ($r_ul['number'])
>{
> case '4';
> $linea = $type1;
> break;
>}
>
> $final = $linea[0];
>
> $my_array = array();
> array_push ($my_array, $final);
>
> }
>
> $file = 'db_dump.dat';
> $fp = fopen($file, "w");
> fputs($fp, $my_array); <--- I would like to write the complete array
into
> the file
> fclose($fp);
>
> kindly assist with this issue..
>
> Thanks in advance



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

2003-08-14 Thread jeffrey_n_Dyke

whoops, meant to include
thishttp://www.mysql.com/downloads/api-myodbc-3.51.html


   
 
  [EMAIL PROTECTED]
 
  ane.com  To:   Gerard Samuel <[EMAIL 
PROTECTED]>
   cc:   "Larry E.Ullman" <[EMAIL 
PROTECTED]>, [EMAIL PROTECTED], Robert   
  08/11/2003 10:37  Twitty <[EMAIL PROTECTED]> 
 
  AM   Subject:  Re: [PHP-DB] ODBC Database
 
   
 
   
 





there is _definitely_ a MyOdbc  Driver.  i'm using it



  Gerard Samuel
  <[EMAIL PROTECTED]>To:   Robert Twitty
  <[EMAIL PROTECTED]>
   cc:   "Larry E.Ullman"
  <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
  08/11/2003 10:35 Subject:  Re: [PHP-DB] ODBC
  Database
  AM






Robert Twitty wrote:

>Unless I am mistaken, but isn't there an ODBC driver available for MySQL
>called MyODBC?
>
>-- bob
>
I haven't a clue.  Ill look, maybe it will help me create drivers for my
DB layer, as I already know MySQL.
Last night I successfully connected to IBM's DB2, but I didnt get far
past that as I have to figure out,
how to create tables, figure out how it likes its schemas etc, to really
give it a work out...


--
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] Help needed with variable scoping? or mysql problem

2003-08-14 Thread jeffrey_n_Dyke

best way to tell is to place .'or die(mysql_error())' after any call to
mysql_query() to see what mysql is complaining about.  personally I
sometimes declare the query first so i can echo that as well after the
msyql_error() function, so i can see the query that has just been
excecuted.  helpful with dynamic queries.

$qry = "SELECT * FROM $tableName where $fieldName='$fieldValue'";
$result = mysql_query($qry, $conn) or die(mysql_error() . $qry);

hth
jeff


   
 
  "Mike Klein" 
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  rg>  cc: 
 
   Subject:  [PHP-DB] Help needed with 
variable scoping? or mysql problem   
  08/14/2003 08:58 
 
  AM   
 
   
 
   
 




I've been using JSP for some time now, and thought I'd write a couple of
rdbms explorers (flat tables, simple master/detail paradigm) using other
technologies, like PHP, Cocoon, etc. Well...it's been fun. I have more
working than not. But now I am hung up. I am getting wierd results in a php
script when I simply change the order of some mysql calls.

I'm using php-4.3.2, rh9, and mysql 3.23.

My error is the following (the first line above the Warning below is a dump
of parameters to the showMaster function which is what's bombing):

conn=Resource id #3 databaseName=info tableName=movies fieldName=title
fieldValue=36th Chamber
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
resource in /foo/bar/mywebsite/private/database.php on line 107

Line 107 is the  mysql_num_rows call below.

function showMaster($conn, $databaseName, $tableName, $fieldName,
$fieldValue)
{
echo "conn=$conn\n";
echo "databaseName=$databaseName\n";
echo "tableName=$tableName\n";
echo "fieldName=$fieldName\n";
echo "fieldValue=$fieldValue\n";

This code fails when placed here==
$result = mysql_query("SELECT * FROM $tableName where
$fieldName='$fieldValue'", $conn);
$numRows = mysql_num_rows($result);
if(mysql_num_rows($result) == 1)
{
showDetail($conn, $databaseName, $tableName, $fieldName,
$fieldValue, $result);
exit;
}
echo "numRows=$numRows\n";


$fields = mysql_list_fields($databaseName, $tableName, $conn);
$numFields = mysql_num_fields($fields);
echo "\n";
echo "";
for($i = 0; $i < $numFields; $i++)
{
printf("%s", mysql_field_name($fields, $i));
}
echo "";

The SAME code succeeds when placed here!==
$result = mysql_query("SELECT * FROM $tableName where
$fieldName='$fieldValue'", $conn);
$numRows = mysql_num_rows($result);
if(mysql_num_rows($result) == 1)
{
showDetail($conn, $databaseName, $tableName, $fieldName,
$fieldValue, $result);
exit;
}
echo "numRows=$numRows\n";


while($myrow = mysql_fetch_array($result))
...rest of method...
}

Any ideas on why this is? When I move the lines above (from
$result=...to...echo 'numRows') down a few lines to just before the
mysql_fetch_array, then everything works. Whazzup?!?


mike klein



--
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] MySQL Returns Error

2003-08-14 Thread jeffrey_n_Dyke

if i understand your question. why not take a different approach.  when the
form is submitted do your updates/inserts and then forward the page with
the header() function to another page, even if it is the same page, but
with a different set of variables set on the page, the idea being to remove
the $_POST/$_GET arrays containing your data

so at the end of your insert
header("Location: ".$_SERVER['PHP_SELF']."?inserted=true");

you can send them from whence they came with
header("Location: ".$_SERVER['HTTP_REFERER']);

hth
jd




   

  "Jeff"   

  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
  
  >cc: 

   Subject:  Re: [PHP-DB] MySQL Returns 
Error  
  08/05/2003 06:41 

  PM   

   

   





I'm unsure of both suggestions, can someone go into more detail?


"Richard Hutchins" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> So create a hidden input field on the page called cur_id and set its
value
> to the id of the record being displayed. If no record is currently being
> displayed, set it to -1.
>
> When you get ready to handle the form data, check the $_POST['cur_id']
> variable. If it's set to -1, perform an INSERT. If it's set to anything
> else, perform an UPDATE using the value of $_POST['cur_id'] in your WHERE
> clause.
>
> I'm sure there are other ways to handle this. This is how I have handled
it
> in the past though.
>
> > -Original Message-
> > From: Jeff [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, August 05, 2003 3:52 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP-DB] MySQL Returns Error
> >
> >
> > Oops, my mistake, it's not a blank entry  - it re enters the
> > last entry.
> >
> > I can hit F5 or click refresh 1000 times and it will enter
> > the last entry
> > 1000 times.
> >
> >
> > "Jeff" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > I tried putting that in a few diffrent places, same result
> > - is there
> > > somewhere special I need to put that?
> > >
> > > "Matt Schroebel" <[EMAIL PROTECTED]> wrote in message
> > > news:[EMAIL PROTECTED]
> > >
> > >
> > > > -Original Message-
> > > > From: Jeff [mailto:[EMAIL PROTECTED]
> > > > Sent: Tuesday, August 05, 2003 3:15 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Re: [PHP-DB] MySQL Returns Error
> > > >
> > > > Every time I access or refresh the page, it adds one blank
> > > > entry to the DB.
> > > >
> > > > Maybe I have the insert query in the wrong place?
> > >
> > > if ('POST' == $_SERVER['REQUEST_METHOD']) {
> > > //someone submitted the form with method="post"
> > > // so validate input, and if okay store it in db
> > > }
> > >
> > >
> >
> >
> >
> > --
> > 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: PHP & MSSQL

2003-08-14 Thread jeffrey_n_Dyke

personally, i had luck with the statement below, but have sent it to others
in the past and they had varying results.  but give this a shot at the top
of your page that your PHP code is running on.


mssql_query("set textsize 65536");

hth
Jeff


   
 
  "Adam Presley"   
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  m>   cc: 
 
   Subject:  [PHP-DB] Re: PHP & MSSQL  
 
  08/11/2003 10:26 
 
  AM   
 
   
 
   
 




I know what you're going through here. In MS SQL you can define a VARCHAR
up
to about 8000 characters, but your PHP mssql_query command only returns 255
(0 - 254) characters. I then tried using the TEXT datatype. TEXT datatype
in
MS SQL allows somewhere around 2 billion characters. However, the PHP
mssql_query command only returns 4096 characters every time. This appear to
be a limitation of the PHP MSSQL commands.


"Shaun Bentley" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
> I am currently trying to use PHP and MSSQL together but I am having a
> few problems.
>
> I can enter data into the Db OK, but when pulling the data back to
display
> on the page, the string cuts to around 250 chars. The Db field is VarChar
> 6000 and I can see the whole data in the field.
>
> I have tried pulling the data out as object, array & row but always lose
the
> end.
>
> Any help please!
>
> Shaun
>
>



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

2003-08-14 Thread jeffrey_n_Dyke

there is _definitely_ a MyOdbc  Driver.  i'm using it


   
 
  Gerard Samuel
 
  <[EMAIL PROTECTED]>To:   Robert Twitty <[EMAIL 
PROTECTED]>  
   cc:   "Larry E.Ullman" <[EMAIL 
PROTECTED]>, [EMAIL PROTECTED]   
  08/11/2003 10:35 Subject:  Re: [PHP-DB] ODBC Database
 
  AM   
 
   
 
   
 




Robert Twitty wrote:

>Unless I am mistaken, but isn't there an ODBC driver available for MySQL
>called MyODBC?
>
>-- bob
>
I haven't a clue.  Ill look, maybe it will help me create drivers for my
DB layer, as I already know MySQL.
Last night I successfully connected to IBM's DB2, but I didnt get far
past that as I have to figure out,
how to create tables, figure out how it likes its schemas etc, to really
give it a work out...


--
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] Breaking down a table field....

2003-08-14 Thread jeffrey_n_Dyke

SELECT DISTINCT(Unit) from TABLE_NAME;




   

  [EMAIL PROTECTED]
 
  sungard.com To:   [EMAIL PROTECTED]  
 
  cc:  

  08/07/2003 09:37 AM Subject:  [PHP-DB] Breaking down a 
table field   
   

   





I have a table, wth many entries.
Each entry has been asigned a unit to belong to.

I want to list all the units dynamically.
How can I display all the units, without displaying each instance of the
unit?

EG:

Unititem
breakfast   cereal
breakfast   toast
lunch   salad
lunch   sandwich
dinner  steak
dinner  pie
lunch   soup
dinner  lasagne

and so on..
I'd wanna get a list of:
breafast
lunch
dinner

not several instances of each...
how can I do this?

*
The information contained in this e-mail message is intended only for
the personal and confidential use of the recipient(s) named above.
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is
strictly prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original message.
***







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



Re: [PHP-DB] Don't know why query works this way

2003-08-14 Thread jeffrey_n_Dyke

there are many ways to approach this.
one is, select the db before any of this activity with mysql_select_db
("dbname") then you can run as many queries against this database as you
want.
Until you call that function again with another db name, mysql with
_always_ run against that database.

hth
jd




   
 
  Michael Cortes   
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  euf.net> cc: 
 
   Subject:  [PHP-DB] Don't know why query 
works this way   
  08/05/2003 11:35 
 
  PM   
 
  Please respond to
 
  cortesm  
 
   
 
   
 




I have been writing my queries like this...

$link = mysql_connect ($host, $username, $password);
$query = "insert into $table ('joe', 15)";
if ( mysql_db_query($dbname, $query, $link))  { }

But then I was reading that I should use mysl_query instead of
mysql_db_query.
But I was having a problem with where do i put the $dbname.

When I used:

mysql_query ($dbname, $query, $link)

I got an error message saying i had too many arguments.  So I changed it
to:

mysql_query ($query, $link)

I then got an error message saying it didn't know what database I was
connected to.  I finally got around the problem by including the database
name in the query, like so:

$query = "insert into $dbname.$table ('joe', 15)";

I shouldn't have to say, but this is a simplified example.  I didn't want
to
include all the fields, tables, values that the true example has.  The
question is, am I doing this right?  Do I have no choice but to retype the
$dbname all over the place if I want to use "mysql_query"?

Thank in advance for any help.


--

Michael Cortes
Fort LeBoeuf School District
34 East Ninth Street
PO Box 810
Waterford PA 16441-0810
814.796.4795

--
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] Calculated field in MySQL

2003-08-10 Thread jeffrey_n_Dyke

one thinglooks like you need one more outer set of paren's to tie both
sets of the equation together.

query = SELECT *, ((Year(Now()) - Year(BDAY)) + ((DAYOFYEAR(Now())
-DAYOFYEAR(BDAY))/365)) as AGE FROM Katalog WHERE AGE >= 31 AND AGE <= 50
AND IS_MEM_EXP = 0 AND IS_OPEN = 1 ORDER BY INPUT_DATE DESC

hth
jd



   
 
  "Morten  
 
  Twellmann"   To:   [EMAIL PROTECTED] 
  
  <[EMAIL PROTECTED]> cc:  

   Subject:  [PHP-DB] Calculated field in 
MySQL 
  08/10/2003 01:40 
 
  PM   
 
   
 
   
 




Hello,

I got the following error message from MySQL:
---
Query failed.

MySQL said:

Unknown column 'AGE' in 'where clause'

query = SELECT *, (Year(Now()) - Year(BDAY)) +
((DAYOFYEAR(Now())-DAYOFYEAR(BDAY))/365) as AGE FROM Katalog WHERE AGE >=
31
AND AGE <= 50 AND IS_MEM_EXP = 0 AND IS_OPEN = 1 ORDER BY INPUT_DATE DESC
---

Now, obviously the column should exist, since I am creating it in the
query,
but I do not seem to be able to find the bug.

If I would have used Access, I would have created a query inside the
database from my table and SELECT from that, but since I am not I have to
find other ways.

What I would like to do the most, would be to create a field in the table,
which would calculate the field inside the database, but it does not seem
to
be possible, though it would save me a lot of trouble every time I need
that
column in my application.

Could someone either tell me whats wrong with my query or tell me what I
need to do to make such a calculated field.

Much appreciated.

Morten Twellmann



--
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] Breaking down a table field....

2003-08-07 Thread jeffrey_n_Dyke

yep, sure is.
SELECT DISTINCT(Unit), Count(Unit) from TABLE  GROUP BY Unit

hth
jd


   

  [EMAIL PROTECTED]
 
  sungard.com To:   [EMAIL PROTECTED]  
 
  cc:   [EMAIL PROTECTED]  
 
  08/07/2003 09:52 AM Subject:  Re: [PHP-DB] Breaking down 
a table field   
   

   





Next question
How can I show how many of each there were?
SO now I have

breafast
lunch
dinner

I want to have

breafast2
lunch   3
dinner  3

etc...
is that just as easy?







[EMAIL PROTECTED]
07/08/2003 14:42


To: [EMAIL PROTECTED]
cc: [EMAIL PROTECTED]
Subject:Re: [PHP-DB] Breaking down a table field



SELECT DISTINCT(Unit) from TABLE_NAME;





  [EMAIL PROTECTED]
  sungard.com To: [EMAIL PROTECTED]

  cc:
  08/07/2003 09:37 AM Subject:  [PHP-DB]
Breaking down a table field






I have a table, wth many entries.
Each entry has been asigned a unit to belong to.

I want to list all the units dynamically.
How can I display all the units, without displaying each instance of the
unit?

EG:

Unititem
breakfast   cereal
breakfast   toast
lunch   salad
lunch   sandwich
dinner  steak
dinner  pie
lunch   soup
dinner  lasagne

and so on..
I'd wanna get a list of:
breafast
lunch
dinner

not several instances of each...
how can I do this?

*
The information contained in this e-mail message is intended only for
the personal and confidential use of the recipient(s) named above.
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is
strictly prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original message.
***







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





*
The information contained in this e-mail message is intended only for
the personal and confidential use of the recipient(s) named above.
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is
strictly prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original message.
***







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



Re: [PHP-DB] Text output from Mysql

2003-08-01 Thread jeffrey_n_Dyke

if there are line feeds in the text, you can use the function nl2br($text);

www.php.net/nl2br

if you require more, you may have to add logic. around headers/titles
etc...

hth
jeff


   
 
  "Neilmar"
 
  <[EMAIL PROTECTED]To:   <[EMAIL PROTECTED]>  
   
  com> cc: 
 
   Subject:  [PHP-DB] Text output from 
Mysql
  08/01/2003 11:09 
 
  AM   
 
   
 
   
 




Hi everyone,

How do you include linebreaks, paragraphs etc into text output from a mysql
database with php through a loop for all the records in a text field? This
is not row formatting but column info formatting e.g. story_abc TEXT;

Format text in story_abc field see e.g.
www.neilmar.com/falmouth/fal_current_events.php

It is all just running together. Do I place a code in the text body itself
in the mysql field?

Help! Help!

Thanks

Neil





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



Re: [PHP-DB] MySQL Date insert

2003-07-28 Thread jeffrey_n_Dyke

i have a feeling oyu're not getting a mysql error but a PHP error???  you
have an odd number of parentheses and mysql_error will not have an closing
paren.

if that is the case, try this
mysql_query("INSERT INTO Boats (Make, Model, Serial,Stock, Extension,
Cust_Name, Store, Date) VALUES
('$make', '$model', '$serial', '$stock', '$extension','$name', '$store',
'$date')")
or die("Invalid query: " . mysql_error() . "");





   
  
  "Andrew D. Luebke"   
  
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  hetres.com>   cc:
  
Subject:  [PHP-DB] MySQL Date insert   
  
  07/28/2003 02:16 
  
  PM   
  
   
  
   
  




Hello,
I have the following PHP code:

 $date = date("Y-m-d H:i:s");
 $result = mysql_query("INSERT INTO Boats (Make, Model, Serial,
Stock, Extension, Cust_Name, Store, Date) VALUES
 ('$make', '$model', '$serial', '$stock', '$extension',
'$name', '$store', '$date'")
 or die("Invalid query: " . mysql_error() .
 "");

The problem is with the Date column.  It is of type DATETIME.  I get an
error on the second line of the insert statement.  I assume I'm not putting
formatting the date-time variable correctly but I've tried everything I can
think of, so any help is very much appreciated.  Thanks.

Andrew.





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



Re: [PHP-DB] Problem with $_SERVER['HTTP_REFERER']

2003-07-28 Thread jeffrey_n_Dyke

is it possible that there is no referer.  what happens if you link to this
page from another, ensuring there is a referer, will it display it then?

Jeff


   
 
  Sugeng Utomo 
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  m>   cc: 
 
   Subject:  [PHP-DB] Problem with 
$_SERVER['HTTP_REFERER'] 
  07/28/2003 07:26 
 
  AM   
 
   
 
   
 




Dear all,

I have just got a problem with $_SERVER['HTTP_REFERER']; , I try to echo
this like below :



Then I open up in browser , and I got an error :

  "Notice: Undefined index: HTTP_REFERER in d:\referer.php on line 2"

I use Windows 2000 Professional , Apache 1.3.27 and PHP 4.3.2. Does anyone
knows about this one ?.

Thanx be4 ...

Best Regards,
  [EMAIL PROTECTED]


Neva say surrender 2 learn anything ...
So , Remember this always ...

-
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software





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



Re: [PHP-DB] Line of code should work...but doesn't

2003-07-24 Thread jeffrey_n_Dyke

that why i love this list.

thanks


   
 
  "John W. Holmes" 
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  rter.net>cc:   Aaron Wolski <[EMAIL 
PROTECTED]>, "'J. Michael Roberts'"   
<[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
 
  07/24/2003 12:24 Subject:  Re: [PHP-DB] Line of code 
should work...but doesn't
  PM   
 
  Please respond to
 
  holmes072000 
 
   
 
   
 




[EMAIL PROTECTED] wrote:

> this may work, but i hesitate, i've _never_ had to use exit to get my
code
> to excecute a redirect.  and i'm heavily reliant on this function.

I say again: There is a big difference between "works" and "the right
way to do it". Think about it logically... if you are going to redirect
to another page, there is absolutely no reason for another single line
of PHP code to be run from the current script... so exit()!

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals ? www.phparch.com









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



RE: [PHP-DB] Line of code should work...but doesn't

2003-07-24 Thread jeffrey_n_Dyke

this may work, but i hesitate, i've _never_ had to use exit to get my code
to excecute a redirect.  and i'm heavily reliant on this function.

did aarons fix work for you?  i think you're problem lies elsewhere.  as
i've just mocked the same thing on my server, but using 10 instead of
03...i'm on EST and its excecutes perfectly.

don't mean to cause waves...just curious.
Jeff




   
 
  "Aaron Wolski"   
 
  <[EMAIL PROTECTED]To:   "'J. Michael Roberts'" 
<[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
  z.com>   cc: 
 
   Subject:  RE: [PHP-DB] Line of code 
should work...but doesn't
  07/24/2003 10:12 
 
  AM   
 
   
 
   
 




if (strftime("%H") == "03")
{
 header( "Location: maintainence.php" );
 exit;
}

Note the exit; line.

Aaron

-Original Message-
From: J. Michael Roberts [mailto:[EMAIL PROTECTED]
Sent: July 24, 2003 10:09 AM
  To: [EMAIL PROTECTED]
Subject: [PHP-DB] Line of code should work...but doesn't

I've been going a little crazy here with a single line of code that
should work, but doesn't. It's probably has something to do with the
fact that I've been staring at pages of code for months on end.

In order to make user that nobody is screwing with the database while
the daily backups and maintainence are running, I decided to make a
little thing that would keep people from logging in, etc. Here's the
line:

if (strftime("%H") == "03") { header( "Location: maintainence.php" ); }

In theory, if it's any time between 03:00:00 and 03:59:59 the user
should be redirected to the page maintainence.php, but when testing it
passes over this line without a blip. Any ideas?

Feeling fried,
--JMR





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

2003-07-22 Thread jeffrey_n_Dyke

you can't use COL_NAME = NULL or COL_NAME = 'NULL' and get the desired
results , you have to check for IS NULL/ IS NOT NULLSo, change the
query to

SELECT * FROM TABLE WHERE MY_FIELD IS NULL  or,
SELECT * FROM TABLE WHERE MY_FIELD IS NOT NULL

>From my understanding when you check for  COL_NAME = 'Null' you're actually
checking to see if your field contains a _string_  'Null'

hth
jeff




   
 
  "Boaz Yahav" 
 
  <[EMAIL PROTECTED]To:   "Ron Allen" <[EMAIL 
PROTECTED]>, <[EMAIL PROTECTED]>   
  .net.il> cc: 
 
   Subject:  RE: [PHP-DB] Query problem
 
  07/22/2003 03:16 
 
  PM   
 
   
 
   
 




Assuming you run MySQL, why don't you just remove the " ' "?

SELECT * FROM MyTable WHERE MyField=NULL

Sincerely

berber

Visit http://www.weberdev.com/ Today!!!
To see where PHP might take you tomorrow.
Share your code : http://addexample.weberdev.com


-Original Message-
From: Ron Allen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 22, 2003 11:29 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Query problem


I have done this in the past, but for some reason it isn't working now
(maybe a moron).  I am trying to select all of the empty or NULL fields
in a column.

This is what I have
select * from ticket where Type = 'Line' and Closeddate = ' empty space'
and have tried the following select * from ticket where Type = 'Line'
and Closeddate = 'Null' select * from ticket where Type = 'Line' and
Closeddate = 'NULL'

any clues 



--
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] Inserting a large number of rows into mySQL

2003-07-18 Thread jeffrey_n_Dyke

If you have the standard table type installed
As you loop though though the arrays in PHP get ahold of the last ID
inserted via mysql_insert_id() and add it to an $inserted_array variable
and then at each insert check that the last insert was successful, and if
not send your db a bunch of deletes based on the keys in $inserted_array.

but if you are running a InnoDB or BDB table then you can set AUTOCOMMIT =
0 and use the Begin/Commit/Rollback syntax to accomplish this.

hth...i'm sure there are 10 more ways to do this
jeff




   
  
  "Anthony"
  
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  mputer.com>   cc:
  
Subject:  [PHP-DB] Inserting a large 
number of rows into mySQL   
  07/18/2003 10:04 
  
  AM   
  
   
  
   
  




I'm writing an app where I must insert a large number of rows into a mySQL
database individually.  All the rows are related to each other, so I need
to
ensure that integrity is maintained.  In the event that one of the inserts
fails, I need to be able to roll back all the prior inserts.  What is the
best way to insert the rows individually, yet still have this ability?  The
rows will be inserted by looping though an array in PHP.  Thanks.

- Anthony



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



  1   2   3   >