Re: [PHP-DB] Re: Excel to MySQL

2005-01-25 Thread Balwant Singh
As suggested by David, save the excel file as CSV file then you can
insert the data into database through command like LOAD INFILE for MYSQL

with best wishes
balwant


On Tue, 2005-01-25 at 12:34, David Robley wrote:
> On Tuesday 25 January 2005 08:07, Novice Learner wrote:
> 
> > Hello,
> >  
> > I have an Excel worksheet with a database in it. I would like to move this
> > data to the database on the server that would work with my .php files.
> >  
> > Is there a way?
> >  
> > I apologize if I posted this question on the wrong list.
> >  
> > Thank you,
> 
> One option might be to export the Excel data as csv, then use whatever
> option your database provides to import the csv data.
> 
> -- 
> David Robley
> 
> Nostalgia isn't what it used to be.

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



[PHP-DB] Really Stuck!

2005-01-25 Thread Ben
Hello all,

As a beginner I have been trying to send two attachments from my HTML form.
Below is the code I have been using. The problem is, I seem to only be able
to send one or the other, when I send both, although they go through, the
text I want displayed tags 6110 etc, is also sent as an attachment. Any help
would be greatly appreciated as I have a huge headache!

http://www.tlwebsolutions.co.uk/form/";);
}
?> 

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



Re: [PHP-DB] Really Stuck!

2005-01-25 Thread Jochem Maas
Ben wrote:
Hello all,
As a beginner I have been trying to send two attachments from my HTML form.
the code you posted has no baring on DB stuff. so probably you question was
better aimed at php-generals, anyways
Below is the code I have been using. The problem is, I seem to only be able
to send one or the other, when I send both, although they go through, the
text I want displayed tags 6110 etc, is also sent as an attachment. Any help
would be greatly appreciated as I have a huge headache!
not surprised, anyway save you self more headache - get phpmailer instead, 
some smart
guy(s) has done all the work for you :-)
phpmailer.sourceforge.net

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


[PHP-DB] Re: Excel to MySQL

2005-01-25 Thread Novice Learner

Many thanks to all 

 



-
Do you Yahoo!?
 All your favorites on one personal page – Try My Yahoo!

Re: [PHP-DB] last record

2005-01-25 Thread Martin Norland
neil wrote:
Thanks Peter
The reason I was wanting to do it in php was because the sql query is quite
complex and variable depending on the input from a form.
When the result page is presented I want to provide a link to the last
record at the top of the page.
After connecting and selecting the table I am constructing the query
I then want pick off the last record
and then get all the records
the rather cludgy way I am doing it is this:
First run
 $result = mysql_query($sqlstr." desc limit 0,1");
 $row = mysql_fetch_assoc($result);
Second run
 $result = mysql_query($sqlstr);
 while ($row = mysql_fetch_assoc($result)) {
This is fine while there is only one order by appended to the query but if
there is none or more than one it doesn't work so well
   ^ it doesn't work so well because you're only desc ordering the last 
item, instead of all of them.  You'll want to track all the items you're 
trying to order by, and build a separate ending for the two queries from 
them.

This will work well if mysql can and actually does cache the result - 
but if it doesn't, then it will have to analyze and run both queries in 
full.  Is there any reason you can't pull all the data in from the query 
- tossing it in an array, then emit the last row, then move on to 
looping over the array?

  Those are pretty much your options, as I see it - either burn memory 
in php storing the result set, or do the query twice.  Are you memory 
limited or cpu limited? :)

There might be a way to move back and forth along a mysql result set - 
maybe you can push all the way to the end, then reset its 'pointer' and 
get it from the beginning again...

[from the manual]
mysql_data_seek() moves the internal row pointer of the MySQL result 
associated with the specified result identifier to point to the 
specified row number. The next call to mysql_fetch_row() would return 
that row.

Row_number starts at 0. The row_number should be a value in the range 
from 0 to mysql_num_rows - 1.
[/snip]

So - move to mysql_num_rows() - 1, get the row, then move to 0 and do 
your while.  Neat - learned something new.

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

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


[PHP-DB] brackets []

2005-01-25 Thread Craig Hoffman
Quick question...
I am hoping some could explain this to me.  I have an array like this:
$completed = array($value1, $value2, $value3);
where the values are sent via a form.

when I do print_ r() to see what's in the array I get this:
Array (  [0] => [1] => [2] => )
An empty array. But when I do this:
$completed[] = array($value1, $value2, $value3);
Array (  [0] => 1  [1] => 1  [2] => Done  [3] => 2  [4] => 1  [5] => 3  
[6] => 1  [7] => 4  [8] => 1  [9] => Array  (  [0] => [1] => [2] => )  
)

I get a multidimensional array with keys and values.  How can I get 
this array to be one dimensional?

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


Re: [PHP-DB] brackets []

2005-01-25 Thread Martin Norland
Craig Hoffman wrote:
Quick question...
I am hoping some could explain this to me.  I have an array like this:
$completed = array($value1, $value2, $value3);
where the values are sent via a form.

when I do print_ r() to see what's in the array I get this:
Array (  [0] => [1] => [2] => )
An empty array. But when I do this:
No, an array with 3 keys with empty/null values.
$completed[] = array($value1, $value2, $value3);
The [] operator is for adding items to the end of an array (appending).
Array (  [0] => 1  [1] => 1  [2] => Done  [3] => 2  [4] => 1  [5] => 3  
[6] => 1  [7] => 4  [8] => 1  [9] => Array  (  [0] => [1] => [2] => )  )

I get a multidimensional array with keys and values.  How can I get this 
array to be one dimensional?
array_merge() is a function that will do what you're trying there - be 
warned that it changed to error on non-arrays in php5, so for forward 
compatibility it would be wise to either instantiate all values you pass 
to it - or test if they're arrays and not do it if null/etc.

*However* - if you just want to add those items to the end of the array, 
you can also just do $completed[] = $value1; (repeat) - because I'm not 
sure you know exactly what format you're going for.

