Re: [PHP-DB] pulling images from a database

2001-05-22 Thread Gary Huntress

If you want to be efficient, store only the image metadata in the database
(path, filename, creator, date, dimentions, format, etc) in the database.
Keep the actual data as a file.


--
Regards,
Gary SuperID Huntress
===
FreeSQL.org offering free database hosting to developers
Visit http://www.freesql.org

Trent Reimer [EMAIL PROTECTED] wrote in message
9ebsd5$q0m$[EMAIL PROTECTED]">news:9ebsd5$q0m$[EMAIL PROTECTED]...
 I'm trying to find an efficient way to pull images from a database. What
I'm
 saying is that the actual image file itself is being stored as a Binary
 Large OBject in the database (MySQL) and that I want to use it on a web
 document.

 The only way I've been able to do it so far is to call an external script
 such as:

 img src=grab_image.php?image=picture1.jpg

 where grab_image.php goes and connects to the database and spits out the
 header information and then the binary data for the applicable picture.

 Is there a more efficient way to do this? Is there any way to embed the
 image information directly in the document without having to call an
 external script for each image?



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




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




Re: [PHP-DB] MySQL transactions?

2001-04-18 Thread Gary Huntress

a common question.  This might help
http://www.mysql.com/documentation/mysql/bychapter/manual_Compatibility.html
#Missing_Transactions

--
Regards,
Gary "SuperID" Huntress
===
FreeSQL.org offering free database hosting to developers
Visit http://www.freesql.org

"Bas Cancrinus" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 Is it possible to define a set of mysql function-calls as a transaction
 that commits if no error occurs and rolls back otherwise?

 Thanks in advance,
 Bas


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




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




Re: [PHP-DB] Query with Access

2001-04-01 Thread Gary Huntress

I'd try adding:

 $conn = odbc_connect("pruebas_php", "", "")
