[PHP-DB] pg_escape with copy

2008-02-25 Thread blackwater dev
I have data that I'm running through pg_escape_sting in php and then adding
to stdin for a copy command.  The problem is O'reilly is being changed to
O''Reilly in the string and then in the db.  I saw with the copy command I
can specify the escape but it isn't working for me.  Should this command fix
this double 'single' quote issue when I put it in the db?  And what is the
proper syntax?

COPY mytable FROM stdin with escape



Thanks!


[PHP-DB] australian city db -lat/lon?

2007-08-14 Thread blackwater dev
I've found a few places to get a zipped file of US cities with zips and
lat/lon for insertion into my db...does anyone know of a resource where I
can get the same thing for Australia??

Thanks!


[PHP-DB] optimizing indexes -mysql

2006-05-04 Thread blackwater dev

I just doubled the size of my MySQL db, is there a command I should run to
re-index everything or is that automatic?

Thanks!


[PHP-DB] mssql_select_db(): Unable to select database:

2006-04-08 Thread blackwater dev
Hello all,

I set up freetds on one of my servers and everything worked fine.  I just
set it up on another server (this one with the latest php) and now the same
code seems to connect but can't select the db mssql_select_db(): Unable to
select database:.  How can I figure out what's wrong?  The mssql db is
hosted remotely so both servers should be able to hit it fine and are using
the exact same source code.  The differences are they are running different
versions of php and possibly freetds.

Thanks!


[PHP-DB] connection to mysql db

2005-10-11 Thread blackwater dev
I have mysql running on a linux box at my house.  I want to connect to
that box from another machine on my home network but get access
errors.  When connecting, I use the machines internal ip and the root
name and password of the linux box but I get access denied errors. 
How can I connect?

Thanks!

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



[PHP-DB] mssql_select_db

2005-08-16 Thread blackwater dev
I have some code which connects to a remote SQL server.  The code has
worked fine for a year and now the mssql_select_db is failing.  The
code hasn't changed and I talked to the SQL Server admin who assures
me nothing has changed and I am talking to the web host who says
nothing changed...how can I debug this?

The web host is running FreeBSD with the FreeTDS library and php 4.3.9.

Is there a way to echo all of the mssql tables after I make the
connection?  I can connect fine, just can't select a db so I want to
see what databases php can see.

Thanks!

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



[PHP-DB] floats

2005-07-19 Thread blackwater dev
I am running a query on MySQL:

select * from cars where id =52

It returns the row and I can see that gas mileage is saved as a float
with a value of 23.45.  So I then do a query, select * from cars where
id=52 and gas_mil=23.45 and the query doesn't retun anything.  Why? 
Do I have to cast this as a float?

Thanks!

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



[PHP-DB] mysql load data form input file

2005-06-30 Thread blackwater dev
Does anyone know if it is possible to load data into multiple tables
using one file when you use load data local infile?  I need to load
several tables but don't want to have tons of files.

Thanks!

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



[PHP-DB] show tables

2005-06-28 Thread blackwater dev
How can I run a query to find all of the tables in a db with a certain
columname?

Thanks!

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



[PHP-DB] group by

2005-05-24 Thread blackwater dev
Hello,

Let's say I have an app used in car garages.  I have two tables:

table cars
id
make
model

table work_done
id
carid
details
work_date

I need to pull out the last work order for each car.  This pulls them all:
select c.make, c.model, c.id, wd.details from cars c join work_done wd
on wd.carid=c.id

I can do this to get one per car:
select c.make, c.model, c.id, wd.details from cars c join work_done wd
on wd.carid=c.id order by c.id

but that doesn't always pull the most recent one.  How can I group by
carid so I only get one row returned per car and ensure that row
contains the most recent work row?  I can't used subqueries as I
haven't updated to MySQL 4.1 yet.

Thanks!

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



[PHP-DB] mysql 4.1-4.0

2005-02-02 Thread blackwater dev
Why is this query handled differently in 4.1?

4.0
select lower(concat(last_name,id)) from client where prim_id=1
returns johnson1

4.1
same query returns Johnson1

Why don't the lower work in 4.1 when you concatonate with a number?

Thanks!

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



Re: [PHP-DB] mysql 4.1-4.0

2005-02-02 Thread blackwater dev
yeah, that is what I did to fix it...just curious why the problem was
there in the first place.


On Wed, 02 Feb 2005 14:40:55 -0600, Martin Norland
[EMAIL PROTECTED] wrote:
 blackwater dev wrote:
  Why is this query handled differently in 4.1?
 
  4.0
  select lower(concat(last_name,id)) from client where prim_id=1
  returns johnson1
 
  4.1
  same query returns Johnson1
 
  Why don't the lower work in 4.1 when you concatonate with a number?
 No idea.
 
 select concat(lower(last_name),id) from client where prim_id=1;
 
 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] select particular columns in query

2004-12-08 Thread blackwater dev
Hello,

I want to create a new row in the db by copying an existing one.  My
db has an auto incrementing id so I can't simply do insert into cars
select * from cars where id=$id as this throws the primary key error. 
How can I do this with out specifying each column?

Thanks!

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



[PHP-DB] returning inserted ids using load data local infile

2004-10-28 Thread blackwater dev
Is there anyway to get an array of the inserted id's generated when I
load data into mysql using an external data file???

Thanks!

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



[PHP-DB] Rand()

2004-10-07 Thread blackwater dev
I have the following query:

Select id, fname, lname from clients where featured=1 order by RAND()

At any time, there should only be three clients where featured =1. 
Problem is I have run this query several times yet it always returns
them in the same order.  Not sure it makes a difference but the
primary key is on the id column.  What am I doing wrong?


Thanks!

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



Re: [PHP-DB] Rand()

2004-10-07 Thread blackwater dev
Yeah, I had tried that earlier but it doesn't work.  It does generate
a new value for temp each time but they are still in the same order as
the first one always has a lower temp value


On Thu, 7 Oct 2004 06:40:23 -0700, Ed Lazor [EMAIL PROTECTED] wrote:
 
 
 select id, fname, lname, RAND() as temp from clients where featured=1 order
 by temp
 
  -Original Message-
  I have the following query:
 
  Select id, fname, lname from clients where featured=1 order by RAND()
 
  At any time, there should only be three clients where featured =1.
  Problem is I have run this query several times yet it always returns
  them in the same order.  Not sure it makes a difference but the
  primary key is on the id column.  What am I doing wrong?
 
 
  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
 


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