When you post the form, $_POST['completed'] holds an array with values 
for each box that was checked.  You shouldn't be populating it yourself 
on the backend like that (if that's actual code and not just a 
description of how it should look) - and what you print looks 
particularly concerning as there are multiple keys that resolve to the 
same value (1's) - a checkbox only passes its value if checked, so 
you've got multiple checkboxes with the same value, or you're 
overworking yourself.

Basically - it's hard to diagnose your code when you've clearly cut and 
paste bits and pieces between.  We don't need to see your super secret 
new method of sorting data, but we do need to see all code related to 
the question at hand.  It looks to me like you're over-munging your data 
trying to get something out of it formatted just so, instead of just 
reading the data you need from where it is.

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

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


Re: [PHP-DB] brackets []

2005-01-25 Thread Micah Stevens
On Tuesday 25 January 2005 07:38 am, Craig Hoffman wrote:
> Quick question...
> I am hoping some could explain this to me.  I have an array like this:
>
> $completed = array($value1, $value2, $value3);
>
> where the values are sent via a form.
> 
>
> when I do print_ r() to see what's in the array I get this:
> Array (  [0] => [1] => [2] => )
>
> An empty array. But when I do this:

Are you sure it's empty? If the checkbox is checked, they should contain the 
value of that checkbox. That's my experience. 

> $completed[] = array($value1, $value2, $value3);
>
> Array (  [0] => 1  [1] => 1  [2] => Done  [3] => 2  [4] => 1  [5] => 3
> [6] => 1  [7] => 4  [8] => 1  [9] => Array  (  [0] => [1] => [2] => )
> )
>
> I get a multidimensional array with keys and values.  How can I get
> this array to be one dimensional?

$completed = array($value1, $value2, $value3);

your other assignment line is basically saying, let the first array value 
equal another array of 3 values. 


HTH
-Micah

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



[PHP-DB] storing images in database

2005-01-25 Thread Chip Wiegand
I have stored a .jpg image in a database, then when I make a sql statement 
to display that image on a web page all I get is the cryptic code in place 
of the image. I am storing it in a row configured as a blob, mime type 
image/jpeg and binary (using phpMyAdmin). What am I doing wrong?
Regards, 
Chip

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



[PHP-DB] Any recomendations on a report writer to use with MY-SQL

2005-01-25 Thread Bestman4unowwa
Does Crystal Reports work with MY-SQL? Are there any open source tools that  
are like Crystal Reports?


[PHP-DB] Double Inserts

2005-01-25 Thread PHPDiscuss - PHP Newsgroups and mailing lists
Hi, I am new to the mailing list and to PHP / MySQL. I am facing an
unususal problem. I am trying to insert some data into MySQL DB through
via Web. The code is executed OK - no errors but the same record gets
inserted TWICE. I have checked the code and simplified it as much as
possible and tried test scripts with same results. I have also tried
statements to echo messages to ensure the code is not executed twice. 

It happens with IE as wells as Mozilla so I don't think it is a browser
issue. The only clue is that it does not seem to happen on a slower
machine (Laptop). The configurations, versions etc are identical - Apache
2.0.49, MySQL 4.1.6-gamma-nt, PHP 5.0.2

Has anyone faced this and found a solution? Please help.

Shri

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



RE: [PHP-DB] Any recomendations on a report writer to use with MY-SQL

2005-01-25 Thread Bastien Koert
http://sourceforge.net/projects/datavision/
you can use cyrstal with mysql...
bastien
From: [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Any recomendations on a report writer to use with MY-SQL
Date: Tue, 25 Jan 2005 12:20:00 EST
Does Crystal Reports work with MY-SQL? Are there any open source tools that
are like Crystal Reports?
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Double Inserts

2005-01-25 Thread Bastien Koert
post code...can't read minds, you know
;-)
Bastien
From: [EMAIL PROTECTED] (PHPDiscuss - PHP Newsgroups and mailing lists)
To: php-db@lists.php.net
Subject: [PHP-DB] Double Inserts
Date: 25 Jan 2005 17:32:28 -
Hi, I am new to the mailing list and to PHP / MySQL. I am facing an
unususal problem. I am trying to insert some data into MySQL DB through
via Web. The code is executed OK - no errors but the same record gets
inserted TWICE. I have checked the code and simplified it as much as
possible and tried test scripts with same results. I have also tried
statements to echo messages to ensure the code is not executed twice.
It happens with IE as wells as Mozilla so I don't think it is a browser
issue. The only clue is that it does not seem to happen on a slower
machine (Laptop). The configurations, versions etc are identical - Apache
2.0.49, MySQL 4.1.6-gamma-nt, PHP 5.0.2
Has anyone faced this and found a solution? Please help.
Shri
--
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] Double Inserts

2005-01-25 Thread Hutchins, Richard
Please post ALL relevant code.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 25, 2005 12:32 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Double Inserts


Hi, I am new to the mailing list and to PHP / MySQL. I am facing an
unususal problem. I am trying to insert some data into MySQL DB through
via Web. The code is executed OK - no errors but the same record gets
inserted TWICE. I have checked the code and simplified it as much as
possible and tried test scripts with same results. I have also tried
statements to echo messages to ensure the code is not executed twice. 

It happens with IE as wells as Mozilla so I don't think it is a browser
issue. The only clue is that it does not seem to happen on a slower
machine (Laptop). The configurations, versions etc are identical - Apache
2.0.49, MySQL 4.1.6-gamma-nt, PHP 5.0.2

Has anyone faced this and found a solution? Please help.

Shri

-- 
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] Mozilla inserts twice, IE does OK... ?

2005-01-25 Thread PHPDiscuss - PHP Newsgroups and mailing lists
Another dimension to the problem --- I am running my code on two separate
machines (Desk top & a laptop) the desktop (faster?) has this problem,
notebook (slower?) doesn't. I have code that checks for duplicate inserts
and warns user. Even this fails and the database ends up with two
identical records..

Has any one faced and solved this?

Shri


Steven wrote:

> Hi all

> Note in the source that in the MySQL Insert query "VALUES" starts at a new
> line.

> I put a DELETE command right after the INSERT command, to temporary catch
> the double line.  When I did that, I placed the "VALUES..."-part on the
> same line as the first part of the query and the double inserts
> disappeared.  (ofcourse)

> Weird is:  I removed the DELETE-command, and placed the VALUES-part on
> another line again, and the data is still inserted once in the table.

> Very strange, but I hope putting all of the query on a single line is a
> possible solution for this weird behavior :-)

> Anyone has any idea about this ?


> Steven