or die("cannot connect to pruebas_php");

 $resultado1 = odbc_exec($conn,"SELECT Nombre, Apellido1, Apellido2 FROM
Personas")
or die ("cannot execute query");

--
Regards,

Gary "SuperID" Huntress

===
FreeSQL.org offering free database hosting to developers
Visit http://superid.dyndns.org:8080/freesql/index.php


""Fernando Buitrago"" [EMAIL PROTECTED] wrote in message
9a6l42$e5r$[EMAIL PROTECTED]">news:9a6l42$e5r$[EMAIL PROTECTED]...
 Well, this is my code, but it dosen't work, please, help me, this table
has
 5 records, and the result of the query is -1.

 Code

 html
 head
 titleLista Datos/title
 meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
 /head

 body bgcolor="#FF" text="#00"
 ?
 $conn = odbc_connect("pruebas_php", "", "");
 $resultado1 = odbc_exec($conn,"SELECT Nombre, Apellido1, Apellido2 FROM
 Personas");
 echo odbc_num_rows($resultado1);
 $cantidad_articulos = 0;
 for

($cantidad_articulos=1;$cantidad_articulos=odbc_num_rows($resultado1);$cant
 idad_articulos++) {
 echo odbc_result($resultado1,2);
 echo odbc_result($resultado1,3);
 echo odbc_result($resultado1,4);
 }
 ?

 /body
 /html

 Regards



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




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




Re: [PHP-DB] select data from a drop down box in a form

2001-04-01 Thread Gary Huntress

There are probably a million ways to do this... here is one  :)
(note that the file should be named "fieldtest.php"

--
Regards,

Gary "SuperID" Huntress

===
FreeSQL.org offering free database hosting to developers
Visit http://superid.dyndns.org:8080/freesql/index.php



html
body
script language=javascript
 function copyfield()
 { var ind;
  ind=document.myform.myfield.selectedIndex;
  window.navigate("formtest.php?otherfield="
+document.myform.myfield[ind].text);
 }

/script
form name=myform
select name=myfield onchange=copyfield();
?
 $db = mysql_connect("localhost",$username,$password);
 $rs=mysql_db_query( $databasename, "select myfield from mytable");
  while($row=mysql_fetch_array($rs))
 {
  echo "option$row[0]/option";
 }

?
p
input type=text name=otherfield value="? echo "$otherfield";?"
/form
/body
/html






""Petra"" [EMAIL PROTECTED] wrote in message
9a8qou$bp3$[EMAIL PROTECTED]">news:9a8qou$bp3$[EMAIL PROTECTED]...
 I like to select data out of a drop down box in my form field from a mysql
 database. While I do that I also like that it reloads the page and put the
 relevant products of that drop down box in another field.
 Ex:
 Category 1
 Category 2
 Category 3
 are in the drop down box
 and when I choose
 Category 1
 I like to display another field which displays me all the products which
are
 in that categorie. I know it can be down just not to sure how?



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




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




Re: [PHP-DB] Yet more strings

2001-03-21 Thread Gary Huntress

When I have exact string matches fail where I don't expect them, and using a
LIKE fixes it, the very first thing I check for is embedded whitespace in
the data.  "foo " and "foo" and " foo " are not the same.

If this is the case then IMHO the best solution is to fix the data in the
database, but barring that you can probably use the TRIM() function in your
where clause.  (note:  the MySQL docs show using trim in the output, not in
the where clause so I won't swear that its possible, but it should be)

Regards,

Gary

""Mick Lloyd"" [EMAIL PROTECTED] wrote in message
00c001c0b1ea$54a5f5c0$5c0083ca@oemcomputer">news:00c001c0b1ea$54a5f5c0$5c0083ca@oemcomputer...
 CC's suggestion of using mysql_num_rows helped to clarify the problem
rather
 than find a solution! The problem is with mysql not PHP. When I use:

 $resultp = mysql_query("select Primaryid from primarycodes where Code =
 '".$row[Primaryexpertise]."'") or die (mysql_error());

 it doesn't return a resource id#, ie the query fails. mysql_num_rows
returns
 0.

 Using:

 $resultp = mysql_query("select Primaryid from primarycodes where Code LIKE
 '%$row[Primaryexpertise]%'") or die (mysql_error());

 it works, mysql_num_rows returns 1.

 I have also checked the string length of $row[Primaryexpertise] (the value
 of which is Biology for example) and it shows that there are no "hidden"
 characters in the field value (ie strlen returns 7).

 Running all this at the mysql shell (is that the word?) results in the
same
 errors.

 The row values are Primaryid (8) and Code (Biology).

 mysqlselect Primaryid,Code from primarycodes where Code like '%Biology%';
 \\returns the correct values

 mysqlselect Primaryid,Code from primarycodes where Primaryid = 8;
\\returns
 the correct values

 mysqlselect Primaryid,Code from primarycodes where Code = 'Biology';
 \\returns Empty set

 I'm no expert (obviously) but something seems odd here.
 Regards

 Mick Lloyd
 [EMAIL PROTECTED]
 Tel: +44 (0)1684 560224


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




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




Re: [PHP-DB] problems configuring php and postgres - FIXED

2001-03-20 Thread Gary Huntress

My thanks to everyone who provided me info and other hints/tips.

The vast majority of the problem was human error of course, sprinkling in a
few bad assumptions and some configuration problems...its amazing I got it
working at allbut it is :)

Thanks again to everyone.

Gary
"Rasmus Lerdorf" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 But did you have /usr/local/pgsql/include and /usr/local/pgsql/lib
 directories with the correct files in them?

 On Tue, 20 Mar 2001, Steve Brett wrote:

--with-pgsql[=DIR]  Include PostgreSQL support.  DIR is the
PostgreSQL
base install directory, defaults to
  /usr/local/pgsql.
Set DIR to shared to build as a dl, or
shared,DIR
to build as a dl and still specify DIR.
 
  this did not work when i compiled.
 
  pointing at the source did.
 
  i tried pointing php at both dirs to no avail.
 
 

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




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




[PHP-DB] Free MySQL Database Hosting (beta! beta! beta!)

2001-03-19 Thread Gary Huntress

Hi,

I'm testing out the concept of offering free MySQL database hosting.
Feel free to create a database at
http://superid.dyndns.org:8080/freesql/index.php

There's no catch, or hidden agenda.  I thought it might be fun to try
and offer this as a service to people who might be learning MySQL (and
hopefully eventually PostgreSQL too) but arent interested in administering a
db server.


Regards,

SuperID




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




[PHP-DB] problems configuring php and postgres - call to undefined function

2001-03-19 Thread Gary Huntress

I am trying to get postgresql (pg) support for php working on my RH7 box.  I
had a working binary installation of postgres 7.03.  I thought I had read
that php4 had default support for pg, but my call to pg_connect() gave me a
"Call to undefined function" error.

So, next I tried to re ./configure and add --with-pgsql=/usr/local/pgsql.
That would not compile, bombing when it looked for "postgres.h".   I did not
have the pg source (since this was a binary installation) so I installed
that next (in /usr/src, if that matters)

I deleted my existing binary installation of pg, and ran ./configure; gmake;
gmake install with no errors, and I added an entry in /etc/ld.so.conf as
stated in the pg INSTALL.   Pg is running fine with several db and I can
remotely connect, so I think thats ok.

After finishing with the source installation of pg, I re- ./configure php,
make and get the same error looking for "postgres.h"

kludge I then manually edited the ./configure file and added the include
path to /usr/src/postgres/install/kludge  After this, I could successfully
make php, then make install.

I restarted apache, but I am still getting "Call to undefined function".

Any thoughts?   I'm pretty much out of ideas right now.

Regards,

Gary Huntress



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