> > I'm not using the browsers 'view source' at all...  Only the 'view source'
> > function from PHP.
> > But when none of the source is checked, and even right after a restart of
> > MySQL and Apache, the dual insert resists...
> >
> > Funny thing is, I've had this problem in another section of the site, and
> > it
> > disappeared without any known cause.
> > And not to forget: problem doesn't appear in IE6, only in Mozilla and
> > firefox running on WinXP and Gnome2.
> >
> >
> > The code:
> > The file is called shop.php, and contains different functions indicated by
> > a
> > query-string value and separated by a Switch-structure.
> > I post the global code and the section for saving this data into MySQL.
> > If
> > you need the other code, please ask me
> > (I'm trying to avoid that for mailing too much code at once...)
> >
> >  > require ("classes/class_shops.php");
> > $shop = new shop;
> >
> > $dbconn=mysql_pconnect("localhost", "steven", "steven") or die
> > (mysql_error());
> > mysql_select_db("steven");
> >
> >
> > function pageheader () {
> > echo "SHOPS";
> > }
> >
> > $id = $_GET["id"];
> > $shopmode = $_GET["shopmode"];
> >
> > pageheader();
> >
> > switch ($shopmode) {   //shop, cat, item, reg, verify, save,
> > default
> > case "shop":
> > ...
> > case "cat":
> > ...
> > case "item":
> > ...
> > case "reg":
> > ...
> > case "verify":
> > ...
> > case "save":
> > echo "SAVE";
> > $name = $_POST["name"];
> > $logo = $_POST["logo"];
> > $logoname = $_POST["logoname"];
> > $address = $_POST["address"];
> > $pcode = $_POST["pcode"];
> > $location = $_POST["location"];
> > $area = $_POST["area"];
> > $phone = $_POST["phone"];
> > $email = $_POST["email"];
> >
> > //THIS is code that inserts an already uploaded
> > image in a separate table, and returns the ID
> > if ($logoname!="" && $logo!="") {
> > require ("classes/class_image.php");
> > $img = new image;
> > $upload = $img->image_upload($logo,
> > $logoname);
> > $logoID = $upload[2];
> > } else {
> > $logoID="";
> > }
> >
> > mysql_query ("INSERT INTO shop (name, logo,
> > address, pcode, location, area, phone, email, dateadded)
> > VALUES ('$name', '$logoID',
> > '$address', '$pcode', '$location', '$area', '$phone', '$email', '" .
> > microtime() . "');", $dbconn) or die("ikke: " . mysql_error());
> > echo "Uw gegevens werden bewaard!  Klik  > href=>hier om terug te gaan";
> > //translated: Your data has been saved!
> > break;
> > case default:
> > ...
> > }
> > ?>
> >
> >
> >
> > -Original Message-
> > From: Norland, Martin [mailto:[EMAIL PROTECTED]
> > Sent: maandag 6 december 2004 15:53
> > To: php-db@lists.php.net
> > Subject: RE: [PHP-DB] Mozilla inserts twice, IE does OK... ?
> >
> > Are you using view source a lot?  (some of) Mozillas view source
> > commands send the query again, minus the POST vars.  This could be the
> > behaviour you're seeing.
> >
> > I say some of because there are multiple ways of viewi

Re: [PHP-DB] Any recomendations on a report writer to use with MY-SQL

2005-01-25 Thread Miles Thompson
Any report writer that supports ODBC.
As far as I know, there are no open source report writers like CR. (Gawd, 
I'd hope they'd be better; my relationship with CR is sort of love-hate.) 
Love it when the job's done, hate having to touch a working report because 
everything's binary & when it breaks, that's it. I also hate upgrades 
(think 9.0) that break or no longer support earlier methods.

I feel better now, having go that off my chest.
So, how complex is the report, and would it be that difficult to code? Then 
you can take it to any machine.

Miles
At 01:20 PM 1/25/2005, [EMAIL PROTECTED] wrote:
Does Crystal Reports work with MY-SQL? Are there any open source tools that
are like Crystal Reports?
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] storing images in database

2005-01-25 Thread Micah Stevens

Could be lots of things, improper/missing headers is most likely, although 
it's not clear from your statement if you're displaying the binary data 
directly in the page or are you calling an image output script in an image 
tag. (as you should)

Show some code and the answer will be clear. 

-Micah 

On Tuesday 25 January 2005 09:11 am, Chip Wiegand wrote:
> I have stored a .jpg image in a database, then when I make a sql statement
> to display that image on a web page all I get is the cryptic code in place
> of the image. I am storing it in a row configured as a blob, mime type
> image/jpeg and binary (using phpMyAdmin). What am I doing wrong?
> Regards,
> Chip

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



RE: [PHP-DB] storing images in database

2005-01-25 Thread Bastien Koert
you can not ouput html and binary data at the same time. you need to have 
image headers sent to the browser to show the image properly.

the best way to do this is to move the image processing code to a separate 
page and include it like this

echo '';
then the image page looks like this:

if($_GET['id']) {
$id = $_GET['id'];
// you may have to modify login information for your database server:
@MYSQL_CONNECT("localhost","root","password");
@mysql_select_db("binary_data");
$query = "select bin_data,filetype from binary_data where id=$id";
$result = @MYSQL_QUERY($query);
$data = @MYSQL_RESULT($result,0,"bin_data");
$type = @MYSQL_RESULT($result,0,"filetype");
Header( "Content-type: $type");
echo $data;
};
?>
bastien

From: Chip Wiegand <[EMAIL PROTECTED]>
To: "PHP DB" 
Subject: [PHP-DB] storing images in database
Date: Tue, 25 Jan 2005 09:11:07 -0800
I have stored a .jpg image in a database, then when I make a sql statement
to display that image on a web page all I get is the cryptic code in place
of the image. I am storing it in a row configured as a blob, mime type
image/jpeg and binary (using phpMyAdmin). What am I doing wrong?
Regards,
Chip
--
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] Double Inserts

2005-01-25 Thread Jochem Maas
Bastien Koert wrote:
post code...can't read minds, you know
;-)

well yes, you have to understand Bastien is only an apprentice has not
yet been initiated into the inner mind-readers circle.
I on the other hand can tell you with utmost certainty that the solution is 42

give us code so we can get our 'helpers' fix :-)
Bastien
From: [EMAIL PROTECTED] (PHPDiscuss - PHP Newsgroups and mailing 
lists)
To: php-db@lists.php.net
Subject: [PHP-DB] Double Inserts
Date: 25 Jan 2005 17:32:28 -

Hi, I am new to the mailing list and to PHP / MySQL. I am facing an
unususal problem. I am trying to insert some data into MySQL DB through
via Web. The code is executed OK - no errors but the same record gets
inserted TWICE. I have checked the code and simplified it as much as
possible and tried test scripts with same results. I have also tried
statements to echo messages to ensure the code is not executed twice.
It happens with IE as wells as Mozilla so I don't think it is a browser
issue. The only clue is that it does not seem to happen on a slower
machine (Laptop). The configurations, versions etc are identical - Apache
2.0.49, MySQL 4.1.6-gamma-nt, PHP 5.0.2
Has anyone faced this and found a solution? Please help.
Shri
--
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] Double Inserts

2005-01-25 Thread Bastien Koert
I am but your padawan
Bastien
From: Jochem Maas <[EMAIL PROTECTED]>
To: Bastien Koert <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED], php-db@lists.php.net
Subject: Re: [PHP-DB] Double Inserts
Date: Tue, 25 Jan 2005 19:41:43 +0100
Bastien Koert wrote:
post code...can't read minds, you know
;-)

well yes, you have to understand Bastien is only an apprentice has not
yet been initiated into the inner mind-readers circle.
I on the other hand can tell you with utmost certainty that the solution is 
42


give us code so we can get our 'helpers' fix :-)
Bastien
From: [EMAIL PROTECTED] (PHPDiscuss - PHP Newsgroups and mailing 
lists)
To: php-db@lists.php.net
Subject: [PHP-DB] Double Inserts
Date: 25 Jan 2005 17:32:28 -

Hi, I am new to the mailing list and to PHP / MySQL. I am facing an
unususal problem. I am trying to insert some data into MySQL DB through
via Web. The code is executed OK - no errors but the same record gets
inserted TWICE. I have checked the code and simplified it as much as
possible and tried test scripts with same results. I have also tried
statements to echo messages to ensure the code is not executed twice.
It happens with IE as wells as Mozilla so I don't think it is a browser
issue. The only clue is that it does not seem to happen on a slower
machine (Laptop). The configurations, versions etc are identical - Apache
2.0.49, MySQL 4.1.6-gamma-nt, PHP 5.0.2
Has anyone faced this and found a solution? Please help.
Shri
--
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] Double Inserts

2005-01-25 Thread Martin Norland
Bastien Koert wrote:
I am but your padawan
Bastien
[snip]
From: Jochem Maas <[EMAIL PROTECTED]>

well yes, you have to understand Bastien is only an apprentice has not
yet been initiated into the inner mind-readers circle.
I on the other hand can tell you with utmost certainty that the 
solution is 42

[snip]
In all fairness, I'd say Bastien is a frood who really knows where his 
towel is[1].  He's surely finishing up his apprenticeship.

1> http://hhgproject.org/entries/towel.html
Cheers,
--
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] Double Inserts

2005-01-25 Thread Bastien Koert
I thank you deeply for your kind words.
Drink up, the worlds about to end.
Bastien
From: Martin Norland <[EMAIL PROTECTED]>
Reply-To: php-db@lists.php.net
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Double Inserts
Date: Tue, 25 Jan 2005 13:01:40 -0600
Bastien Koert wrote:
I am but your padawan
Bastien
[snip]
From: Jochem Maas <[EMAIL PROTECTED]>

well yes, you have to understand Bastien is only an apprentice has not
yet been initiated into the inner mind-readers circle.
I on the other hand can tell you with utmost certainty that the solution 
is 42

[snip]
In all fairness, I'd say Bastien is a frood who really knows where his 
towel is[1].  He's surely finishing up his apprenticeship.

1> http://hhgproject.org/entries/towel.html
Cheers,
--
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


[PHP-DB] IIS, PHP, and session data

2005-01-25 Thread Perry, Matthew (Fire Marshal's Office)
I am having trouble with my session data on Microsoft IIS.

Here is a little background of the problem:

 

1)   I am not personally in control of our web server.  Our IT
department manages it.  They have IIS running on their sever and use MS SQL
Server, but they have allowed me to use PHP instead of ASP.

2)   I have Apache running on a local web server in our office (not the
IT department).  It accesses the SQL Server database remotely.  I have
register_global turned OFF and use the following code on each page: 

session_start();

session_register('logged_in');

session_register('username');

etc...

Everything works PERFECTLY on my local system.

3)   I have ported all of my code to the IIS server location.  It
accesses the database correctly but displays an error message when I try to
use the session data.  It does NOT post messages that the session could not
be started (which is the normal sign of session data not being allowed).
The message says the variable does not exist.  It is as if the session is
started but the variables aren't being saved.

 

The question I have is:

What concerns should I have with PHP sessions when I move from Apache to
IIS?

 

I do NOT need to know how to set up IIS to allow session data correctly
(that's the job of our IT department).  If this sounds like something our IT
department has set up wrong, please do not feel compelled to answer this
question.  I just would appreciate some advice on what I may need to change
in my own code so that it works with IIS instead of Apache.

 

Thank you for your time,

Matthew Perry



Re: [PHP-DB] Double Inserts

2005-01-25 Thread Jochem Maas
Martin Norland wrote:
Bastien Koert wrote:
I am but your padawan
brilliant.
Bastien
[snip]
From: Jochem Maas <[EMAIL PROTECTED]>

well yes, you have to understand Bastien is only an apprentice has not
yet been initiated into the inner mind-readers circle.
I on the other hand can tell you with utmost certainty that the 
solution is 42

[snip]
In all fairness, I'd say Bastien is a frood who really knows where his 
towel is[1].  He's surely finishing up his apprenticeship.

1> http://hhgproject.org/entries/towel.html
ditto.
:-)
Cheers,
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] storing images in database

2005-01-25 Thread Chip Wiegand
Thanks Bastien,
In testing this I have added the code samples to a page and have it 
working except the path statement is not correct. For now, I've just added 
all the code to one page, rather than including a second page. The 
statement - echo ''; is resulting in this error - The 
requested URL /id=$id was not found on this server. Any suggestions?
Thanks,
Chip

"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 09:45:39 AM:

> the best way to do this is to move the image processing code to a 
separate 
> page and include it like this
> 
> echo '';
> 
> then the image page looks like this:
>  
> if($_GET['id']) {
> $id = $_GET['id'];
> // you may have to modify login information for your database server:
> @MYSQL_CONNECT("localhost","root","password");
> 
> @mysql_select_db("binary_data");
> 
> $query = "select bin_data,filetype from binary_data where id=$id";
> $result = @MYSQL_QUERY($query);
> 
> $data = @MYSQL_RESULT($result,0,"bin_data");
> $type = @MYSQL_RESULT($result,0,"filetype");
> 
> Header( "Content-type: $type");
> echo $data;
> 
> };
> ?>
> 
> bastien
> 
> 
> 
> >From: Chip Wiegand <[EMAIL PROTECTED]>
> >To: "PHP DB" 
> >Subject: [PHP-DB] storing images in database
> >Date: Tue, 25 Jan 2005 09:11:07 -0800
> >
> >I have stored a .jpg image in a database, then when I make a sql 
statement
> >to display that image on a web page all I get is the cryptic code in 
place
> >of the image. I am storing it in a row configured as a blob, mime type
> >image/jpeg and binary (using phpMyAdmin). What am I doing wrong?
> >Regards,
> >Chip
> >
> >--
> >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] storing images in database

2005-01-25 Thread Bastien Koert
Its not src='id=$id'> that will defnintely blow up
echo '';
where $id is the id of the record you are trying to get the image to...
Bastien

From: Chip Wiegand <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
CC: php-db@lists.php.net
Subject: RE: [PHP-DB] storing images in database
Date: Tue, 25 Jan 2005 12:37:15 -0800
Thanks Bastien,
In testing this I have added the code samples to a page and have it
working except the path statement is not correct. For now, I've just added
all the code to one page, rather than including a second page. The
statement - echo ''; is resulting in this error - The
requested URL /id=$id was not found on this server. Any suggestions?
Thanks,
Chip
"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 09:45:39 AM:
> the best way to do this is to move the image processing code to a
separate
> page and include it like this
>
> echo '';
>
> then the image page looks like this:
> 
> if($_GET['id']) {
> $id = $_GET['id'];
> // you may have to modify login information for your database server:
> @MYSQL_CONNECT("localhost","root","password");
>
> @mysql_select_db("binary_data");
>
> $query = "select bin_data,filetype from binary_data where id=$id";
> $result = @MYSQL_QUERY($query);
>
> $data = @MYSQL_RESULT($result,0,"bin_data");
> $type = @MYSQL_RESULT($result,0,"filetype");
>
> Header( "Content-type: $type");
> echo $data;
>
> };
> ?>
>
> bastien
>
>
>
> >From: Chip Wiegand <[EMAIL PROTECTED]>
> >To: "PHP DB" 
> >Subject: [PHP-DB] storing images in database
> >Date: Tue, 25 Jan 2005 09:11:07 -0800
> >
> >I have stored a .jpg image in a database, then when I make a sql
statement
> >to display that image on a web page all I get is the cryptic code in
place
> >of the image. I am storing it in a row configured as a blob, mime type
> >image/jpeg and binary (using phpMyAdmin). What am I doing wrong?
> >Regards,
> >Chip
> >
> >--
> >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] IIS, PHP, and session data

2005-01-25 Thread Jochem Maas
Perry, Matthew (Fire Marshal's Office) wrote:
I am having trouble with my session data on Microsoft IIS.
Here is a little background of the problem:
 

1)   I am not personally in control of our web server.  Our IT
department manages it.  They have IIS running on their sever and use MS SQL
Server, but they have allowed me to use PHP instead of ASP.
2)   I have Apache running on a local web server in our office (not the
IT department).  It accesses the SQL Server database remotely.  I have
register_global turned OFF and use the following code on each page: 

session_start();
session_register('logged_in');
session_register('username');
have you tried using the $_SESSION superglobal instead?
you dont state the versions of php btw.
...
Thank you for your time,
Matthew Perry

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


RE: [PHP-DB] storing images in database

2005-01-25 Thread Bastien Koert
And how are you feeding the $id?are you setting a value for that 
element?

In the sample code the default is the record_id that corresponds back to the 
id of the row with the image blob field.

Bastien


From: Chip Wiegand <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
CC: "PHP DB" 
Subject: RE: [PHP-DB] storing images in database
Date: Tue, 25 Jan 2005 12:57:40 -0800
"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 12:46:12 PM:
> yes goes back to the whole header problem which is why you are here.
>
> If you could post the code, it would be simpler to help you...
>
> Bastien
This is in the main page -
%s", $row["text"]);
?>
and this is in a new included page -

$data = @MYSQL_RESULT($result,0,"image");
$type = @MYSQL_RESULT($result,0,"type");
Header( "Content-type: $type");
echo $data;
};
?>
The database connection statements are in an include file called at the
top of the main page. In the first statement shown above the alt text for
the image appears on the web page just fine, the image itself shows a
broken image icon. FWIW, I have the image stored in the database in a blob
field, is that correct?
--
Chip
> >From: Chip Wiegand <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: RE: [PHP-DB] storing images in database
> >Date: Tue, 25 Jan 2005 12:44:44 -0800
> >
> >"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 12:39:15
PM:
> >
> > > Its not src='id=$id'> that will defnintely blow up
> > >
> > > echo '';
> > >
> > > where $id is the id of the record you are trying to get the image
to...
> > >
> > > Bastien
> >
> >So the code has to be a seperate included page I guess?
> >--
> >Chip
> >
> > > >From: Chip Wiegand <[EMAIL PROTECTED]>
> > > >To: [EMAIL PROTECTED]
> > > >CC: php-db@lists.php.net
> > > >Subject: RE: [PHP-DB] storing images in database
> > > >Date: Tue, 25 Jan 2005 12:37:15 -0800
> > > >
> > > >Thanks Bastien,
> > > >In testing this I have added the code samples to a page and have it
> > > >working except the path statement is not correct. For now, I've
just
> >added
> > > >all the code to one page, rather than including a second page. The
> > > >statement - echo ''; is resulting in this error -
The
> > > >requested URL /id=$id was not found on this server. Any
suggestions?
> > > >Thanks,
> > > >Chip
> > > >
> > > >"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005
09:45:39
> >AM:
> > > >
> > > > > the best way to do this is to move the image processing code to
a
> > > >separate
> > > > > page and include it like this
> > > > >
> > > > > echo '';
> > > > >
> > > > > then the image page looks like this:
> > > > >  > > > >
> > > > > if($_GET['id']) {
> > > > > $id = $_GET['id'];
> > > > > // you may have to modify login information for your database
> >server:
> > > > > @MYSQL_CONNECT("localhost","root","password");
> > > > >
> > > > > @mysql_select_db("binary_data");
> > > > >
> > > > > $query = "select bin_data,filetype from binary_data where
id=$id";
> > > > > $result = @MYSQL_QUERY($query);
> > > > >
> > > > > $data = @MYSQL_RESULT($result,0,"bin_data");
> > > > > $type = @MYSQL_RESULT($result,0,"filetype");
> > > > >
> > > > > Header( "Content-type: $type");
> > > > > echo $data;
> > > > >
> > > > > };
> > > > > ?>
> > > > >
> > > > > bastien
> > > > >
> > > > >
> > > > >
> > > > > >From: Chip Wiegand <[EMAIL PROTECTED]>
> > > > > >To: "PHP DB" 
> > > > > >Subject: [PHP-DB] storing images in database
> > > > > >Date: Tue, 25 Jan 2005 09:11:07 -0800
> > > > > >
> > > > > >I have stored a .jpg image in a database, then when I make a
sql
> > > >statement
> > > > > >to display that image on a web page all I get is the cryptic
code
> >in
> > > >place
> > > > > >of the image. I am storing it in a row configured as a blob,
mime
> >type
> > > > > >image/jpeg and binary (using phpMyAdmin). What am I doing
wrong?
> > > > > >Regards,
> > > > > >Chip
> > > > > >
> > > > > >--
> > > > > >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] IIS, PHP, and session data

2005-01-25 Thread Martin Norland
Perry, Matthew (Fire Marshal's Office) wrote:
I am having trouble with my session data on Microsoft IIS.
[snip]
2)   I have Apache running on a local web server in our office (not the
IT department).  It accesses the SQL Server database remotely.  I have
register_global turned OFF and use the following code on each page: 

session_start();
session_register('logged_in');
session_register('username');
etc...
Everything works PERFECTLY on my local system.
3)   I have ported all of my code to the IIS server location.  It
accesses the database correctly but displays an error message when I try to
use the session data.  It does NOT post messages that the session could not
be started (which is the normal sign of session data not being allowed).
The message says the variable does not exist.  It is as if the session is
started but the variables aren't being saved.
unless there is something I'm missing, register_globals isn't off on 
your development machine, otherwise that code isn't going to work.  If 
there is additional code - e.g., you assigning those values something, 
then maybe I'm wrong.

It sure looks like your problem *is* register_globals being off, and 
that it's actually on in your testbed and you're mistaken.

Someone with more IIS experience - please feel free to chime in.  It 
could just be some horrible common problem.

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

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


RE: [PHP-DB] storing images in database

2005-01-25 Thread Chip Wiegand
"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 12:46:12 PM:

> yes goes back to the whole header problem which is why you are here.
> 
> If you could post the code, it would be simpler to help you...
> 
> Bastien

This is in the main page -
%s", $row["text"]);
?>
and this is in a new included page -

The database connection statements are in an include file called at the 
top of the main page. In the first statement shown above the alt text for 
the image appears on the web page just fine, the image itself shows a 
broken image icon. FWIW, I have the image stored in the database in a blob 
field, is that correct?
--
Chip

> >From: Chip Wiegand <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: RE: [PHP-DB] storing images in database
> >Date: Tue, 25 Jan 2005 12:44:44 -0800
> >
> >"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 12:39:15 
PM:
> >
> > > Its not src='id=$id'> that will defnintely blow up
> > >
> > > echo '';
> > >
> > > where $id is the id of the record you are trying to get the image 
to...
> > >
> > > Bastien
> >
> >So the code has to be a seperate included page I guess?
> >--
> >Chip
> >
> > > >From: Chip Wiegand <[EMAIL PROTECTED]>
> > > >To: [EMAIL PROTECTED]
> > > >CC: php-db@lists.php.net
> > > >Subject: RE: [PHP-DB] storing images in database
> > > >Date: Tue, 25 Jan 2005 12:37:15 -0800
> > > >
> > > >Thanks Bastien,
> > > >In testing this I have added the code samples to a page and have it
> > > >working except the path statement is not correct. For now, I've 
just
> >added
> > > >all the code to one page, rather than including a second page. The
> > > >statement - echo ''; is resulting in this error - 
The
> > > >requested URL /id=$id was not found on this server. Any 
suggestions?
> > > >Thanks,
> > > >Chip
> > > >
> > > >"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 
09:45:39
> >AM:
> > > >
> > > > > the best way to do this is to move the image processing code to 
a
> > > >separate
> > > > > page and include it like this
> > > > >
> > > > > echo '';
> > > > >
> > > > > then the image page looks like this:
> > > > >  > > > >
> > > > > if($_GET['id']) {
> > > > > $id = $_GET['id'];
> > > > > // you may have to modify login information for your database
> >server:
> > > > > @MYSQL_CONNECT("localhost","root","password");
> > > > >
> > > > > @mysql_select_db("binary_data");
> > > > >
> > > > > $query = "select bin_data,filetype from binary_data where 
id=$id";
> > > > > $result = @MYSQL_QUERY($query);
> > > > >
> > > > > $data = @MYSQL_RESULT($result,0,"bin_data");
> > > > > $type = @MYSQL_RESULT($result,0,"filetype");
> > > > >
> > > > > Header( "Content-type: $type");
> > > > > echo $data;
> > > > >
> > > > > };
> > > > > ?>
> > > > >
> > > > > bastien
> > > > >
> > > > >
> > > > >
> > > > > >From: Chip Wiegand <[EMAIL PROTECTED]>
> > > > > >To: "PHP DB" 
> > > > > >Subject: [PHP-DB] storing images in database
> > > > > >Date: Tue, 25 Jan 2005 09:11:07 -0800
> > > > > >
> > > > > >I have stored a .jpg image in a database, then when I make a 
sql
> > > >statement
> > > > > >to display that image on a web page all I get is the cryptic 
code
> >in
> > > >place
> > > > > >of the image. I am storing it in a row configured as a blob, 
mime
> >type
> > > > > >image/jpeg and binary (using phpMyAdmin). What am I doing 
wrong?
> > > > > >Regards,
> > > > > >Chip
> > > > > >
> > > > > >--
> > > > > >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] IIS, PHP, and session data

2005-01-25 Thread John Holmes
Perry, Matthew (Fire Marshal's Office) wrote:
2)   I have Apache running on a local web server in our office (not the
IT department).  It accesses the SQL Server database remotely.  I have
register_global turned OFF and use the following code on each page: 

session_start();
session_register('logged_in');
session_register('username');
Are you using an old version of PHP? Don't use session_register(). Use 
session_start() and then reference everything with the $_SESSION array. 
In your code above, $logged_in and $username will not exist with 
register_globals off. That may be leading to the errors you see later.

The question I have is:
What concerns should I have with PHP sessions when I move from Apache to
IIS?
None if sessions are set up correctly on each machine and you're using 
the same version of PHP at the same error reporting level.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The 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] storing images in database

2005-01-25 Thread Martin Norland
Bastien Koert wrote:
Its not src='id=$id'> that will defnintely blow up
echo '';
where $id is the id of the record you are trying to get the image to...
Bastien
From: Chip Wiegand <[EMAIL PROTECTED]>
[snip]
In testing this I have added the code samples to a page and have it
working except the path statement is not correct. For now, I've just 
added
all the code to one page, rather than including a second page. The
statement - echo ''; is resulting in this error - The
requested URL /id=$id was not found on this server. Any suggestions?

  echo '$wont $output $variables $values $because $of $single $quotes!';
  // echo '';
  // echo '';
}
shed_light();
?>
Cheers,
--
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


[PHP-DB] works on command line, not on server

2005-01-25 Thread [EMAIL PROTECTED]
I have a new installation of php on an existing apache 2 server, and
something strange is happening.  The file 'test.php' works and connects to
the database when run through the command line, but when run from the web
server (http://server/test.php) produces a segmentation fault:

"child pid 29056 exit signal Segmentation fault"

php itself does work, and a file with only phpinfo() in it runs fine on both
the server and the command line.  Has anyone seen anything like this before?
Any ideas?




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



RE: [PHP-DB] storing images in database

2005-01-25 Thread Chip Wiegand
I have done it an easier way, and probably a better way all-around anyway. 
I am storing the images in a directory and have the script call the 
file/alt text/title text and a description text in a paragraph below the 
image. It works quite well this way.
What I'm doing is on this home page there is a place for a 'hotspot', a 
special mention area for the latest news about a particular item. So I 
have a directory and in it will store an image file called 'latest.gif', 
so any new image that gets put here will overwrite the existing image. 
This will be fine for the purposes and the site.
Here is the code I have used -
%s", $row["alt-text"], 
$row["title-text"], $row["desc-text"]); 
   } 
?>
I'm sure there are many ways to do this sort of thing, but this is quick 
and easy, and works.
Thanks guys,
--
Chip
"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 01:06:01 PM:

> And how are you feeding the $id?are you setting a value for that 
> element?
> 
> In the sample code the default is the record_id that corresponds back to 
the 
> id of the row with the image blob field.
> 
> Bastien
> 
> 
> 
> 
> >From: Chip Wiegand <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >CC: "PHP DB" 
> >Subject: RE: [PHP-DB] storing images in database
> >Date: Tue, 25 Jan 2005 12:57:40 -0800
> >
> >"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 12:46:12 
PM:
> >
> > > yes goes back to the whole header problem which is why you are here.
> > >
> > > If you could post the code, it would be simpler to help you...
> > >
> > > Bastien
> >
> >This is in the main page -
> > >printf(" >images\">%s", $row["text"]);
> >?>
> >and this is in a new included page -
> > >if($_GET['id']) {
> >$id = $_GET['id'];
> >$query = "select * from hotspots where id=$id";
> >$result = @MYSQL_QUERY($query);
> >
> >$data = @MYSQL_RESULT($result,0,"image");
> >$type = @MYSQL_RESULT($result,0,"type");
> >
> >Header( "Content-type: $type");
> >echo $data;
> >};
> >?>
> >The database connection statements are in an include file called at the
> >top of the main page. In the first statement shown above the alt text 
for
> >the image appears on the web page just fine, the image itself shows a
> >broken image icon. FWIW, I have the image stored in the database in a 
blob
> >field, is that correct?
> >--
> >Chip
> >
> > > >From: Chip Wiegand <[EMAIL PROTECTED]>
> > > >To: [EMAIL PROTECTED]
> > > >Subject: RE: [PHP-DB] storing images in database
> > > >Date: Tue, 25 Jan 2005 12:44:44 -0800
> > > >
> > > >"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 
12:39:15
> >PM:
> > > >
> > > > > Its not src='id=$id'> that will defnintely blow up
> > > > >
> > > > > echo '';
> > > > >
> > > > > where $id is the id of the record you are trying to get the 
image
> >to...
> > > > >
> > > > > Bastien
> > > >
> > > >So the code has to be a seperate included page I guess?
> > > >--
> > > >Chip
> > > >
> > > > > >From: Chip Wiegand <[EMAIL PROTECTED]>
> > > > > >To: [EMAIL PROTECTED]
> > > > > >CC: php-db@lists.php.net
> > > > > >Subject: RE: [PHP-DB] storing images in database
> > > > > >Date: Tue, 25 Jan 2005 12:37:15 -0800
> > > > > >
> > > > > >Thanks Bastien,
> > > > > >In testing this I have added the code samples to a page and 
have it
> > > > > >working except the path statement is not correct. For now, I've
> >just
> > > >added
> > > > > >all the code to one page, rather than including a second page. 
The
> > > > > >statement - echo ''; is resulting in this 
error -
> >The
> > > > > >requested URL /id=$id was not found on this server. Any
> >suggestions?
> > > > > >Thanks,
> > > > > >Chip
> > > > > >
> > > > > >"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005
> >09:45:39
> > > >AM:
> > > > > >
> > > > > > > the best way to do this is to move the image processing code 
to
> >a
> > > > > >separate
> > > > > > > page and include it like this
> > > > > > >
> > > > > > > echo '';
> > > > > > >
> > > > > > > then the image page looks like this:
> > > > > > >  > > > > > >
> > > > > > > if($_GET['id']) {
> > > > > > > $id = $_GET['id'];
> > > > > > > // you may have to modify login information for your 
database
> > > >server:
> > > > > > > @MYSQL_CONNECT("localhost","root","password");
> > > > > > >
> > > > > > > @mysql_select_db("binary_data");
> > > > > > >
> > > > > > > $query = "select bin_data,filetype from binary_data where
> >id=$id";
> > > > > > > $result = @MYSQL_QUERY($query);
> > > > > > >
> > > > > > > $data = @MYSQL_RESULT($result,0,"bin_data");
> > > > > > > $type = @MYSQL_RESULT($result,0,"filetype");
> > > > > > >
> > > > > > > Header( "Content-type: $type");
> > > > > > > echo $data;
> > > > > > >
> > > > > > > };
> > > > > > > ?>
> > > > > > >
> > > > > > > bastien
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > >From: Chip Wiegand <[EMAIL PROTECTED]>
> > > > > > > >To: "PHP DB" 
> > > > > > > >Subject: [PHP-DB] storing images in database
> > > > > > > >Date: Tue, 25 Jan 2005 09:11:07 -0800
> > > > > > > >
> > > > > > > >

Re: [PHP-DB] IIS, PHP, and session data

2005-01-25 Thread Simon Rees
On Tuesday 25 January 2005 20:20, Perry, Matthew (Fire Marshal's Office) 
wrote:
> I am having trouble with my session data on Microsoft IIS.
>
> Here is a little background of the problem:
>
> 1)   I am not personally in control of our web server.  Our IT
> department manages it.  

oh dear! ;-) 

> They have IIS running on their sever and use MS 
> SQL Server, but they have allowed me to use PHP instead of ASP.
>
> 2)   I have Apache running on a local web server in our office (not
> the IT department).  It accesses the SQL Server database remotely.  I

I can't comment on the use of register_globals or session_register as I 
always use the $_SESSION array but I do use PHP on IIS...
Something that you might like to check is that the directory specified by:

session.save_path

in the IIS server's php.ini is a directory writable by the user that IIS 
masquerades. The default value for this is:

c:\php\sessiondata

which if your sysadmin installed php as Administrator will not be writable 
by the IIS user (normally IUSR_).

Either get the sysadmin to specify (& create) another dir that is writable 
by IIS or change the permissions on c:\php\sessiondata

Assuming you're running Apache on a Linux (and probably other un*x) 
distribution you will find that the session.save_path variable is set 
to /tmp which is usually world writable.

I think if you posted the exact error message it would tell me if this was 
happening to you or not...

hth, Simon

-- 
~~
Simon Rees Â| [EMAIL PROTECTED] Â|
ORA-03113: end-of-file on communication channel
~~

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



RE: [PHP-DB] storing images in database

2005-01-25 Thread Bastien Koert
Filesystem is easier, by far since it avoids the content header. Glad you 
solved it

bastien
From: Chip Wiegand <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
CC: "PHP DB" 
Subject: RE: [PHP-DB] storing images in database
Date: Tue, 25 Jan 2005 14:32:11 -0800
I have done it an easier way, and probably a better way all-around anyway.
I am storing the images in a directory and have the script call the
file/alt text/title text and a description text in a paragraph below the
image. It works quite well this way.
What I'm doing is on this home page there is a place for a 'hotspot', a
special mention area for the latest news about a particular item. So I
have a directory and in it will store an image file called 'latest.gif',
so any new image that gets put here will overwrite the existing image.
This will be fine for the purposes and the site.
Here is the code I have used -
%s", $row["alt-text"],
$row["title-text"], $row["desc-text"]);
   }
?>
I'm sure there are many ways to do this sort of thing, but this is quick
and easy, and works.
Thanks guys,
--
Chip
"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 01:06:01 PM:
> And how are you feeding the $id?are you setting a value for that
> element?
>
> In the sample code the default is the record_id that corresponds back to
the
> id of the row with the image blob field.
>
> Bastien
>
>
>
>
> >From: Chip Wiegand <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >CC: "PHP DB" 
> >Subject: RE: [PHP-DB] storing images in database
> >Date: Tue, 25 Jan 2005 12:57:40 -0800
> >
> >"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 12:46:12
PM:
> >
> > > yes goes back to the whole header problem which is why you are here.
> > >
> > > If you could post the code, it would be simpler to help you...
> > >
> > > Bastien
> >
> >This is in the main page -
> > >printf(" >images\">%s", $row["text"]);
> >?>
> >and this is in a new included page -
> > >if($_GET['id']) {
> >$id = $_GET['id'];
> >$query = "select * from hotspots where id=$id";
> >$result = @MYSQL_QUERY($query);
> >
> >$data = @MYSQL_RESULT($result,0,"image");
> >$type = @MYSQL_RESULT($result,0,"type");
> >
> >Header( "Content-type: $type");
> >echo $data;
> >};
> >?>
> >The database connection statements are in an include file called at the
> >top of the main page. In the first statement shown above the alt text
for
> >the image appears on the web page just fine, the image itself shows a
> >broken image icon. FWIW, I have the image stored in the database in a
blob
> >field, is that correct?
> >--
> >Chip
> >
> > > >From: Chip Wiegand <[EMAIL PROTECTED]>
> > > >To: [EMAIL PROTECTED]
> > > >Subject: RE: [PHP-DB] storing images in database
> > > >Date: Tue, 25 Jan 2005 12:44:44 -0800
> > > >
> > > >"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005
12:39:15
> >PM:
> > > >
> > > > > Its not src='id=$id'> that will defnintely blow up
> > > > >
> > > > > echo '';
> > > > >
> > > > > where $id is the id of the record you are trying to get the
image
> >to...
> > > > >
> > > > > Bastien
> > > >
> > > >So the code has to be a seperate included page I guess?
> > > >--
> > > >Chip
> > > >
> > > > > >From: Chip Wiegand <[EMAIL PROTECTED]>
> > > > > >To: [EMAIL PROTECTED]
> > > > > >CC: php-db@lists.php.net
> > > > > >Subject: RE: [PHP-DB] storing images in database
> > > > > >Date: Tue, 25 Jan 2005 12:37:15 -0800
> > > > > >
> > > > > >Thanks Bastien,
> > > > > >In testing this I have added the code samples to a page and
have it
> > > > > >working except the path statement is not correct. For now, I've
> >just
> > > >added
> > > > > >all the code to one page, rather than including a second page.
The
> > > > > >statement - echo ''; is resulting in this
error -
> >The
> > > > > >requested URL /id=$id was not found on this server. Any
> >suggestions?
> > > > > >Thanks,
> > > > > >Chip
> > > > > >
> > > > > >"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005
> >09:45:39
> > > >AM:
> > > > > >
> > > > > > > the best way to do this is to move the image processing code
to
> >a
> > > > > >separate
> > > > > > > page and include it like this
> > > > > > >
> > > > > > > echo '';
> > > > > > >
> > > > > > > then the image page looks like this:
> > > > > > >  > > > > > >
> > > > > > > if($_GET['id']) {
> > > > > > > $id = $_GET['id'];
> > > > > > > // you may have to modify login information for your
database
> > > >server:
> > > > > > > @MYSQL_CONNECT("localhost","root","password");
> > > > > > >
> > > > > > > @mysql_select_db("binary_data");
> > > > > > >
> > > > > > > $query = "select bin_data,filetype from binary_data where
> >id=$id";
> > > > > > > $result = @MYSQL_QUERY($query);
> > > > > > >
> > > > > > > $data = @MYSQL_RESULT($result,0,"bin_data");
> > > > > > > $type = @MYSQL_RESULT($result,0,"filetype");
> > > > > > >
> > > > > > > Header( "Content-type: $type");
> > > > > > > echo $data;
> > > > > > >
> > > > > > > };
> > > > > > > ?>
> > > > > > >
> > > > > > > bastien
> > > > > > >
> > > > > > >
> > > > > > >
> 

RE: [PHP-DB] storing images in database

2005-01-25 Thread Bastien Koert
Just to polish the topic off,  below are the two files that have been tested 
on my machine (xp, apache2, php 4.3.9, mysql4.0.1x)


require("conn.php");
//check to see if the id is passed
if(isset($_GET['id'])) {
 $id=$_GET['id'];
 $query = "select bin_data, filetype from binary_data where id=$id";
 //echo $query;
 $result = connect($query);
 $row = mysql_fetch_array($result);
 {
  $data = $row['bin_data'];
  $type = $row['filetype'];
 }
 if ($type=="pjpeg") $type = "jpeg";
 Header( "Content-type: $type");
 echo $data;
}
?>

// show_desc.php
require("conn.php");
 // you may have to modify login information for your database server
 $query = "select description, id from binary_data ";
 $result = connect($query);
 while ($rows = MYSQL_FETCH_ARRAY($result))
 {
 echo $rows['description'];
 echo "";
 echo "\n";
};
?>
And I used table structure
CREATE TABLE binary_data (
id INT(4) NOT NULL AUTO_INCREMENT PRIMARY KEY,
description CHAR(50),
bin_data LONGBLOB,
filename CHAR(50),
filesize CHAR(50),
filetype CHAR(50)
);
hth
bastien
From: Chip Wiegand <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
CC: "PHP DB" 
Subject: RE: [PHP-DB] storing images in database
Date: Tue, 25 Jan 2005 12:57:40 -0800
"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 12:46:12 PM:
> yes goes back to the whole header problem which is why you are here.
>
> If you could post the code, it would be simpler to help you...
>
> Bastien
This is in the main page -
%s", $row["text"]);
?>
and this is in a new included page -

$data = @MYSQL_RESULT($result,0,"image");
$type = @MYSQL_RESULT($result,0,"type");
Header( "Content-type: $type");
echo $data;
};
?>
The database connection statements are in an include file called at the
top of the main page. In the first statement shown above the alt text for
the image appears on the web page just fine, the image itself shows a
broken image icon. FWIW, I have the image stored in the database in a blob
field, is that correct?
--
Chip
> >From: Chip Wiegand <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: RE: [PHP-DB] storing images in database
> >Date: Tue, 25 Jan 2005 12:44:44 -0800
> >
> >"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 12:39:15
PM:
> >
> > > Its not src='id=$id'> that will defnintely blow up
> > >
> > > echo '';
> > >
> > > where $id is the id of the record you are trying to get the image
to...
> > >
> > > Bastien
> >
> >So the code has to be a seperate included page I guess?
> >--
> >Chip
> >
> > > >From: Chip Wiegand <[EMAIL PROTECTED]>
> > > >To: [EMAIL PROTECTED]
> > > >CC: php-db@lists.php.net
> > > >Subject: RE: [PHP-DB] storing images in database
> > > >Date: Tue, 25 Jan 2005 12:37:15 -0800
> > > >
> > > >Thanks Bastien,
> > > >In testing this I have added the code samples to a page and have it
> > > >working except the path statement is not correct. For now, I've
just
> >added
> > > >all the code to one page, rather than including a second page. The
> > > >statement - echo ''; is resulting in this error -
The
> > > >requested URL /id=$id was not found on this server. Any
suggestions?
> > > >Thanks,
> > > >Chip
> > > >
> > > >"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005
09:45:39
> >AM:
> > > >
> > > > > the best way to do this is to move the image processing code to
a
> > > >separate
> > > > > page and include it like this
> > > > >
> > > > > echo '';
> > > > >
> > > > > then the image page looks like this:
> > > > >  > > > >
> > > > > if($_GET['id']) {
> > > > > $id = $_GET['id'];
> > > > > // you may have to modify login information for your database
> >server:
> > > > > @MYSQL_CONNECT("localhost","root","password");
> > > > >
> > > > > @mysql_select_db("binary_data");
> > > > >
> > > > > $query = "select bin_data,filetype from binary_data where
id=$id";
> > > > > $result = @MYSQL_QUERY($query);
> > > > >
> > > > > $data = @MYSQL_RESULT($result,0,"bin_data");
> > > > > $type = @MYSQL_RESULT($result,0,"filetype");
> > > > >
> > > > > Header( "Content-type: $type");
> > > > > echo $data;
> > > > >
> > > > > };
> > > > > ?>
> > > > >
> > > > > bastien
> > > > >
> > > > >
> > > > >
> > > > > >From: Chip Wiegand <[EMAIL PROTECTED]>
> > > > > >To: "PHP DB" 
> > > > > >Subject: [PHP-DB] storing images in database
> > > > > >Date: Tue, 25 Jan 2005 09:11:07 -0800
> > > > > >
> > > > > >I have stored a .jpg image in a database, then when I make a
sql
> > > >statement
> > > > > >to display that image on a web page all I get is the cryptic
code
> >in
> > > >place
> > > > > >of the image. I am storing it in a row configured as a blob,
mime
> >type
> > > > > >image/jpeg and binary (using phpMyAdmin). What am I doing
wrong?
> > > > > >Regards,
> > > > > >Chip
> > > > > >
> > > > > >--
> > > > > >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] works on command line, not on server

2005-01-25 Thread The Disguised Jedi
try users@httpd.apache.org list


On Tue, 25 Jan 2005 14:21:25 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I have a new installation of php on an existing apache 2 server, and
> something strange is happening.  The file 'test.php' works and connects to
> the database when run through the command line, but when run from the web
> server (http://server/test.php) produces a segmentation fault:
> 
> "child pid 29056 exit signal Segmentation fault"
> 
> php itself does work, and a file with only phpinfo() in it runs fine on both
> the server and the command line.  Has anyone seen anything like this before?
> Any ideas?
> 
>  $link = mysql_connect("localhost", "user", "pass")
> or die("Could not connect");
> mysql_select_db("disorder") or die("Could not select database");
> 
> print "hello";
> 
> ?>
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
The Disguised Jedi
[EMAIL PROTECTED]

PHP rocks!
"Knowledge is Power.  Power Corrupts.  Go to school, become evil"

Disclaimer: Any disclaimer attached to this message may be ignored.
This message is Certified Virus Free

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