Re: [PHP-DB] Displaying Password - orale...

2009-12-23 Thread Andy Shellam
Hi Karl,


 
 I did some search and found Zend Studio for MAC 5.5.
 it's $299, but thats a goal at least.

Just so you know I fully empathise with both yours and Daevid's situation - 
you'll probably find a lot of people on this list are in the same boat, as am I.

Anyway just a hint - I bought my first Mac in September and I'm never turning 
back but that's a conversation for another day.  The one thing I thought was 
missing that I couldn't match on Windows was a decent IDE - for both PHP and 
C++ (my two main freelancer languages.)

However someone on this list pointed me in the direction of what I thought was 
a Java IDE - NetBeans.  It turns out it's a damned-fine C++ and PHP editor.  It 
handles code completion of LARGE projects (4,000+ files) ten times faster than 
others - Zend Studio and Eclipse, and Komodo for instance.

Plus it's free :)

http://netbeans.org/features/php/index.html

I used Zend Studio when it was a stand-alone Java application then switched to 
PhpEd but unfortunately that's Windows only.  I've also tried Eclipse but 
couldn't get to grips with it.  However I feel NetBeans is such a stronger 
contender than any of these - straight from the word go I just got on with it.

Re: the certification - I'm looking at doing a Zend course next year for 
nothing more than to try and get PHP recognised as a professional skill - I've 
been programming in it since 2002.  I don't know of any other companies that do 
PHP qualifications, but as Zend is the PHP company anyway they probably mean 
more :P

Hope this helps you anyway.

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



Re: [PHP-DB] RE: Help for a beginner

2009-12-23 Thread Andy Shellam
 
 The default installation of Windows Vista, Windows 7 and Windows Server 2008 
 adds a line to the Windows/System32/drivers/etc/hosts which causes network 
 functions (database connect functions too, like mysql_connect) to timeout 
 when connecting to localhost.  To resolve this problem, remove the entry 
 from the hosts file:
 ::1 localhost
 
 or connect using the IP address, 127.0.0.1 or another domain name.


Just FYI, this is also the default on newer Linux versions - Ubuntu 9.10 being 
a prime example.  Connecting to localhost creates an IPv6 connection.  Some 
utilities (e.g. telnet) fall back to trying IPv4 if the v6 connection fails.

Regards,
Andy

Re: [PHP-DB] Displaying Password

2009-12-22 Thread Andy Shellam
Hi Karl,

 
 Yes you are correct. I do not store a plan text password.

Great stuff - so many systems I've seen use plain-text passwords it's little 
wonder there's so much data theft.


 If you cant read the encrypted text, you cant decrypt it right?

Wrong.  There are two-way encryption methods requiring the use of a common key, 
and an initialization vector for some protocols - see the mcrypt library which 
PHP can use (I had a play around with it quite recently.)

http://uk2.php.net/manual/en/function.mcrypt-decrypt.php

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



Re: [PHP-DB] Combing PDO with mysql_pconnect connections in one application -- will this degrade performance?

2009-12-10 Thread Andy Shellam (Mailing Lists)

 
 One thing to be careful is if you are relying on 'transactions' to handle 
 anything. Obviously the transaction has to be in the same connection just to 
 work. Despite what others have said, the PDO connection will be different to 
 the generic mysql connection as it is a separate process. Persistent 
 connections will only reuse an already open connection, you can't connect two 
 processes to the same connection. You would not know which process was 
 accessing things.

According to the documentation:

First, when connecting, the function would first try to find a (persistent) 
link that's already open with the same host, username and password. If one is 
found, an identifier for it will be returned instead of opening a new 
connection.

Therefore, providing you've configured PHP's --with-mysql and --with-pdo-mysql 
options with the same MySQL library, then as long as the host, username and 
password are the same, the same connection will be re-used for both the native 
(mysql_pconnect) connection and the PDO connection.

I'm not sure about the mysqli library, but I believe that lies beneath the 
mysql_* family of functions anyway so it shouldn't make a difference whether 
you're using libmysqlclient or mysqli.

Regards,
Andy

Re: [PHP-DB] Combing PDO with mysql_pconnect connections in one application -- will this degrade performance?

2009-12-09 Thread Andy Shellam (Mailing Lists)

 
 As long as you test it (hopefully using some sort of automated tests) you 
 should be right.
 
 Since you're using persistent connections (make sure you set pdo to do the 
 same), I don't think you're really doubling the number of connections.

Yeah, I think PDO uses the underlying mysql/pgsql functions anyway - it just 
provides a common API layer across all database types.

Therefore if you call mysql_pconnect outside of PDO, then call the same 
database server with PDO, technically it should realise the connection has 
already been made to that server and use your previous connection.

As Chris pointed out, make sure PDO will also use persistent connections.

Regards,
Andy




Re: [PHP-DB] Multiple instances of mysql_connect() in single PHP document.

2009-11-11 Thread Andy Shellam (Mailing Lists)

Hi,



If the databases are in the same mysql server, then you could qualify
the table select with the database name and simply re-use the
connection

select db_name.table_name.field from db_name.table_name [where]


No offence, but if I saw this in an application's source code, I'd run  
a mile.


The negligible overhead of simply making two connections is far better  
in my opinion than having to rewrite each query if the database name  
changed, or to point an application at a copy of the original database  
with a different name for testing.  At least with the dual-connection  
approach, you'd only have to change it once.


Of course in a full application, you'd want the two database  
connection details in a config file, so the databases could even be  
located on separate servers, and you wouldn't need to make a source  
code change to point the application to another database.


Regards,
Andy

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



Re: [PHP-DB] losing MySQL resource

2009-11-09 Thread Andy Shellam (Mailing Lists)

Hi,

I got around this by creating a database wrapper class which gets  
passed the credentials from the app's config file.  An instance of the  
class is created and saved in the session, and every query to the  
database runs through the class's Query() wrapper method which checks  
if the connection is alive and valid - if it isn't, it reconnects it  
before running the query.


Andy

On 9 November2009, at 16:46, Stan wrote:


How do I make an Object persistant for the duration of a Session?
Thanks,
Chris dmag...@gmail.com wrote in message news:4AB6B16C. 
8...@gmail.com...

Niel Archer wrote:

I'm maintaining a session.  I successfully connect to a database

($DBConnect

= mysql_connect()).  I save the connection resource in a session

variable

($_SESSION['connection'] = $DBConnect) ... to use in subsequent

queries.  It

remains valid while the user is on the current page.
print_r($_SESSION['connection']) yields 'Resource id #3', for  
instance.


User browses to a new page ... in the same session.

$_SESSION['$DBConnect']

no longer references a valid mysql resource.
print_r($_SESSION['connection']) yields '0'.

Other ordinary values saved in $_SESSION variables remain valid.

Is there something special about a mysql resource?


Not about the resource itself, no. PHP closes connections to a Db  
when a
script ends, unless the connection is persistent, so while the  
resource

IS saved, the connection to which it refers no longer exists.


No resources (whether they are persistent or not) can be stored in  
the

session.

http://www.php.net/manual/en/intro.session.php

The big pink box has more info.

--
Postgresql  php tutorials
http://www.designmagick.com/





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





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



Re: [PHP-DB] losing MySQL resource

2009-11-09 Thread Andy Shellam (Mailing Lists)

Hi Stan,

Are you saving the instance of your class in $_SESSION?

Class instances can be persisted across sessions, however resources  
(i.e. MySQL and other DB connections) cannot.  What you need to do, is  
every method in your wrapper class that uses the MySQL resource needs  
to check if it's a valid resource (is_resource() springs to mind.)


If it isn't valid, you need to re-create it (using mysql_connect).

The reason for this is that PHP isn't running between session  
requests, so it cannot maintain and monitor the database connection  
across requests.


Andy

On 9 November2009, at 21:11, Stan wrote:

I got as far as creating a class to be the wrapper ... instantiating  
an
object of that class ... saving the reference in a $_SESSION  
variable ...
but my object reference seems to be invalid upon the next request  
(in the

same session) from the client browser.  What have I missed?

Thanks,
Stan

Andy Shellam (Mailing Lists) andy-li...@networkmail.eu wrote in
message news:fd8200b0-e18a-4afd-8ffc-f51080621...@networkmail.eu...

Hi,

I got around this by creating a database wrapper class which gets
passed the credentials from the app's config file.  An instance of  
the

class is created and saved in the session, and every query to the
database runs through the class's Query() wrapper method which checks
if the connection is alive and valid - if it isn't, it reconnects it
before running the query.

Andy

On 9 November2009, at 16:46, Stan wrote:


How do I make an Object persistant for the duration of a Session?
Thanks,
Chris dmag...@gmail.com wrote in message news:4AB6B16C.
8...@gmail.com...

Niel Archer wrote:

I'm maintaining a session.  I successfully connect to a database

($DBConnect

= mysql_connect()).  I save the connection resource in a session

variable

($_SESSION['connection'] = $DBConnect) ... to use in subsequent

queries.  It

remains valid while the user is on the current page.
print_r($_SESSION['connection']) yields 'Resource id #3', for
instance.

User browses to a new page ... in the same session.

$_SESSION['$DBConnect']

no longer references a valid mysql resource.
print_r($_SESSION['connection']) yields '0'.

Other ordinary values saved in $_SESSION variables remain  
valid.


Is there something special about a mysql resource?


Not about the resource itself, no. PHP closes connections to a Db
when a
script ends, unless the connection is persistent, so while the
resource
IS saved, the connection to which it refers no longer exists.


No resources (whether they are persistent or not) can be stored in
the
session.

http://www.php.net/manual/en/intro.session.php

The big pink box has more info.

--
Postgresql  php tutorials
http://www.designmagick.com/





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








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





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



Re: [PHP-DB] Very old question: Mysql and old authentication

2009-10-29 Thread Andy Shellam (Mailing Lists)
The mysqlnd driver doesn't support MySQL 4.1 or earlier - it looks  
like the server that you think is 5.0.45 is actually a lot older, or  
your user account on MySQL has been set up using the old  
authentication method.


The solution would be to re-compile PHP 5.3 with the original MySQL  
client library (libmysql) instead of the newer mysqlnd.


Andy


On 29 October2009, at 20:05, SuNcO wrote:


Recently we update our Local Server to this:

Apache Version : 2.2.11
PHP Version : 5.3.0
MySQL Version : 5.1.36

All works fine locally, but when we want to connect to a Remote  
Mysql Server 5.0.45 just can't, we got the mysqlnd cannot connect  
to MySQL 4.1+ using old authentication msg


The solution as i see is to use the OLD_PASSWORD trick, but in this  
case we can't do that because the Server is a Shared server and yada  
yada yada.. change some in the Remote Mysql Server is not an option


I think Php must provide a solution for this but we can't found it

We use SqlYog 6.05 to connect to Mysql Server's. Why it works with  
NEW and OLD algorithm and Php don't ?


Any help on this please ?



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



Re: [PHP-DB] Very old question: Mysql and old authentication

2009-10-29 Thread Andy Shellam (Mailing Lists)




-Remote Server
old_passwords ON
version 5.0.45


That's probably why - as I said in my previous e-mail, the mysqlng  
driver doesn't support the old authentication mechanism.  If you  
cannot change the remote server, you need to re-compile PHP with the  
MySQL client library (libmysql) instead of the PHP 5.3 native driver  
(mysqlng.)





Re: [PHP-DB] DB interface problem

2009-10-27 Thread Andy Shellam (Mailing Lists)

Hi Giff,

I want to have a look at this for you, but you'll need to put the file  
on your server as plain-text because your server is parsing the PHP  
code and only sending us the output, not the source code.


Append *.txt to your file on the server and we should be able to see  
it better!


Andy

On 27 October2009, at 12:48, Giff Hammar wrote:

I started having trouble with a DBI interface to my PostgreSQL  
database
after I built a new Ubuntu machine. The Postgres version is 8.3 and  
the

DBI was written several years ago (by someone else). I'm using PHP
version 5.2.6-3ubuntu4.2 with apache2. The problem is that I get the
error:

Warning: pg_num_rows(): supplied argument is not a valid PostgreSQL
result resource in /var/www/lib/dbi_pgsql.php on line 202

I don't know what to check next to figure out why this is happening.
Here is what I have done so far:

- Updated the old PHP commands in the dbi file to reflect new ones
   var - public
   pg_numrows - pg_num_rows
   pg_cmdtuples - pg_affected_rows
   pg_exec - pg_execute
- Connected to the database as the same user by using straight PHP  
calls

 vs the DBI. It worked fine.
- Connected to the database via psql and that worked fine, too.

There is something with the DBI class that is not right, but I am a
novice with objects and classes, so I can't pin it down. The whole  
file

is here: http://www.sv-phoenix.com/dbi_pgsql.php - it's 205 lines so I
didn't want to put the whole thing in this post.

If anyone can take a look at it and let me know what to check next, I
would really appreciate it.

Giff


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





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



Re: [PHP-DB] DB interface problem

2009-10-27 Thread Andy Shellam (Mailing Lists)

Hi Giff,

No worries - I know the feeling well!

At first glance this looks OK, however I notice that there is no res  
property defined in the STH class, like there is session and query.


$this-res on line 202 is what's causing the issue - PHP is saying  
it's not a valid PostgreSQL result resource, so if you trace back to  
where that comes from, you get to line 175:


$this-res = @pg_execute($this-session, $query);

PHP is therefore trying to assign a query result to a property that  
doesn't exist.  I would have expected PHP to throw an error at this  
but it may have been obscured with your logging settings, I'm not sure.


Try adding public $res; after line 85 and see what you get.  You  
could also add var_dump($this-res); between lines 175 and 176 which  
should tell you what PHP thinks $this-res is.


And lastly, you could get a back-trace of the rows() method call to  
see if it's being called before $this-res has been assigned - just  
add the line var_dump(debug_backtrace()); between lines 201 and 202.


Hope this gives you a starting pointer!

Regards,
Andy

On 27 October2009, at 19:36, Giff Hammar wrote:


Andy,

Sometimes I'm too fast for my own good. I added .txt to the file and  
it

should be visible as http://www.sv-phoenix.com/dbi_pgsql.txt. Just
appending the .txt didn't work.

Thanks for taking a look!

Giff

On Tue, 2009-10-27 at 17:49 +, Andy Shellam (Mailing Lists) wrote:

Hi Giff,

I want to have a look at this for you, but you'll need to put the  
file

on your server as plain-text because your server is parsing the PHP
code and only sending us the output, not the source code.

Append *.txt to your file on the server and we should be able to see
it better!

Andy

On 27 October2009, at 12:48, Giff Hammar wrote:


I started having trouble with a DBI interface to my PostgreSQL
database
after I built a new Ubuntu machine. The Postgres version is 8.3 and
the
DBI was written several years ago (by someone else). I'm using PHP
version 5.2.6-3ubuntu4.2 with apache2. The problem is that I get the
error:

Warning: pg_num_rows(): supplied argument is not a valid PostgreSQL
result resource in /var/www/lib/dbi_pgsql.php on line 202

I don't know what to check next to figure out why this is happening.
Here is what I have done so far:

- Updated the old PHP commands in the dbi file to reflect new ones
  var - public
  pg_numrows - pg_num_rows
  pg_cmdtuples - pg_affected_rows
  pg_exec - pg_execute
- Connected to the database as the same user by using straight PHP
calls
vs the DBI. It worked fine.
- Connected to the database via psql and that worked fine, too.

There is something with the DBI class that is not right, but I am a
novice with objects and classes, so I can't pin it down. The whole
file
is here: http://www.sv-phoenix.com/dbi_pgsql.php - it's 205 lines  
so I

didn't want to put the whole thing in this post.

If anyone can take a look at it and let me know what to check  
next, I

would really appreciate it.

Giff


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








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





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



Re: [PHP-DB] DB interface problem

2009-10-27 Thread Andy Shellam (Mailing Lists)

Hi Chris,



$this-res = @pg_execute($this-session, $query);
PHP is therefore trying to assign a query result to a property that  
doesn't exist.  I would have expected PHP to throw an error at this  
but it may have been obscured with your logging settings, I'm not  
sure.


Close - the '@' before pg_execute is hiding the notice/warning.

I'd say check your database username/password are correct.


Yeah I noticed that, but the line below it does a check to see if the  
pg_execute command succeeded, and if it didn't it kills the script,  
but that's not happening - it's getting further down the line, which  
is why I think $this-res is not being persisted across method calls.


Andy

Re: [PHP-DB] DB interface problem

2009-10-27 Thread Andy Shellam (Mailing Lists)

Hi Giff,

Glad you got it sorted!

pg_exec() is the old (and deprecated) name for pg_query - this behaves  
differently to pg_execute.


pg_execute runs a SQL statement that has previously been prepared with  
a call to pg_prepare, while pg_query runs a SQL query directly.


http://www.php.net/manual/en/function.pg-prepare.php
http://www.php.net/manual/en/function.pg-query.php

After a quick glance through your code, I think pg_query is what you  
want.


HTH,

Andy

On 27 October2009, at 22:06, Giff Hammar wrote:


Andy,

Thanks for your help! The var_dump after the pg_execute showed that  
the

execute() method wasn't being called (I left a line out of the calling
script). Once I fixed that, I changed pg_execute back to pg_exec and  
it

worked as expected. Now I have to figure out the difference between
pg_exec and pg_execute... From what I can tell, pg_exec isn't  
supported

any more and I should be using pg_execute instead... Thanks again.

Giff

On Tue, 2009-10-27 at 19:51 +, Andy Shellam (Mailing Lists) wrote:

Hi Giff,

No worries - I know the feeling well!

At first glance this looks OK, however I notice that there is no  
res

property defined in the STH class, like there is session and query.

$this-res on line 202 is what's causing the issue - PHP is saying
it's not a valid PostgreSQL result resource, so if you trace back to
where that comes from, you get to line 175:

$this-res = @pg_execute($this-session, $query);

PHP is therefore trying to assign a query result to a property that
doesn't exist.  I would have expected PHP to throw an error at this
but it may have been obscured with your logging settings, I'm not  
sure.


Try adding public $res; after line 85 and see what you get.  You
could also add var_dump($this-res); between lines 175 and 176  
which

should tell you what PHP thinks $this-res is.

And lastly, you could get a back-trace of the rows() method call to
see if it's being called before $this-res has been assigned - just
add the line var_dump(debug_backtrace()); between lines 201 and  
202.


Hope this gives you a starting pointer!

Regards,
Andy

On 27 October2009, at 19:36, Giff Hammar wrote:


Andy,

Sometimes I'm too fast for my own good. I added .txt to the file and
it
should be visible as http://www.sv-phoenix.com/dbi_pgsql.txt. Just
appending the .txt didn't work.

Thanks for taking a look!

Giff

On Tue, 2009-10-27 at 17:49 +, Andy Shellam (Mailing Lists)  
wrote:

Hi Giff,

I want to have a look at this for you, but you'll need to put the
file
on your server as plain-text because your server is parsing the PHP
code and only sending us the output, not the source code.

Append *.txt to your file on the server and we should be able to  
see

it better!

Andy

On 27 October2009, at 12:48, Giff Hammar wrote:


I started having trouble with a DBI interface to my PostgreSQL
database
after I built a new Ubuntu machine. The Postgres version is 8.3  
and

the
DBI was written several years ago (by someone else). I'm using PHP
version 5.2.6-3ubuntu4.2 with apache2. The problem is that I get  
the

error:

Warning: pg_num_rows(): supplied argument is not a valid  
PostgreSQL

result resource in /var/www/lib/dbi_pgsql.php on line 202

I don't know what to check next to figure out why this is  
happening.

Here is what I have done so far:

- Updated the old PHP commands in the dbi file to reflect new ones
 var - public
 pg_numrows - pg_num_rows
 pg_cmdtuples - pg_affected_rows
 pg_exec - pg_execute
- Connected to the database as the same user by using straight PHP
calls
vs the DBI. It worked fine.
- Connected to the database via psql and that worked fine, too.

There is something with the DBI class that is not right, but I  
am a

novice with objects and classes, so I can't pin it down. The whole
file
is here: http://www.sv-phoenix.com/dbi_pgsql.php - it's 205 lines
so I
didn't want to put the whole thing in this post.

If anyone can take a look at it and let me know what to check
next, I
would really appreciate it.

Giff


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





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



[PHP-DB] Parse Problem

2006-05-09 Thread Andy Rolls-Drew
All,

 

I am fairly new to parsing XML using PHP and wonder if anyone has a solution
to the following. I have a file eg:-

 

?xml version=1.0 ?

STOREITEMS

CREATED value=Wed Mar 15 8:07:27 GMT 2006

CATEGORY id='67' name='Herbal Pharmacy'

PRODUCT ITEM='603'

NAME/NAME

MODEL/MODEL

PRICE/PRICE

PRODUCT ITEM='608'

NAME/NAME

MODEL/MODEL

PRICE/PRICE

CATEGORY id='69' name='Extras'

PRODUCT ITEM='1123'

NAME/NAME

MODEL/MODEL

PRICE/PRICE

PRODUCT ITEM='2034'

NAME/NAME

MODEL/MODEL

PRICE/PRICE

 

And so on. I have managed to parse a little of it using Magic Parser but I
still cant manage to split the products and categories correctly. If there
weren't multiple products for each category I think I would have it.

 

Any help would be a start.

 

Thanks in advance

 

Andy 

 

 





ARD Drive Consultants

Drive to Perfection

 



Rolls-Drew, Andrew
Director 

ARD Drive Consultants Ltd
169 Nottingham Road
Melton Mowbray
Leicestershire
UK 


 mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
AIM: DarkoneARDDrive 


tel: 
fax: 
mobile: 
Skype ID:

+44 7092 162782
+44 7092 162782
+447929418215
andyrd 

 



 https://www.plaxo.com/add_me?u=30065438052v0=1330159k0=-1748648187 Add
me to your address book...

 http://www.plaxo.com/signature Want a signature like this?

 



[PHP-DB] Need help with a tricky query

2005-05-19 Thread Andy Green
I'm trying to write a query that pulls details on a game record, as well as
the officials assigned to the game (up to 4 officials may be assigned to
each game, but that's not always the case).

Game details are in the games table, and assignments are in the
games_referees table (which I alias as referee,ar1,ar2, and fourth).  

Ultimately, I want all the games for a given date, and the referees assigned
to them.  Below is the query I'm working with so far.  In its current state,
it returns results only when a full crew is assigned to the game (referee,
ar1,ar2, fourth).  The query is below:

SELECT g. * , concat( ref.fname,  ' ', ref.lname )  AS ref, concat(
ar1.fname,  ' ', ar1.lname )  AS ar1, concat( ar2.fname,  ' ', ar2.lname )
AS ar2, concat( fourth.fname,  ' ', fourth.lname )  AS fourth
FROM ( ( ( ( ( ( ( ( games g
RIGHT  OUTER  JOIN games_referees ref_ass ON ( g.id = ref_ass.gnum )  )
RIGHT  OUTER  JOIN people ref ON ( ref.login = ref_ass.referee )  )
RIGHT  OUTER  JOIN games_referees ar1_ass ON ( g.id = ar1_ass.gnum )  )
RIGHT  OUTER  JOIN people ar1 ON ( ar1.login = ar1_ass.referee )  )
RIGHT  OUTER  JOIN games_referees ar2_ass ON ( g.id = ar2_ass.gnum )  )
RIGHT  OUTER  JOIN people ar2 ON ( ar2.login = ar2_ass.referee )  )
RIGHT  OUTER  JOIN games_referees fourth_ass ON ( g.id = fourth_ass.gnum )
)
RIGHT  OUTER  JOIN people fourth ON ( fourth.login = fourth_ass.referee )  )
WHERE ref_ass.position =1 AND ar1_ass.position =2 AND ar2_ass.position =3
AND fourth_ass.position =4 AND g.date =  '2004-09-25'

Any help would be greatly appreciated.

Thank

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



[PHP-DB] PHP compile error: Cannot find mysql header files

2004-10-10 Thread andy
Hi all,

I'm attempting to configure PHP with apache and mysql support, but the
config fails, because it can't find the mysql header files.

I have mysql installed and working,
these are the rpms installed:
MySQL-client-4.0.21-0
MySQL-server-4.0.21-0
MySQL-shared-compat-4.0.21-0

When configuring PHP, I'm using this:
[EMAIL PROTECTED] mysql]#
./configure --with-apache=../apache_1.3.31 --with-mysql=/usr/bin/mysql

This is the Error:
configure: error: Cannot find MySQL header files under /usr/bin/mysql

When I search for mysql.h, I get this:
[EMAIL PROTECTED] local]$ locate mysql.h
/home/andy/snort/snort-2.2.0/src/win32/WIN32-Includes/mysql/mysql.h
/usr/local/src/php-4.3.9/ext/dbx/dbx_mysql.h
/usr/local/src/php-4.3.9/ext/mysql/php_mysql.h
/usr/local/src/php-4.3.9/ext/mysql/libmysql/mysql.h
/var/www/html/php_tarball/php-4.3.9/ext/dbx/dbx_mysql.h
/var/www/html/php_tarball/php-4.3.9/ext/mysql/php_mysql.h
/var/www/html/php_tarball/php-4.3.9/ext/mysql/libmysql/mysql.h

correct me if I'm wrong, but shouldn't the path be something like
/usr/bin/mysql or /usr/lib/mysql or /usr/sbin/mysql ?

I've tried all of these paths and they don't work.

anything to help is greatly appreciated.

Thanks,
HC

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



[PHP-DB] Load balancing and SQLite

2004-05-15 Thread Andy Ladouceur
Hey everyone,
Currently planning out the databases for a large project, and have 
decided to use separate SQLite database files for each users hit 
statistics. The problem is, there are two webservers, with a load 
balancer. I'm wondering what suggestions people might have on accessing 
the sqlite databases from either webserver? (As I can't write them to 
the same disk the webserver is on, without needing to copy it to the 
other webserver as well.) I _might_ have access to a third system, which 
I could use for a dedicated database server, but is NFS a viable 
solution? Would there be a noticeable performance impact when opening 
the database files remotely?

Thanks in advance for any responses,
Andy
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: passing var array

2004-04-26 Thread Andy Ladouceur
You can pass arrays via GET using the syntax:

http://localhost/index.php?val[1]=oneval[2]=2...val[key]=value

Andy

Pete M wrote:
http://localhost/index.php?val_one=oneval2=2

on index.php
print_r($_GET) will show the array
echo val l=.$_GET['val_one'];
echo val 2=.$_GET['val2'];
its CAse senSitivE

you can also do a
foreach($_GET as $k = $v)
{
echo $k.=.$v;
}
Sukanto Kho wrote:

Hi,
How to pass var array to other page?
I use $_GET but when I echo it, it appear array...

Thanx

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


[PHP-DB] login script

2004-04-26 Thread andy amol
hi,
  does anyone have a login script which will take data from the table and decide 
whether the given user is a admin or a normal user.
thanks in advance.
 
Also if there is some help on session variable I would like to know.


-
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs 

[PHP-DB] Re: stuck on stupid...can't find the bloody error...

2004-04-25 Thread Andy Ladouceur


Dan Bowkley wrote:

else {

$query_insert = INSERT INTO boards (wo_num, name, phone, email, date, board_type, last_three, weight_in, weight_out) VALUES (\'$wo_num\', \'$name\', \'$phone\', \'$email\', \'$date\', \'$board_type\', \'$last_three\', \'$weight_in\', \'$weight_out\');
No need to escape the single quotes. Not entirely sure if it's invalid 
or not, but it's unneccessary.
$result_insert = @mysql_query ($query_insert);

if ($result_insert == ) {

echo input type=\hidden\ name=\action\ value=\0\\n;

echo INPUT type=\submit\ value=\Continue\\n;

}

else {echo OOPS! Your programmer is an idiot!\n;}
Try this:

if (([EMAIL PROTECTED]($query_insert)) != FALSE) {
... echo HTML ...
}
else {echo Oops! Your programmer is broken. Oh and here's what MySQL 
said: br /\n.mysql_error();}

Hopefully that works for you. I think the problem may be the escapes 
quotes. Cheers,

Andy

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


[PHP-DB] How to display table columns

2004-04-25 Thread andy amol
hi,
  I want to display the table coulumns along with those values below it. I am only 
able to display the table values, now I want to diplay the corresponding table 
attribut above the value.
 
eg : name age sex
   abc1m
   xyz 2f
 
I want to display name, age and sex.
 
I am using mysql as database.
 
thanks in advance.
 


-
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢

[PHP-DB] Re: How to display table columns

2004-04-25 Thread Andy Ladouceur
I think what you may be looking for is the DESCRIBE command. It allows 
you to get information about table columns.

http://dev.mysql.com/doc/mysql/en/DESCRIBE.html

Andy

Andy Amol wrote:
hi,
  I want to display the table coulumns along with those values below it. I am only able to display the table values, now I want to diplay the corresponding table attribut above the value.
 
eg : name age sex
   abc1m
   xyz 2f
 
I want to display name, age and sex.
 
I am using mysql as database.
 
thanks in advance.
 


-
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Drop-down box in php

2004-04-20 Thread andy amol
hi,
   I would like to know how to create and populate drop down boxes in php.
I want the value to be populated from database.
What I am try to do is to provide the forign key value as combo box option, so that I 
do not have to check for referential integrity.
 
Thanks in advance.




-
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢

[PHP-DB] Drop-down box in php

2004-04-20 Thread andy amol
hi,
   I would like to know how to create and populate drop down boxes in php.
I want the value to be populated from database.
What I am try to do is to provide the forign key value as combo box option, so that I 
do not have to check for referential integrity.
 
Also if you can help me with a date validation program I will be grateful.
 
Thanks in advance.





-
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢

Re: [PHP-DB] Drop-down box in php

2004-04-20 Thread andy amol
hi,
   I am using the following code, but it is not populating my script. If you can help 
I would be grateful.
  I am using mysql as database.
? 
$sql = SELECT course_id FROM course; 
$sql_result = mysql_query($sql) 
or die(Couldn't execute query.); 
while ($row = mysql_fetch_array($sql_result)) { 
$type = $row[course_id]; 
$typedesc =$row[dept_id]; 
$option_block .= OPTION value=\$type\$typedesc/OPTION; 
} 
? 
SELECT name=selecttype id=selecttype 
? echo $option_block; ? 
/SELECT 

thanks.

John W. Holmes [EMAIL PROTECTED] wrote:
From: andy amol 

 I would like to know how to create and populate drop down boxes in php.
 I want the value to be populated from database.
 What I am try to do is to provide the forign key value as combo box
option, so that I do not have to check for referential integrity.

You still have to check. Just because you provide a discreet number of
options in a  box doesn't mean that's really all the user can choosefrom. There are 
many ways to manipulate the data.That being said, just create a loop as you draw items 
from your database.echo '';
$sql = SELECT name FROM products WHERE ...;
$result = query($sql);
while($row = fetch_assoc($result))
{ echo {$row['name']}\n; }
echo ;

I don't know what database you're using, so query() and fetch_assoc() are
generic.

---John Holmes...

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


-
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢

[PHP-DB] Re: Regular Expression

2004-04-19 Thread Andy Ladouceur
A regexp like this should work:

/^([a-zA-Z]|\s)+$/

Cheers,
Andy Ladouceur
Andy Amol wrote:

Hi,
   I would like to test whether a given sting contains only character, it should also support spaces.
eg Course Book String. I am able to test CourseBookString.
 
Also I would like to know how can we avoid wild chars like *, or any other char apart from alpha numeric char.
 
Thanks.


-
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Re: Regular Expression

2004-04-19 Thread andy amol
hi,
  Thanks for the reply.
I want to know how to include char - i.e a dash . I want to test for it.
eg: COSC-3006.
I should be able to test that string as valid.
Also is there a way in which the form validation fails but when the user goes back to 
the same form its previous values are retained.
 
eg: Suppose the user enters its name, age and phone number.
 But the phone number is wrongly entered. Then he goes back, the old values should 
still be displayed. Only the phone number should be cleared.
 
Also how to program for such a back button.
In what I have done is simply called the previous form, so it clears all the values.
Any help in appreciated.
 
Thanks in advance.
bye.
Kelly Hallman [EMAIL PROTECTED] wrote:
Apr 18 at 11:01pm, Andy Ladouceur wrote:
 Andy Amol wrote:
  I would like to test whether a given sting contains only character, it
  should also support spaces. eg Course Book String. I am able to test
  CourseBookString. Also I would like to know how can we avoid wild
  chars like *, or any other char apart from alpha numeric char.

 A regexp like this should work:
 /^([a-zA-Z]|\s)+$/

/^[A-Za-z\s]+$/ would be a better way of putting it.
however, \s would match tabs (also CR and/or LF in some regex engines).

to only alpha or space, this would work best:
/^[A-Za-z ]+$/

-- 
Kelly Hallman

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


-
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢

[PHP-DB] Regular Expression

2004-04-18 Thread andy amol
Hi,
   I would like to test whether a given sting contains only character, it should also 
support spaces.
eg Course Book String. I am able to test CourseBookString.
 
Also I would like to know how can we avoid wild chars like *, or any other char apart 
from alpha numeric char.
 
Thanks.


-
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢

[PHP-DB] Basic Doubts

2004-04-16 Thread andy amol

hi,
   I want to know the following things.

1. How can we maintain referential integrity (rather check) using PHP
Any example code will be helpful.

2. I want to display the column of the tables, how to do that.

3. I want to align the text and the text box on the page.

4. I also want to check the validation of text(numerical or text)

Any example script would be helpful.

thanks in advance.


 


-
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th

[PHP-DB] Hi I am new to PHP

2004-04-15 Thread andy amol

I have posted my problem at No: 33892 of this mailing list. I have received 1 reply. 
No: 33897

My exact problem with second file is as follows:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource on 
line 15


Can you help me to solve problem, any help would be appreciated.

Thanks.



-
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th

[PHP-DB] Hi I am new to PHP

2004-04-15 Thread andy amol
Hi,
I have a problem with the second file. I am not able to update the 
data from the php program. Any help on that would be appreciated. 
Any modification which would be reduce the code like directly using the 
Update command would be appreciated.
thanks in advance.
 
My exact problem with second file is as follows:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource on 
line 15


Here are the 3 files.

File1
---
htmlheadtitleBook Update Form/title/head
body
?
$db=project;
$link = mysql_connect(localhost,name,passwd);
if (! $link)
die(Couldn't connect to MySQL);
mysql_select_db($db , $link)
or die(Couldn't open $db: .mysql_error());
$result = mysql_query( SELECT * FROM books )
or die(SELECT Error: .mysql_error());
$num_rows = mysql_num_rows($result);
print There are $num_rows records.P;
print table width=800 border=1\n;
while ($get_info = mysql_fetch_row($result)){ 
print tr\n;
foreach ($get_info as $field) 
print \ttdfont face=arial size=2/$field/font/td\n;
print /tr\n;
}
print /table\n;
mysql_close($link);
//form method=POST action=book_change_form.php
?
br
form method=POST action=book_change_form.php
pre
Enter ISBN Number to Edit: input type=text name=id size=10
input type=submit value=Submitinput type=reset
/pre
/form
/body
/html

File 2
-
htmlheadtitleBook change form/title/head
body
?
$id=$_POST['id'];
$db=project;
//mysql_connect(localhost,$_POST['username'],$_POST['pass']);
$link = mysql_connect(localhost,name,passwd);
if (! $link)
die(Couldn't connect to MySQL);
mysql_select_db($db , $link)
or die(Couldn't open $db: .mysql_error());
$query= SELECT * FROM books WHERE id='$id';
$result=mysql_query($query);
$num=mysql_num_rows($result);
//echo $num;
$i=0;
while ($i  $num)
{ 
$isbn=mysql_result($result,$i,isbn);
$title=mysql_result($result,$i,title);
$author=mysql_result($result,$i,author);
$edition=mysql_result($result,$i,edition);
$course_id=mysql_result($result,$i,course);
$quantity=mysql_result($result,$i,quantity);
$stack_no=mysql_result($result,$i,stack_no);
?
table width=300 cellpadding=10 cellspacing=0 border=2
tr align=center valign=top
td align=center colspan=1 rowspan=1 bgcolor=#64b1ff
h3Edit and Submit/h3
form action=book_change_record.php method=post
input type=hidden name=username value=?php print 
$_POST['username']?
input type=hidden name=pass value=?php print $_POST['pass']?
input type=hidden name=ud_id value=? echo $id ?
ISBN:input type=text name=ud_isbn value=? print 
$isbn?br
Title:   input type=text name=ud_title value=? print 
$title?br
Author:  input type=text name=ud_author value=? print 
$author?br
Edition: input type=text name=ud_edition value=? print 
$edition?br
Course Id:   input type=text name=ud_course_id value=? print 
$course_id?br
Quantity:input type=text name=ud_quantity value=? print 
$quantity?br
Stack Number:input type=text name=ud_stack_no value=? echo 
$stack_no?br
input type=Submit value=Update
/form
/td/tr/table
?
++$i;
}//end while
?
/body
/html
//
File 3

htmlheadtitleBook Change Record/title/head
body
?
$user=$_POST['username'];
$password=$_POST['password'];
$ud_id=$_POST['ud_id'];
$ud_isbn=$_POST['ud_isbn'];
$ud_title=$_POST['ud_title'];
$ud_author=$_POST['ud_author'];
$ud_edition=$_POST['ud_edition'];
$ud_course_id=$_POST['ud_course_id'];
$ud_quantity=$_POST['ud_quantity'];
$ud_stack_no=$_POST['ud_stack_no'];
$db=project;
$link = mysql_connect(localhost,name,passwd);
if (! $link)
die(Couldn't connect to MySQL);
mysql_select_db($db , $link)
or die(Couldn't open $db: .mysql_error());
mysql_query( UPDATE books  SET isbn='$ud_isbn' ,title='$ud_title',
   
author='$ud_author',edition='$ud_edition',course_id='$ud_course_id',   
quantity = '$ud_quantity', stack_no = 
'$ud_stack_no' 
WHERE isbn='$ud_id');
echo Record Updated;
mysql_close($link);
?
form method=POST action=book_update_form.php
input type=hidden name=username value=?php print 
$_POST['username']?
input type=hidden name=pass value=?php print 
$_POST['password']?
input type=submit value=Change Another
/formbr
form method=POST action=book.php
input type=hidden name=username value=?php print 
$_POST['username']?
input type=hidden name=pass value=?php print 
$_POST['password']?
input type=submit value=Book Interface
/form
/body
/html




-
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th

[PHP-DB] I am new to PHP

2004-04-14 Thread andy amol

Hi. This is the qmail-send program at pb1.pair.com.I'm afraid I wasn't able to deliver 
your message to the following addresses.This is a permanent error; I've given up. 
Sorry it didn't work out.[EMAIL PROTECTED]:ezmlm-manage: fatal: I don't accept 
messages at this address (inlocal and/or inhost don't match) (#5.1.1)Hi,I have a 
problem with the second file. I am not able to update the data from the php program. 
Any help on that would be appreciated. Any modification which would be reduce the code 
like directly using the Update command would be appreciated.thanks in advance.Here are 
the 3 files.File1---htmlheadtitleBook Update 
Form/title/headbody?$db=project;$link = 
mysql_connect(localhost,name,passwd);if (! $link)die(Couldn't connect to 
MySQL);mysql_select_db($db , $link)or die(Couldn't open $db: 
.mysql_error());$result = mysql_query( SELECT * FROM books )or die(SELECT Error: 
.mysql_error());$num_rows =
 mysql_num_rows($result);print There are $num_rows records.P;print table 
width=800 border=1\n;while ($get_info = mysql_fetch_row($result)){ print 
tr\n;foreach ($get_info as $field) print \ttdfont face=arial 
size=2/$field/font/td\n;print /tr\n;}print 
/table\n;mysql_close($link);//form method=POST 
action=book_change_form.php?brform method=POST 
action=book_change_form.phppreEnter ISBN Number to Edit: input type=text 
name=id size=10input type=submit value=Submitinput 
type=reset/pre/form/body/htmlFile 
2-htmlheadtitleBook change 
form/title/headbody?$id=$_POST['id'];$db=project;//mysql_connect(localhost,$_POST['username'],$_POST['pass']);$link
 = mysql_connect(localhost,name,passwd);if (! $link)die(Couldn't connect to 
MySQL);mysql_select_db($db , $link)or die(Couldn't open $db: 
.mysql_error());$query= SELECT * FROM books WHERE
 id='$id';$result=mysql_query($query);$num=mysql_num_rows($result);//echo 
$num;$i=0;while ($i  $num){ 
$isbn=mysql_result($result,$i,isbn);$title=mysql_result($result,$i,title);$author=mysql_result($result,$i,author);$edition=mysql_result($result,$i,edition);$course_id=mysql_result($result,$i,course);$quantity=mysql_result($result,$i,quantity);$stack_no=mysql_result($result,$i,stack_no);?table
 width=300 cellpadding=10 cellspacing=0 border=2tr align=center 
valign=toptd align=center colspan=1 rowspan=1 bgcolor=#64b1ffh3Edit and 
Submit/h3form action=book_change_record.php method=postinput type=hidden 
name=username value=?php print $_POST['username']?input type=hidden 
name=pass value=?php print $_POST['pass']?input type=hidden name=ud_id 
value=? echo $id ?ISBN:input type=text name=ud_isbn value=? 
print $isbn?brTitle:   input type=text name=ud_title value=? print
 $title?brAuthor:  input type=text name=ud_author value=? print 
$author?brEdition: input type=text name=ud_edition value=? print 
$edition?brCourse Id:   input type=text name=ud_course_id value=? print 
$course_id?brQuantity:input type=text name=ud_quantity value=? print 
$quantity?brStack Number:input type=text name=ud_stack_no value=? echo 
$stack_no?brinput type=Submit 
value=Update/form/td/tr/table?++$i;}//end 
while?/body/html//File 
3htmlheadtitleBook Change 
Record/title/headbody?$user=$_POST['username'];$password=$_POST['password'];$ud_id=$_POST['ud_id'];$ud_isbn=$_POST['ud_isbn'];$ud_title=$_POST['ud_title'];$ud_author=$_POST['ud_author'];$ud_edition=$_POST['ud_edition'];$ud_course_id=$_POST['ud_course_id'];$ud_quantity=$_POST['ud_quantity'];$ud_stack_no=$_POST['ud_stack_no'];$db=project;$link
 =
 mysql_connect(localhost,name,passwd);if (! $link)die(Couldn't connect to 
MySQL);mysql_select_db($db , $link)or die(Couldn't open $db: 
.mysql_error());mysql_query( UPDATE books  SET isbn='$ud_isbn' ,title='$ud_title',   
author='$ud_author',edition='$ud_edition',course_id='$ud_course_id',   
quantity = '$ud_quantity', stack_no = '$ud_stack_no' WHERE 
isbn='$ud_id');echo Record Updated;mysql_close($link);?form method=POST 
action=book_update_form.phpinput type=hidden name=username value=?php print 
$_POST['username']?input type=hidden name=pass value=?php print 
$_POST['password']?input type=submit value=Change Another/formbrform 
method=POST action=book.phpinput type=hidden name=username value=?php 
print $_POST['username']?input type=hidden name=pass value=?php print 
$_POST['password']?input type=submit value=Book
 
Interface/form/body/html



-
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th

[PHP-DB] I am new to PHP

2004-04-14 Thread andy amol
Hi,
I have a problem with the second file. I am not able to update the 
data from the php program. Any help on that would be appreciated. 
Any modification which would be reduce the code like directly using the 
Update command would be appreciated.
thanks in advance.
Here are the 3 files.

File1
---
htmlheadtitleBook Update Form/title/head
body
?
$db=project;
$link = mysql_connect(localhost,name,passwd);
if (! $link)
die(Couldn't connect to MySQL);
mysql_select_db($db , $link)
or die(Couldn't open $db: .mysql_error());
$result = mysql_query( SELECT * FROM books )
or die(SELECT Error: .mysql_error());
$num_rows = mysql_num_rows($result);
print There are $num_rows records.P;
print table width=800 border=1\n;
while ($get_info = mysql_fetch_row($result)){ 
print tr\n;
foreach ($get_info as $field) 
print \ttdfont face=arial size=2/$field/font/td\n;
print /tr\n;
}
print /table\n;
mysql_close($link);
//form method=POST action=book_change_form.php
?
br
form method=POST action=book_change_form.php
pre
Enter ISBN Number to Edit: input type=text name=id size=10
input type=submit value=Submitinput type=reset
/pre
/form
/body
/html

File 2
-
htmlheadtitleBook change form/title/head
body
?
$id=$_POST['id'];
$db=project;
//mysql_connect(localhost,$_POST['username'],$_POST['pass']);
$link = mysql_connect(localhost,name,passwd);
if (! $link)
die(Couldn't connect to MySQL);
mysql_select_db($db , $link)
or die(Couldn't open $db: .mysql_error());
$query= SELECT * FROM books WHERE id='$id';
$result=mysql_query($query);
$num=mysql_num_rows($result);
//echo $num;
$i=0;
while ($i  $num)
{ 
$isbn=mysql_result($result,$i,isbn);
$title=mysql_result($result,$i,title);
$author=mysql_result($result,$i,author);
$edition=mysql_result($result,$i,edition);
$course_id=mysql_result($result,$i,course);
$quantity=mysql_result($result,$i,quantity);
$stack_no=mysql_result($result,$i,stack_no);
?
table width=300 cellpadding=10 cellspacing=0 border=2
tr align=center valign=top
td align=center colspan=1 rowspan=1 bgcolor=#64b1ff
h3Edit and Submit/h3
form action=book_change_record.php method=post
input type=hidden name=username value=?php print 
$_POST['username']?
input type=hidden name=pass value=?php print $_POST['pass']?
input type=hidden name=ud_id value=? echo $id ?
ISBN:input type=text name=ud_isbn value=? print 
$isbn?br
Title:   input type=text name=ud_title value=? print 
$title?br
Author:  input type=text name=ud_author value=? print 
$author?br
Edition: input type=text name=ud_edition value=? print 
$edition?br
Course Id:   input type=text name=ud_course_id value=? print 
$course_id?br
Quantity:input type=text name=ud_quantity value=? print 
$quantity?br
Stack Number:input type=text name=ud_stack_no value=? echo 
$stack_no?br
input type=Submit value=Update
/form
/td/tr/table
?
++$i;
}//end while
?
/body
/html
//
File 3

htmlheadtitleBook Change Record/title/head
body
?
$user=$_POST['username'];
$password=$_POST['password'];
$ud_id=$_POST['ud_id'];
$ud_isbn=$_POST['ud_isbn'];
$ud_title=$_POST['ud_title'];
$ud_author=$_POST['ud_author'];
$ud_edition=$_POST['ud_edition'];
$ud_course_id=$_POST['ud_course_id'];
$ud_quantity=$_POST['ud_quantity'];
$ud_stack_no=$_POST['ud_stack_no'];
$db=project;
$link = mysql_connect(localhost,name,passwd);
if (! $link)
die(Couldn't connect to MySQL);
mysql_select_db($db , $link)
or die(Couldn't open $db: .mysql_error());
mysql_query( UPDATE books  SET isbn='$ud_isbn' ,title='$ud_title',
   
author='$ud_author',edition='$ud_edition',course_id='$ud_course_id',quantity = 
'$ud_quantity', stack_no = 
'$ud_stack_no' 
WHERE isbn='$ud_id');
echo Record Updated;
mysql_close($link);
?
form method=POST action=book_update_form.php
input type=hidden name=username value=?php print 
$_POST['username']?
input type=hidden name=pass value=?php print 
$_POST['password']?
input type=submit value=Change Another
/formbr
form method=POST action=book.php
input type=hidden name=username value=?php print 
$_POST['username']?
input type=hidden name=pass value=?php print 
$_POST['password']?
input type=submit value=Book Interface
/form
/body
/html



-
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th

[PHP-DB] Re: insert data in mysql table

2004-04-11 Thread Andy Ladouceur
From what I can see, the order that you created the table with and the 
order of the fields in the query do not match up. Changing the query to:

$add_all = INSERT INTO $table 
values('','$name','$day','$question','$email','');

Should make things run just fine.

Cheers,
Andy
Charalambos Nicolaou wrote:

Hi everyone ,

I have created this Mysql table

CREATE TABLE questions (ID INT NOT NULL AUTO_INCREMENT, name 
VARCHAR(25), day DATE, question TEXT, email VARCHAR(30), PRIMARY KEY(ID));

And I am trying to insert data in it using the following

body

?
if(isset($_GET['commented']))
{
echo(Your comment has been posted.);

$host = ;
$user = **;
$pass = *;
$db = **;
$table = questions;
$name = $_GET['form_uname'];
$question = $_GET['form_quest'];
$day = $_GET['form_day'];
$email = $_GET['from_email'];
mysql_connect($host,$user,$pass) or die(mysql_error());
mysql_select_db($db) or die(mysql_error());
$add_all = INSERT INTO $table 
values('$name','$question','$day','$email','');
mysql_query($add_all) or die(mysql_error());
}
else
{
?
form method=get action=? echo $PHP_SELF  ; ? 
Name : input type=text name=form_uname
pQuestion :textarea rows=3 name=form_quest cols=36/textarea/p
pbr
Date: input type=text name=form_day
/p
pEmail: input type=text name=form_emailbrbr
input type= hidden name= commented value= set 
input type=submit value=Submit
/p
/form
?php
}
?
/body
Finally has a result to get the correct data only for the DATE and the 
data from the Question FORM goes to the name field. I do not know where 
the problem is. Help me please because I am going crazy,

Thanks in advance

Charalambos Nicolaou

_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re:*FIX* insert data in mysql table

2004-04-11 Thread Andy Ladouceur
Oops. I left a field in.
Change it to:
$add_all = INSERT INTO $table
 values('','$name','$day','$question','$email');
Andy

Andy Ladouceur wrote:

 From what I can see, the order that you created the table with and the 
order of the fields in the query do not match up. Changing the query to:

$add_all = INSERT INTO $table 
values('','$name','$day','$question','$email','');

Should make things run just fine.

Cheers,
Andy
Charalambos Nicolaou wrote:

Hi everyone ,

I have created this Mysql table

CREATE TABLE questions (ID INT NOT NULL AUTO_INCREMENT, name 
VARCHAR(25), day DATE, question TEXT, email VARCHAR(30), PRIMARY 
KEY(ID));

And I am trying to insert data in it using the following

body

?
if(isset($_GET['commented']))
{
echo(Your comment has been posted.);

$host = ;
$user = **;
$pass = *;
$db = **;
$table = questions;
$name = $_GET['form_uname'];
$question = $_GET['form_quest'];
$day = $_GET['form_day'];
$email = $_GET['from_email'];
mysql_connect($host,$user,$pass) or die(mysql_error());
mysql_select_db($db) or die(mysql_error());
$add_all = INSERT INTO $table 
values('$name','$question','$day','$email','');
mysql_query($add_all) or die(mysql_error());
}
else
{
?
form method=get action=? echo $PHP_SELF  ; ? 
Name : input type=text name=form_uname
pQuestion :textarea rows=3 name=form_quest 
cols=36/textarea/p
pbr
Date: input type=text name=form_day
/p
pEmail: input type=text name=form_emailbrbr
input type= hidden name= commented value= set 
input type=submit value=Submit
/p
/form
?php
}
?
/body
Finally has a result to get the correct data only for the DATE and the 
data from the Question FORM goes to the name field. I do not know 
where the problem is. Help me please because I am going crazy,

Thanks in advance

Charalambos Nicolaou

_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] how to do query on partial field contents ???

2004-02-24 Thread Andy Armstrong
Frank Flynn wrote:

And if you'd like to make wild carding optional keep your code the way it
is:
$query .=  AND `model` LIKE '.$_GET['search'].';

And put a comment on the web page Use the % for wild cards.

The thing about:
  $query .=  AND `model` LIKE '%.$_GET['search'].%';
Is it will return many results if $_GET['search'] is very small like one
letter.
And bear in mind that there's could be a nasty SQL injection problem 
with that code if $_GET['search'] hasn't been SQL escaped in some way.

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


[PHP-DB] odbc_connect() failure

2003-12-16 Thread Andy Estes
I'm running the MySQL-supplied MyODBC driver (3.51) on top of iodbc on 
OS X 10.3.1.  I am running Apache 2.0.48, MySQL 4.0.15, and PHP 4.3.4. 
I am making the following call:

$odbc_id = odbc_connect(myodbc3, root, x);

I get the following result:

Warning: odbc_connect(): SQL error: [MySQL][ODBC 3.51 Driver]Unknown 
MySQL Server Host 'test2.php' (1), SQL state S1000 in SQLConnect 
in/Library/Apache2/htdocs/test2.php on line 3

It is attempting to use the filename as the host (test2.php), and 
obviously failing to resolve it.  I have verified that my DSN is 
correctly configured, as I can make ODBC connections through the CLI 
odbctest utility and successfully run queries.  This also suggests to me 
that the problem does not lie with the MyODBC driver itself. 
Furthermore, I have attempted to use mysql_connect(...), which works 
fine, so I am also ruling out a MySQL configuration issue (such as 
localhost not being in the grant tables).  Does anyone know what else I 
should be looking for here?  I will paste the contents of my odbc.ini 
file as well if this would help anyone.

Thanks,
Andy
;
;  odbc.ini configuration for MyODBC and MyODBC 3.51 Drivers
;
[ODBC Data Sources]
myodbc3 = MySQL ODBC 3.51 Driver DSN
[myodbc3]
Driver   = /Library/MyODBC/lib/libmyodbc3.bundle
Description  = MySQL ODBC 3.51 Driver DSN
SERVER   = localhost
USER = root
Password = x
Database = test
[Default]
Driver   = /Library/MyODBC/lib/libmyodbc3.bundle
Description  = MySQL ODBC 3.51 Driver DSN
SERVER   = localhost
USER = root
Password = x
Database = test
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Fw: [PHP-DB] PhpmyAdmin from external computers

2003-12-04 Thread Andy Levy
I do not get an error message as such.

I  goto http://serverIP/phpmyadmin/index.php  - and it logs me
inautomatically as localhost, i can see the database lists on the side panel
etc.

I click on a database or create a new database and the login screen comes
up.

I try entering the root password and username, but it just comes up with :

#1045 - Access denied for user: '[EMAIL PROTECTED]' (Using password: NO)

and ive tried with a blank  password as well.

I have the auth_type in config.inc.php (PhpMyAdmin) set to 'config' and the
username and password for mysql is in their respective places.





- Original Message - 
From: mike karthauser [EMAIL PROTECTED]
To: 
Sent: Thursday, December 04, 2003 2:34 PM
Subject: Re: [PHP-DB] PhpmyAdmin from external computers


  However, when i connect to that computer from my windows computer and go
to
  the phpmyadmin url it wont let me do anything.  Ive set all the
priveleges
  to allow full access in every way, but it still wont let me access it

 What error do you get?

 -- 
 Mike Karthauser
 Managing Director - Brightstorm Ltd

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

 SnailmailUnit 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



Fw: [PHP-DB] PhpmyAdmin from external computers

2003-12-04 Thread Andy Levy
Im afraid ive already tried that.


- Original Message - 
From: mike karthauser [EMAIL PROTECTED]
To: 
Sent: Thursday, December 04, 2003 3:10 PM
Subject: Re: [PHP-DB] PhpmyAdmin from external computers


  I  goto http://serverIP/phpmyadmin/index.php  - and it logs me
  inautomatically as localhost, i can see the database lists on the side
panel
  etc.
 
  I click on a database or create a new database and the login screen
comes
  up.
 
  I try entering the root password and username, but it just comes up with
:
 
  #1045 - Access denied for user: '[EMAIL PROTECTED]' (Using password: NO)
 
  and ive tried with a blank  password as well.
 
  I have the auth_type in config.inc.php (PhpMyAdmin) set to 'config' and
the
  username and password for mysql is in their respective places.

 Logging in as root with no password remotely is not good. Try making
another
 user logged in locally with user and password, then try that from remote.


 -- 
 Mike Karthauser
 Managing Director - Brightstorm Ltd

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

 SnailmailUnit 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



[PHP-DB] PhpmyAdmin from external computers

2003-12-04 Thread Andy Levy
Hi

I have phpMyAdmin installed on my red hat 8 box with mysql 3.  It works fine
on that computer and phpmyadmin gives me full access to the database.
However, when i connect to that computer from my windows computer and go to
the phpmyadmin url it wont let me do anything.  Ive set all the priveleges
to allow full access in every way, but it still wont let me access it

Any clue ?


Andrew

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



[PHP-DB] phpMyAdmin produces error on PHP

2003-12-02 Thread Andy Levy
I am using Red Hat 9 which comes with PHP.  

I have installed mySQL and tested it from terminal - it seems to be working fine.  I 
am very new to Linux though.

phpMyAdmin is producing the following error message from the browser 

cannot load MySQL extension,
please check PHP configuration.
DOCUMENTATION (link)

I have checked the documentation, and it says to install a package called PHP-MySQL.   
 I have downloaded this and (i think) installed it.  But the error message remains.  I 
am not that great with Linux - so any help you can provide will be very appreciated.  

Thank you 

Andy

[PHP-DB] Re: session variables when accessing the same page

2003-10-12 Thread Andy Cantrell
Figured it out.  I was trying to use the same associative
array under the form tag as I was trying to save under
the session.  Using two different variable constructs worked.
Andy Cantrell wrote:

Working with storing and reusing session variables.
If I use t1.php to generate a form, and the form
calls t2.php, the session vars are available.
If upgrade t1.php to recognize if it is the first
time it has been called versus the second time
e.g.
   if (isset($some_session_var)) {
  generate_second_page();
   } else {
  # set $some_sesson_var in the function
  # and use session_register() for that var.
  # I have verified that I'm using global $some_session_var
  # under here as well as generate_second_page().
  generate_initial_page();
   };
Under this scenario, I'm unable to find any session
vars.  That is, $some_session_var is never set the
second time I call t1.php.  If I change the form tag
to call t2.php that has the code for 'generate_second_page()'
than all seems to work ok.  Am I missing something?
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] session variables when accessing the same page

2003-10-11 Thread Andy Cantrell
Working with storing and reusing session variables.
If I use t1.php to generate a form, and the form
calls t2.php, the session vars are available.
If upgrade t1.php to recognize if it is the first
time it has been called versus the second time
e.g.
   if (isset($some_session_var)) {
  generate_second_page();
   } else {
  # set $some_sesson_var in the function
  # and use session_register() for that var.
  # I have verified that I'm using global $some_session_var
  # under here as well as generate_second_page().
  generate_initial_page();
   };
Under this scenario, I'm unable to find any session
vars.  That is, $some_session_var is never set the
second time I call t1.php.  If I change the form tag
to call t2.php that has the code for 'generate_second_page()'
than all seems to work ok.  Am I missing something?
--
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 Andy Green
try putting a \ before the apostrophe

-Original Message-
From: Dillon, John [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 27, 2003 12:59 PM
To: 'PHP-DB'
Subject: [PHP-DB] MySQL query failing on apostrophe in data


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



[PHP-DB] PHP + Interbase / Firebird extensions

2003-03-08 Thread Andy Neillans
This might sound like a daft question, so I apologise :)

I have been asked to link to an existing Firebird / Interbase server and
pull some records via PHP page on our intranet and internet servers.

The problem is, correct me if I am wrong, that I need to recompile PHP to
install the Interbase extesions  ---  this is not going to be fun, as both
machines are under fairly constant load..

Is it possible to simply load the Interbase extensions as a module? If so,
where can I get the source / instructions for compiling / installing this
module?

Platforms: Mandrake Linux 9.0, Redhat Linux 7.2

Many thanks!

Andy Neillans



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



[PHP-DB] A-Z Listings

2003-02-26 Thread Andy
Hi There., I have a script that lists directorys then how many files are in each. 
although it won't list in an A-Z format, would anyone know how i would do this?

Any help would  be greatly appreciated and all required code is included below

TIA
Andy

?







function romcount($system, $counter) {







if ($handle = opendir(roms/$system)) {



while (false !== ($file = readdir($handle))) { 



if ($file != .  $file != ..) { 



$counter++;



} 



}



closedir($handle); 



}







}  // end function romcount







function listsystems() {







if ($handle = opendir('roms')) {



while (false !== ($system = readdir($handle))) { 



if ($system != .  $system != ..) { 











// count roms







$counter = 0;



if ($handle2 = opendir(roms/$system)) {



while (false !== ($file = readdir($handle2))) { 



 if ($file != .  $file != ..) { 



$counter++;   



} 



}



closedir($handle2); 



}



$totalroms = $totalroms + $counter;



// end count roms







echo div align=\center\centertable border=\0\ 
cellpadding=\0\ cellspacing=\0\ style=\border-collapse: collapse\ 
bordercolor=\#11\ width=\80%\ id=\AutoNumber1\trtd width=\91%\a 
href=\index.php?page=download2system=$system\$system/a/tdtd 
width=\20%\center($counter)/center/td/tr/table/center/div/center; 



} 



}



closedir($handle); 



echo centerBrbWe Currently Have $totalroms ROMs!/b/centerBR;



}







}  // end function listsystems



?















? 



listsystems(); 



?


RE: [PHP-DB] airport codes db

2002-11-13 Thread Andy Crain
Or you could go here:
http://flyaow.com/airportcode.htm

Andy

-Original Message-
From: Edward Peloke [mailto:epeloke;echoman.com] 
Sent: Wednesday, November 13, 2002 1:32 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] airport codes db

great idea...I am setting up a webserver at home and as soon as it is
up, I
will create an interface!

Thanks,
Eddie

-Original Message-
From: [EMAIL PROTECTED] [mailto:bbonkosk;tampabay.rr.com]
Sent: Wednesday, November 13, 2002 7:38 AM
To: Edward Peloke; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] airport codes db


You should take advantage of this highly international PHP communicty
and
set
up a simple PHP interface to a table like:
Airport Code | Airport City | Airport Name | Country | etc..

And then ask people to go in there and insert whatever information they
know
especially from around their area.  Then you could post the rresulting
mysql
database somewhere for people's future use?

 I am working on a php page where I need some airport codes data, I
have
seen
 a few places online where you can buy this data so I was wondering if
anyone
 has used any of these databases and if anyone had a good source for a
mysql
 airport code db.

 Thanks,
 Eddie


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




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




[PHP-DB] Re: problems whenever changing data in database using PHPMyAdmin.

2002-09-03 Thread Andy

I do have the same problem since I did update to the newest version of
phpmyadmin.

This seems to be a bug in the new release since everything was working ok
before the update. guess those guys are gonna release a .1 version pretty
soon.

andy


Kasper [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 ... I was wondering for quiete a while about the subject to get it accurat
 enough concerning the problem I'm really having.

 I have my MySQL database runing, my site is running and fetching the data
 from the database without any problems. I can access PHPMyAdmin without
any
 problems aswell, I can browse my tables and the entries of the tables.
 But whenever I try to make any changes to my table, or to an entry, or if
I
 try to rename a table, or create a new table, I get the The Page Cannot
Be
 Displayed-404-error - why is that???   And why does this error only occur
 when I'm altering the database??

 Is it a read-only-no-writting-problem??   is it a setting that does that
 PHPMyAdmin can't find the database to alter my changes??  If so, why can I
 brose the database and see all my entries and the content of the
database??


 Looking forward in getting some response.

 Kasper





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




[PHP-DB] gettin records from today, yesterday, etc.

2002-09-02 Thread andy

Hi there,

I am wondering how to get recors out of a mysql db from yesterday, last week
and last month. I did write a small php hack but this does not work
properly.

I did this:

 ###
 switch ($ts){
  case 1: // today
   $timestamp = substr($timestamp,0,8).'00';
   break;
  case 2: // yesterday
   $timestamp = (substr($timestamp,0,8)-1).'00';
   break;
  case 3: // last week
   $timestamp = (substr($timestamp,0,8)-7).'00';
   break;
 };
 $start_date = $timestamp;
 $display_option = AND p.timestamp  '$start_date';
 ###

But it leads to problems if I search for last week since I do a siple
subtraction of integer values and not of real days.

Maybe some of you guys has a better appoach?

Thanx,

Andy



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




[PHP-DB] uploading images before creating db entry

2002-09-01 Thread Andy

Hi there,

I have a running system where users can upload images. Each image has to be
acompanied with several other text infos suplied by the uploading person.
The image istself is stored in the filesystem and the data (like name of the
user and imagefilename) are stored in a mysql myisam table. Now there are 2
problems I try to solve:

o If more than one person is uploading images in the same time,
   it occures that the user name is missing. This info comes out
   of the db as well. I guess it is just not fast enough before it
can
   be writen to the db again?

oSome users would like to upload the image first and view it as
  a thumbnail. After this they would have to add the text data.
  I fear that some of them would not do this and I would have a
  file hanging around not belonging to anything. So I wonder if
  it would be possible to upload it first to a temp dir, add the
data
  later and then move it from the temp dir to the propper one.
  I guess there has to be some kind of mechanism deleting old images
  periodicly which do not belong to anybody. I am kind of lost with
  this idea. Maybe some of you guys has a good idea on it?!

Thank you for any help on this cases.

Regards,

Andy





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




[PHP-DB] douplicate entry

2002-08-29 Thread Andy

Hi guys,

I have a community site running, where members can upload images of
themselves. The images are stored inside blobs of a mysql db.

Now sometimes -no clue how they do it- it happens that I get an errormsg
saying douplicate entry for bla.jpg
I guess they do press the upload button twice or something similar. Of
course there is a unique index on the column.

My question is how to prevent this error?

Thank you for any help on this.

Andy



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




[PHP-DB] full text search and how to underline keyword in results

2002-08-25 Thread andy

Hi there,

I am trying to write a php script to perform a full text search on a mysql
db. I do a match against... and it digs out some results out of the db.

There are 2 problems:

1. How can I restrict the results to e.g. 100 characters, but to make sure
the keyword is within this 100 characters?
2. Is it possible with php to underline the keyword inside the search
results. This might be more tricky.

Thank you for any help on that,

Andy



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




Re: [PHP-DB] full text search and how to underline keyword in results

2002-08-25 Thread andy

 for ($i=0; $i  count($keywords); $i++) {
 $blurb = eregi_replace( .$keywords[$i]. ,  font
 color=\#FF\.$keywords[$i]./font , $blurb);
 }

Hello Stuart,

great, thats a first success and works fast.

There are just 2 things which fail on this function:
1. Problems with full stops. A word with a full stop will be ignored (e.g
singapore. will not be found if you search for singapore)
2. If you search for singapore and there is a hit Singapore (notice the
capital!) will be replaced with singapore in the text.

I tryed to fix that, but I fear that my php experiance lacks on this stage
:-(

Maybe someone else or you do have a idea for a fix?

Cheers Andy



Stuart McDonald [EMAIL PROTECTED] schrieb im Newsbeitrag
001901c24c45$2a5e6940$0100a8c0@stuart">news:001901c24c45$2a5e6940$0100a8c0@stuart...
 Hi Andy,

 In answer to part two - here's a snippet of code I use to highlight
relevant
 words in red - hope it helps to put you on the right track.

 for ($i=0; $i  count($keywords); $i++) {
 $blurb = eregi_replace( .$keywords[$i]. ,  font
 color=\#FF\.$keywords[$i]./font , $blurb);
 }

 where $keywords is an array containing all the words searched for and
$blurb
 is the snippet that is returned with the search results At this stage in
the
 flow, I've already retrieved relevant records - this is in fact the last
 step before I format and display the results..

 Hope this helps

 stuart


 - Original Message -
 From: andy [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Sunday, August 25, 2002 9:32 PM
 Subject: [PHP-DB] full text search and how to underline keyword in results


  Hi there,
 
  I am trying to write a php script to perform a full text search on a
mysql
  db. I do a match against... and it digs out some results out of the db.
 
  There are 2 problems:
 
  1. How can I restrict the results to e.g. 100 characters, but to make
sure
  the keyword is within this 100 characters?
  2. Is it possible with php to underline the keyword inside the search
  results. This might be more tricky.
 
  Thank you for any help on that,
 
  Andy
 
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 





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




[PHP-DB] MySQL and BLOB

2002-08-21 Thread Andy

Hi there,

I am storing via PHP pictures into BLOB fields. Worked fine so far for over
200 images.
Now an error has occured with a particular picture. No error msg. Just does
not work. The wired thing is that the thumbnail does. So I guess the BLOB
field is just to small for the image.

How many kb can a blob field savin in MySQL and what do you suggest to do.

Thanx,

Andy

--
--
http://www.globosapiens.net
Worldwide Travel Community






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




Re: [PHP-DB] best way to stare true, false

2002-08-11 Thread Andy

oh... no I ment it in a different way..

somehow.. declare 1 enum value and then set it or not. Search for NULL or
not NULL values instead of false /true.

in this direction, but .. hey does nobody do this like that??

Andy

--

http://www.globosapiens.net
Global Travellers Network!



Raquel Rice [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Sat, 10 Aug 2002 17:41:56 +0200
 andy [EMAIL PROTECTED] wrote:

Hi there,
   
I am searching for the best way to store true or false inside
a MySQL DB. With best I mean the most data efficient way and
in the same time the best for fast searching later on the
table to find all which are false, or true. I think I did read
something about a way to do this with ENUM, but cant remember
where and how, all tryes did not succeeed so far.
   
Thanx for any help on that.
   
Andy
  
   How about as a tinyint ... 0/1
  
   --
   Raquel
 
  hmm.. thats how I am doing it right now. There might be a better
  way?!

 I've never used ENUM, so take what I say with a grain of salt.  It
 appears to me that if you use true or false as your ENUM values,
 those values are stored as strings.  In PHP you would then have to
 do string comparisons rather that
 if ($a) {
 do this;
 }

 Perhaps it depends upon how you use it ... what you do with it?

 --
 Raquel
 
 The world is not good enough - we must make it better.
   --Alice Walker




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




[PHP-DB] best way to stare true, false

2002-08-10 Thread andy

Hi there,

I am searching for the best way to store true or false inside a MySQL DB.
With best I mean the most data efficient way and in the same time the best
for fast searching later on the table to find all which are false, or true.
I think I did read something about a way to do this with ENUM, but cant
remember where and how, all tryes did not succeeed so far.

Thanx for any help on that.

Andy



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




Re: [PHP-DB] best way to stare true, false

2002-08-10 Thread andy

hmm.. thats how I am doing it right now. There might be a better way?!





Raquel Rice [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Sat, 10 Aug 2002 16:46:54 +0200
 andy [EMAIL PROTECTED] wrote:

  Hi there,
 
  I am searching for the best way to store true or false inside a
  MySQL DB. With best I mean the most data efficient way and in the
  same time the best for fast searching later on the table to find
  all which are false, or true. I think I did read something about a
  way to do this with ENUM, but cant remember where and how, all
  tryes did not succeeed so far.
 
  Thanx for any help on that.
 
  Andy

 How about as a tinyint ... 0/1

 --
 Raquel
 
 The world is not good enough - we must make it better.
   --Alice Walker




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




[PHP-DB] sucking news out of the usenet

2002-08-08 Thread andy

Hi guys,

I am trying to build a usenet gateway which is collecting usenet posts and
puts them into a phpbb forum. Same other way around. So I did read an
excelent article on that published by Armel Fauveau at:
http://www.phpbuilder.com/columns/armel20010427.php3?page=1 (this is where
the code underneath is from. So getting the articles works.

My problem is how to glue all the articles together which are relies. I am
sure there is a way to find out which reply belongs to a post. I would like
to feed the phpbb database with it.

This is an example of an article including the header:

Newsgroups: php.general Path: news.php.net Xref: news.php.net
php.general:111709 Return-Path: Mailing-List: contact
[EMAIL PROTECTED]; run by ezmlm Delivered-To: mailing list
[EMAIL PROTECTED] Received: (qmail 81897 invoked by uid 1007); 8 Aug
2002 18:28:33 - Message-ID: [EMAIL PROTECTED]
To: [EMAIL PROTECTED] Reply-To: sebastian Date: Thu, 8 Aug 2002
20:27:21 +0200 Lines: 11 X-Priority: 3 X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600. X-MimeOLE: Produced
By Microsoft MimeOLE V6.00.2600. X-Posted-By: 141.44.162.176 Subject:
streaming mp3-audio??? From: [EMAIL PROTECTED] (Sebastian) hi @ all!
i´m looking for an algorithm or class to stream mp3-audiofiles, such as easy
as it can be. i found nothing on php.net and downloaded some phpscripts from
hotscripts and sourceforge but they were all very cryptical and bad
documentated. please help me, many thanks sebastian .


Lots of text.. puhh! I hope this is somehow possible. Maybe one of you guys
has a good idea on that. You can just cut and past the code underneath and
try it out by yourself.

Thanx for any help on that.

Andy

-
http://www.OZforum.info
Australia Information Forum




?php
# http://www.phpbuilder.com/columns/armel20010427.php3?page=3

$cfgServer= news.php.net;
$cfgPort= 119;
$cfgTimeOut= 10;

// open a socket
if(!$cfgTimeOut)
// without timeout
$usenet_handle = fsockopen($cfgServer, $cfgPort);
else
// with timeout
$usenet_handle = fsockopen($cfgServer, $cfgPort, $errno, $errstr,
$cfgTimeOut);

if(!$usenet_handle) {
echo Connexion failed\n;
exit();
}
else {
echo Connected\n;
$tmp = fgets($usenet_handle, 1024);
}

###
# page 2

//$cfgUser= xx;
//$cfgPasswd= yy;
$cfgNewsGroup= php.general;

// identification required on private server
if($cfgUser) {
fputs($usenet_handle, AUTHINFO USER .$cfgUser.\n);
$tmp = fgets($usenet_handle, 1024);

fputs($usenet_handle, AUTHINFO PASS .$cfgPasswd.\n);
$tmp = fgets($usenet_handle, 1024);

// check error

if($tmp != 281 Ok\r\n) {
echo 502 Authentication error\n;
exit();
}
}

// select newsgroup

fputs($usenet_handle, GROUP .$cfgNewsGroup.\n);
$tmp = fgets($usenet_handle, 1024);

if($tmp == 480 Authentication required for command\r\n) {
echo $tmp\n;
exit();
}

$info = split( , $tmp);
$first = $info[2];
$last = $info[3];

print First : $first\nbr;
print Last : $last\nbr;

###
# page 3

$cfgLimit= 10;

// upload last articles

$boucle=$last-$cfgLimit;

while ($boucle = $last) {

set_time_limit(0);

fputs($usenet_handle, ARTICLE $boucle\n);
#fputs($usenet_handle, BODY $boucle\n);

$article=;
$tmp = fgets($usenet_handle, 4096);

if(substr($tmp,0,3) != 220 AND substr($tmp,0,3) != 222) {
echo +--+\nbr;
echo Error on article $boucle\nbr;
echo +--+\nbr;
}
else {
while($tmp!=.\r\n) {
$tmp = fgets($usenet_handle, 4096);

   $article = $article.$tmp;
}

echo +--+\nbr;
echo Article $boucle\nbr;
echo +--+\nbr;
echo $article\nbr;
}

$boucle++;


}

// close connexion

fclose($usenet_handle);

?



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




[PHP-DB] Re: sucking news out of the usenet

2002-08-08 Thread andy

sorry for posting into the wrong forum. My mistake!







Andy [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi guys,

 I am trying to build a usenet gateway which is collecting usenet posts and
 puts them into a phpbb forum. Same other way around. So I did read an
 excelent article on that published by Armel Fauveau at:
 http://www.phpbuilder.com/columns/armel20010427.php3?page=1 (this is where
 the code underneath is from. So getting the articles works.

 My problem is how to glue all the articles together which are relies. I am
 sure there is a way to find out which reply belongs to a post. I would
like
 to feed the phpbb database with it.

 This is an example of an article including the header:

 Newsgroups: php.general Path: news.php.net Xref: news.php.net
 php.general:111709 Return-Path: Mailing-List: contact
 [EMAIL PROTECTED]; run by ezmlm Delivered-To: mailing list
 [EMAIL PROTECTED] Received: (qmail 81897 invoked by uid 1007); 8
Aug
 2002 18:28:33 - Message-ID: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED] Reply-To: sebastian Date: Thu, 8 Aug 2002
 20:27:21 +0200 Lines: 11 X-Priority: 3 X-MSMail-Priority: Normal
 X-Newsreader: Microsoft Outlook Express 6.00.2600. X-MimeOLE: Produced
 By Microsoft MimeOLE V6.00.2600. X-Posted-By: 141.44.162.176 Subject:
 streaming mp3-audio??? From: [EMAIL PROTECTED] (Sebastian) hi @
all!
 i´m looking for an algorithm or class to stream mp3-audiofiles, such as
easy
 as it can be. i found nothing on php.net and downloaded some phpscripts
from
 hotscripts and sourceforge but they were all very cryptical and bad
 documentated. please help me, many thanks sebastian .


 Lots of text.. puhh! I hope this is somehow possible. Maybe one of you
guys
 has a good idea on that. You can just cut and past the code underneath and
 try it out by yourself.

 Thanx for any help on that.

 Andy

 -
 http://www.OZforum.info
 Australia Information Forum




 ?php
 # http://www.phpbuilder.com/columns/armel20010427.php3?page=3

 $cfgServer= news.php.net;
 $cfgPort= 119;
 $cfgTimeOut= 10;

 // open a socket
 if(!$cfgTimeOut)
 // without timeout
 $usenet_handle = fsockopen($cfgServer, $cfgPort);
 else
 // with timeout
 $usenet_handle = fsockopen($cfgServer, $cfgPort, $errno, $errstr,
 $cfgTimeOut);

 if(!$usenet_handle) {
 echo Connexion failed\n;
 exit();
 }
 else {
 echo Connected\n;
 $tmp = fgets($usenet_handle, 1024);
 }

 ###
 # page 2

 //$cfgUser= xx;
 //$cfgPasswd= yy;
 $cfgNewsGroup= php.general;

 // identification required on private server
 if($cfgUser) {
 fputs($usenet_handle, AUTHINFO USER .$cfgUser.\n);
 $tmp = fgets($usenet_handle, 1024);

 fputs($usenet_handle, AUTHINFO PASS .$cfgPasswd.\n);
 $tmp = fgets($usenet_handle, 1024);

 // check error

 if($tmp != 281 Ok\r\n) {
 echo 502 Authentication error\n;
 exit();
 }
 }

 // select newsgroup

 fputs($usenet_handle, GROUP .$cfgNewsGroup.\n);
 $tmp = fgets($usenet_handle, 1024);

 if($tmp == 480 Authentication required for command\r\n) {
 echo $tmp\n;
 exit();
 }

 $info = split( , $tmp);
 $first = $info[2];
 $last = $info[3];

 print First : $first\nbr;
 print Last : $last\nbr;

 ###
 # page 3

 $cfgLimit= 10;

 // upload last articles

 $boucle=$last-$cfgLimit;

 while ($boucle = $last) {

 set_time_limit(0);

 fputs($usenet_handle, ARTICLE $boucle\n);
 #fputs($usenet_handle, BODY $boucle\n);

 $article=;
 $tmp = fgets($usenet_handle, 4096);

 if(substr($tmp,0,3) != 220 AND substr($tmp,0,3) != 222) {
 echo +--+\nbr;
 echo Error on article $boucle\nbr;
 echo +--+\nbr;
 }
 else {
 while($tmp!=.\r\n) {
 $tmp = fgets($usenet_handle, 4096);

$article = $article.$tmp;
 }

 echo +--+\nbr;
 echo Article $boucle\nbr;
 echo +--+\nbr;
 echo $article\nbr;
 }

 $boucle++;


 }

 // close connexion

 fclose($usenet_handle);

 ?





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




[PHP-DB] escaping line brakes

2002-07-16 Thread Andy

Hi there,

I am putting text into a mysql db from a form field. I do include the
linebrakes with line2br.

Now I would like to create an interface where I could load the text into the
form again to edit it. Unfortunatelly it includes some wired chars like \br
into the text. How can I get rid of that?

Thanx for any help,

Andy



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




[PHP-DB] how can this be? GET instead of POST - db error

2002-07-13 Thread Andy

Hi everybody,

I am just trying to find out how some db errors happened during a user was
browsing my web app.

This is out of the Apache log:

GET /subapp_profiles/act_upload_image.php HTTP/1.1 200 160
POST /subapp_profiles/act_upload_image.php HTTP/1.1 302 5

I do not have a clue where this GET request could come from. This has caused
a empty sql statement and therefore a db error. How can could this be
achieved? By clicking back in the browser window? I dont think so since the
same user was on another site before.

Has anybody a idea on that?

Andy



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




[PHP-DB] Calculating inside query?

2002-07-10 Thread andy

Hi there,

I would like to find out the top 10 of some ratings. There are 2 columns.
One for the rating and one for the amount of ratings.
To find out the top 10 I would have to divide those 2 values and sort it.

Somehow this does not work. I do not have a clue why. Maybe someone of you
guys do see the error:

Mysql:

SELECT
  ID,
  rating_total / ratings_amount AS top10
FROM rating
ORDER BY top10 desc
LIMIT 10

Thanx for any help,

Andy
query




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




Re: [PHP-DB] Calculating inside query?

2002-07-10 Thread andy

there is no error, it just does not pull out the right values. Just puts out
10 listings and the top10 column (as I named it by alias) contains no value.
I am using mysql.

maybe this has to do somehting with the alias?


Ryan Jameson [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
i assume you're using MySQL because of the Limit clause, but what error are
you receiving?

-Original Message-
From: andy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 10:34 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Calculating inside query?


Hi there,

I would like to find out the top 10 of some ratings. There are 2 columns.
One for the rating and one for the amount of ratings.
To find out the top 10 I would have to divide those 2 values and sort it.

Somehow this does not work. I do not have a clue why. Maybe someone of you
guys do see the error:

Mysql:

SELECT
  ID,
  rating_total / ratings_amount AS top10
FROM rating
ORDER BY top10 desc
LIMIT 10

Thanx for any help,

Andy
query




--
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] Calculating inside query?

2002-07-10 Thread andy

oh I see! There have been '' values in some columns.

Thanx

Andy


Ryan Jameson [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
do both of the fields contain values and are they both numeric? It sure
seems strange to me. I actually created a test and it worked fine, just
copied your query.
 Ryan

-Original Message-
From: andy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 10:48 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Calculating inside query?


there is no error, it just does not pull out the right values. Just puts out
10 listings and the top10 column (as I named it by alias) contains no value.
I am using mysql.

maybe this has to do somehting with the alias?


Ryan Jameson [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
i assume you're using MySQL because of the Limit clause, but what error are
you receiving?

-Original Message-
From: andy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 10:34 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Calculating inside query?


Hi there,

I would like to find out the top 10 of some ratings. There are 2 columns.
One for the rating and one for the amount of ratings.
To find out the top 10 I would have to divide those 2 values and sort it.

Somehow this does not work. I do not have a clue why. Maybe someone of you
guys do see the error:

Mysql:

SELECT
  ID,
  rating_total / ratings_amount AS top10
FROM rating
ORDER BY top10 desc
LIMIT 10

Thanx for any help,

Andy
query




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




[PHP-DB] sort problem

2002-07-10 Thread andy

Hi guys,

I have a problem sorting values comming out of a db. It is not as easy.

Here is the prob:
One table containing user points.
Other table containing reports with rankings
For each top 10 report (the 10 reports with the most ranking) there are 20
extra points granted

Now I would like to get the top 5 members out of the db. If I only pull out
the user table ordered by points desc limit 5 I might miss a user with a top
10 report and 20 extra points.

So I thought about sorting the array afterwards with asort, but then I loose
the asoziation with the user_id.

Maybe there is a way to sort the other arrays with the same sorting algo? Or
a way to include a iff clause in the query?

currently I am doing:
SELECT
u_name,
id,
points
FROM user
WHERE
points  0
ORDER by points desc
LIMIT 5

and the top10 reports extra.

Has anybody a good idea on that?

Andy



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




[PHP-DB] resizing images comming out of blobs

2002-07-04 Thread andy

Hi there,

I am wondering how to resize an image which is stored in a mysql blob field.

With files this workes just fine, but how to do this with the image comming
from blob? Has anybody done this already?

Thank you for any help on that,

andy



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




[PHP-DB] storing content data outside the application

2002-07-02 Thread Andy

Hi there,

I have a problem with content data. Currently I do store images inside a
data folder.
/data

This is causing a problem, because everytime I installan update of the
application on the server I have to move this folder around to the new
version of my application. I am worried that during this coppy an error will
apear, due to my fault, or whatever might happen. The immages are part of a
dataset stored in a mysqldb. So I tryed to store them to blobs, but this is
causing performance problems. Images apear much quicker while comming from
the filesystem. They also seem not to be cached by the client anymore.

Does anybody know a good method to store the images outside the rootfolder
and still access them the old fashion way?

Any suggestions are appreciated.

Thanx, Andy






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




[PHP-DB] blob versus file

2002-07-01 Thread andy

Hi there,

I am wondering if anybody has experiance in saving images to blob in mysql.

I do save images with 1 K and 4 KB to blob fields while I used to save them
to file. It seams to me that this is much slower accessing the files. The
images take a bit (really short but absolutly noticable) to show up on the
site. Is there a way to improve the performance, and why is this happening?
I thought the performance might even boost after storing them to blobs.

Thank you for any comments on that,

Andy

PS: I was planing to store all the other images (20 - 50 KB) to blobs as
well (thousands) but after this first experiance I am a bit confused if the
performance would even more suffer. Would you guys recommend this?



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




Re: [PHP-DB] blob versus file

2002-07-01 Thread Andy

is the increase of the network traffic noticable? The query is pretty small
just text. Do u really think this might increase the traffic?

I also noticed that the image is not cached anymore. Is this true for all
blobs, or do I just access them in a wron way?
(I am requesting a php file in the img tag with the statement inside and
output them before sending a jpeg header with an echo)

Thanx for your help,

Andy


Pierre-Alain Joye [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Mon, 1 Jul 2002 14:17:53 +0200
 andy [EMAIL PROTECTED] wrote:

  Hi there,
 
  I am wondering if anybody has experiance in saving images to blob in
mysql.
 
  I do save images with 1 K and 4 KB to blob fields while I used to save
them
  to file. It seams to me that this is much slower accessing the files.
The
  images take a bit (really short but absolutly noticable) to show up on
the
  site. Is there a way to improve the performance, and why is this
happening?
  I thought the performance might even boost after storing them to blobs.

 Not really, the OS filesystem contains features that makes it always
faster than a sql query, that will increase your network traffic too.

 Inserting images or whatever binary data in a database does not have much
sense, you could not do a query with this field, cannot be indexed (dunno if
exists a DB that implement a image indexer ;) ). Storing relative pathes
gave me always more portabilities between DBM.

 In some case, you have to insert images (or every others binary data) in
DB (due to global permissions system only avaible for the DB and not for the
filesystem, for example), but as far is possible, I avoid to do it so.

 IMHO :)

 pa



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




[PHP-DB] Re: MySQL query from multiple tables

2002-06-29 Thread andy

hello Matthew:

if I understood your problem right, you have to join the two tables.

E.g:

SELECT
ph.*,
pf.prod_ID,
pf.feat_ID,
pf.feat_value
FROM
product_head ph,
product_features pf

WHERE
ph.prod_cat_ID = 1
AND ph.prod_cat_ID = pf.prod_cat_ID /*join the two tables with the same
id*/
AND pf.yourcriteria = whatever /* put your criteria for table 2 here*/

Hope this helps a bit,

Andy

--
--
http://www.globosapiens.net
Global Travellers Network


Matthew Nock [EMAIL PROTECTED] schrieb im Newsbeitrag
news:[EMAIL PROTECTED]...
 Hi All,

 I have a strange query which I need to build - I have looked at the JOIN
and
 aliasing functions of mySQL but not sure if I can achieve want I want to
do.

 I have two tables (product_head, and product_features) (in addition to a
 number of other tables) which form the list of products I have available,
 and the features available with each product.

 I want to be able to retrieve from product_head the rows which are for a
 specific product category (ie: 1)..  this bit is easy.

 SELECT * from product_head where prod_cat_ID = 1;

 This query could return 1 or more rows - works great.

 but I also want to retrieve records from the product_features table.
 information stored in this table is:

 prod_ID feat_ID feat_value

 so for each product ID, there could be any number of features.  I need to
 retrieve only certain feat_value records, for specific products, where the
 feat_ID equals certain values .

 can I build a single query that will return all these results similar to
 below?


 Prod_ID Prod_name Feat_1_value Feat_2_value feat_3_value
 1 prod1 34 25 15
 2 prod2 10 15 15
 ...

 does this all make sense?




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




[PHP-DB] Re: [PHP] saving temporary image to database

2002-06-29 Thread andy

... sorry I thought it would be to much code.
Here is the complete code :

  $inputImg = ImageCreateFromJPEG($picture_location);

  # old size
  $srcX = imagesx($inputImg);
  $srcY = imagesy($inputImg);

   # new size
   $ratio = ($srcY / $dstY);
   $dstX = ($srcX / $ratio);

   $outputImg = ImageCreateTrueColor($maxX, $dstY);
   imagefill($outputImg, 0, 0, ImageColorAllocate($outputImg, 0, 0,0));
   imagecopyresampled($outputImg, $inputImg, (($maxX - $dstX) / 2),0,0,0,
$dstX, $dstY, $srcX, $srcY);

#
 # save image to db into blob

// this does not work (outputImg is a the colorcorrected file)
   $data = addslashes($outputImg);

 // this one would work
# $data = addslashes(fread(fopen($picture_location, r),
filesize($picture_location)));

  $stmt =
INSERT INTO test.picture_test
(file_name, file_type, picture)
VALUES
 ('$name', '$picture_location_type', '$data')
  ;
   execute_stmt($stmt, $link);
  #


Rasmus Lerdorf [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 There is no imagejpeg() call in the code snippet you provided.  And you
 don't say how it is failing.  You haven't provided us with enough data to
 answer this question.

 -Rasmus

 On Sat, 29 Jun 2002, andy wrote:

  Hi there,
 
  I would like to save a jpg into a blob field of mysql. The function
  underneath works fine if I read the image from the temporary destination
  where php did put it after uploading.
 
  My problem is, that I would like to do some funky stuff to the image
like
  changing colors or adding watermarks. So I have several functions ahead
  before I used to store them successfully to the file system. Now I would
  like to store it to a blob field, but this does not work. Like I said it
  works to store the temp file, but not the other one. I guess it has to
do
  with something regarding the imagejpeg function.
 
  Here is what I tryed:
#
 # save image to db into blob
 
 // this does not work (outputImg is a the colorcorrected file)
   $data = addslashes($outputImg);
 
  // this one would work
 # $data = addslashes(fread(fopen($picture_location, r),
  filesize($picture_location)));
 
$stmt =
 INSERT INTO test.picture_test
  (file_name, file_type, picture)
  VALUES
  ('$name', '$picture_location_type', '$data')
;
execute_stmt($stmt, $link);
#
 
  Maybe some of you guy has a good idea on that.
 
  Thanx for any help,
 
  Andy
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 

--
--
http://www.globosapiens.net
Global Travellers Network



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




[PHP-DB] Re: question from newbie

2002-06-23 Thread Andy

Hi Chris,

if you have your keywords already in an array all you have to do is to
create the statement:

foreach($arrayname AS $value)
$where_stmt .= OR $value;

$stmt = SELECT ...
WHERE .$where_stmt
;

you might have to include an if stmt in the foreach loop because you are not
allowed to start with an OR.
But you get the idea?

Hope this helps,

Andy

--

http://www.globosapiens.net
Global Travellers Network!



Chris Barnes [EMAIL PROTECTED] schrieb im Newsbeitrag
000201c21ace$65e66ba0$[EMAIL PROTECTED]">news:000201c21ace$65e66ba0$[EMAIL PROTECTED]...
 Hi people,
 Im quite new to the list.

 I am trying to construct a php script that will take a string submitted
from
 a web site, break it up into keywords and add to an array, then perform a
 query to a mysql db for each keyword in the array. It will then send the
 result to the browser.

 the script is complete so far as I have added the functions to get the
 string from the web site, explode it and add it to an array, but i'm
having
 trouble putting together a loop that will do a new query for every keyword
 in the array.

 is anyone able to help me with an example of a loop which could work for
me?

 any help very much apreciated :)

 Chris Barnes




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




[PHP-DB] Re: Converting values from text to numerical

2002-06-21 Thread Andy

yes you can switch the type of var for examle with:

$number = (integer)$textvar;

But if you do store it as a textfield you want be able to do some special
sql stuff directly in mysql.

For example if you store the date as text in the db you want be able to
filter out entries which are between x and y.

Good luck,

Andy

--

http://www.globosapiens.net
Global Travellers Network!



Matthew Nock [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I am about to build a database of products that will store features fore
ach
 product in a separate table.

 I need to be able to store both text and numeric values in this table, but
 be able to perform mathmatical functions on the numeric variables.

 is it possible to have PHP covert numbers that are stored as text strings
 back into values it can calculate with?




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




[PHP-DB] Re: Copy table

2002-06-20 Thread Andy

the easiest way would be if you install myphpadmin which is a awesome free
mysql webadmin tool.

You can get it at http://www.hotscripts.com/Detailed/7180.html

Have fun,

Andy

--

http://www.globosapiens.net
Global Travellers Network!



Rosen [EMAIL PROTECTED] schrieb im Newsbeitrag
news:[EMAIL PROTECTED]...
 Hi,
 I want to copy data from one table to another ( some fields with same
names)
 with some condition.

 How can I do this ?

 Thanks,
 Rosen






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




[PHP-DB] Re: Resetting auto_incremented values

2002-06-20 Thread Andy

sorry buddy, as far as I know you can't.
The only thing you can do is to set the counter higher but you can't return
to a value under
the given row.

Please correct me if  I am wrong,

Andy

--

http://www.globosapiens.net
Global Travellers Network!



Martin Clifford [EMAIL PROTECTED] schrieb im Newsbeitrag
news:[EMAIL PROTECTED]...
Hi all,

I have a table that has ARTICLE_ID as the primary key, auto_incremented.  I
have added three rows to this table, yet I want to delete the third.  Here
it is now:

1 - Item 1
2 - Item 2
3 - Item 3

My question is, how do I delete Item 3, without having the next row's index
becoming 4?

1 - Item 1
2 - Item 2
4 - Item 3

Thanks in advance!

Martin




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




[PHP-DB] addslashes for db search?

2002-06-11 Thread andy

Hi there,

I have some db records starting with a ' E.g:  'Aimburu

Now I am wondering how to retrieve this records. without a addslashes it
returns an error. So I did add a slash, but then it does not find this
record.

I tryed this query:

...like '\'Aimburu %' ...

Do I have to change this db entries, and if how? How should they look like
and is there a good method to change all this thousands of records at once?

Thanx in advance,

Andy



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




[PHP-DB] dumping only selected records into another table

2002-06-11 Thread andy

Hi there,

I have some data in one table which I have to move to another. No I thought
of a mysqldump with a where clause. The problem though is, that it also
tryes to insert the ID which is a autoinc. primary key and already in use by
another record. How can I produce a insert statement withouth the ID
included?

This is how I tryed it:
mysqldump -p --where= country='us' -t data beaches  beaches_us.sql

This is a line of output:
INSERT INTO beaches VALUES (2345,'Carrabelle Beach','US','9');

This is how I would like to have the output:
INSERT INTO beaches VALUES ('','Carrabelle Beach','US','9');

does anybody know how to do this?

Thanx for any help, Andy











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




[PHP-DB] dumping only selected records into another table

2002-06-11 Thread andy

Hi there,

I have some data in one table which I have to move to another. No I thought
of a mysqldump with a where clause. The problem though is, that it also
tryes to insert the ID which is a autoinc. primary key and already in use by
another record. How can I produce a insert statement withouth the ID
included?

This is how I tryed it:
mysqldump -p --where= country='us' -t data beaches  beaches_us.sql

This is a line of output:
INSERT INTO beaches VALUES (2345,'Carrabelle Beach','US','9');

This is how I would like to have the output:
INSERT INTO beaches VALUES ('','Carrabelle Beach','US','9');

does anybody know how to do this?

Thanx for any help, Andy






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




[PHP-DB] dumping only selected records into another table

2002-06-11 Thread andy

Hi there,

I have some data in one table which I have to move to another. No I thought
of a mysqldump with a where clause. The problem though is, that it also
tryes to insert the ID which is a autoinc. primary key and already in use by
another record. How can I produce a insert statement withouth the ID
included?

This is how I tryed it:
mysqldump -p --where= country='us' -t data beaches  beaches_us.sql

This is a line of output:
INSERT INTO beaches VALUES (2345,'Carrabelle Beach','US','9');

This is how I would like to have the output:
INSERT INTO beaches VALUES ('','Carrabelle Beach','US','9');

does anybody know how to do this?

Thanx for any help, Andy








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




[PHP-DB] dumping only selected records into another table

2002-06-11 Thread andy

Hi there,

I have some data in one table which I have to move to another. No I thought
of a mysqldump with a where clause. The problem though is, that it also
tryes to insert the ID which is a autoinc. primary key and already in use by
another record. How can I produce a insert statement withouth the ID
included?

This is how I tryed it:
mysqldump -p --where= country='us' -t data beaches  beaches_us.sql

This is a line of output:
INSERT INTO beaches VALUES (2345,'Carrabelle Beach','US','9');

This is how I would like to have the output:
INSERT INTO beaches VALUES ('','Carrabelle Beach','US','9');

does anybody know how to do this?

Thanx for any help, Andy











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




[PHP-DB] Re: MyCC Problem

2002-06-09 Thread Andy

maybe you do not have the propper rights set. Check your grant privillegs on
the db.

Andy

--

http://www.globosapiens.net
Global Travellers Network!



César l . aracena [EMAIL PROTECTED] schrieb im Newsbeitrag
002a01c20e80$743a3650$14ed0dd1@gateway">news:002a01c20e80$743a3650$14ed0dd1@gateway...
Hi all. I know that this isn't probably the best place to make this
question, but I uses that some of you uses MyCC to connect to a remote
MySQL DB. My connection is no problem, but when I issue a SQL command,
which tells the DB to INSERT multiple rows into one table, It gives me
an error every time. Imagine what it takes to pass a 1000 rows to the
live DB one each time. Does anyone who uses MyCC had this problem
before? Know how to solve this?

Thanks in advance,

Cesar mailto:[EMAIL PROTECTED]  Aracena
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621





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




[PHP-DB] Re: Slow performance (PHP MYSQL)

2002-06-07 Thread Andy

PHP is known to be verry fast. MySQL as well. So your problem my be
somewhere else.

I am doing a similar thing on my site with thumbnails.

Check it out on http://www.globosapiens.net

Andy

--

http://www.globosapiens.net
Global Travellers Network!



Radek Zajkowski [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I am making pages for a client signed up with verio under signature
 hosting.

 The pages are very simple request from db for thumbnails, which are
 displayed 4 at a time etc.

 could it be because I'm generating the entire pages via PHP eg.

 echo(html)
 echo(head)
 echo(titleI'm so slow/title)
 echo(/head) etc. etc.

 as oppose to embedding the php into the html

 R

 Thanks in advance.

 --__-__-__
 eat pasta
 type fasta




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




[PHP-DB] date problem

2002-06-05 Thread andy

Hi there,

I would like to count the users out of a mysql db who registered after a
certain date.

The column I have in the db is a char and I do not want to change this
anymore.
This is how a typical entry looks like: May 29, 2002

This is how I tryed it:

// while '10...' is unix timestamp june 1, 02
SELECT COUNT(*) AS c
FROM users_table
WHERE UNIX_TIMESTAMP( user_regdate )  '1022882400'

Thanx for any help on that,

andy





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




[PHP-DB] date problem

2002-06-05 Thread andy

Hi there,

I would like to count the users out of a mysql db who registered after a
certain date.

The column I have in the db is a char and I do not want to change this
anymore.
This is how a typical entry looks like: May 29, 2002

This is how I tryed it:

// while '10...' is unix timestamp june 1, 02
SELECT COUNT(*) AS c
FROM users_table
WHERE UNIX_TIMESTAMP( user_regdate )  '1022882400'

Thanx for any help on that,

andy




query







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




[PHP-DB] Ho to write output of sql query to txt file?

2002-06-04 Thread andy

Hi there,

I am trying to get only records out of a table mathing a query. This should
be piped into a textfile. My problem is that I have to transmit this records
to a new machine. So the output should be a kind of sql commands which I
could run with phpadmin or similar to import them to the other db on the
other machine.

Is this possible?

Thank you for any help,

andy




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




[PHP-DB] Re: [PHP] Ho to write output of sql query to txt file?

2002-06-04 Thread andy

Original question:

 [snip]
 I am trying to get only records out of a table mathing a query. This
should
 be piped into a textfile. My problem is that I have to transmit this
records
 to a new machine. So the output should be a kind of sql commands which I
 could run with phpadmin or similar to import them to the other db on the
 other machine.

 Is this possible?
 [/snip]


Thank you for your help.

I did read on mysql.com and your article. Than I tryed to transfer the
datasets.
Export worked ok. The textfile contains the records.
Import message:
Query OK, 35 rows affected (0.04 sec)
Records: 35  Deleted: 0  Skipped: 0  Warnings: 630

The warning already tells it. the datasets are totally empty. Only default
of the columns is set.

do u have an idea why?

Thanx, Andy


- Original Message -
From: Jay Blanchard [EMAIL PROTECTED]
To: 'andy' [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Tuesday, June 04, 2002 4:07 PM
Subject: RE: [PHP] Ho to write output of sql query to txt file?


 [snip]
 I am trying to get only records out of a table mathing a query. This
should
 be piped into a textfile. My problem is that I have to transmit this
records
 to a new machine. So the output should be a kind of sql commands which I
 could run with phpadmin or similar to import them to the other db on the
 other machine.

 Is this possible?
 [/snip]

 from: http://www.mysql.com/doc/S/E/SELECT.html

 The SELECT ... INTO OUTFILE 'file_name' form of SELECT writes the selected
 rows to a file. The file is created on the server host and cannot already
 exist (among other things, this prevents database tables and files such as
 `/etc/passwd' from being destroyed). You must have the file privilege on
the
 server host to use this form of SELECT. SELECT ... INTO OUTFILE is mainly
 intended to let you very quickly dump a table on the server machine. If
you
 want to create the resulting file on some other host than the server host
 you can't use SELECT ... INTO OUTFILE. In this case you should instead use
 some client program like mysqldump --tab or mysql -e SELECT ... 
outfile
 to generate the file. SELECT ... INTO OUTFILE is the complement of LOAD
DATA
 INFILE; the syntax for the export_options part of the statement consists
of
 the same FIELDS and LINES clauses that are used with the LOAD DATA INFILE
 statement. See section 6.4.9 LOAD DATA INFILE Syntax. In the resulting
text
 file, only the following characters are escaped by the ESCAPED BY
character:
 The ESCAPED BY character
 The first character in FIELDS TERMINATED BY
 The first character in LINES TERMINATED BY
 Additionally, ASCII 0 is converted to ESCAPED BY followed by 0 (ASCII 48).
 The reason for the above is that you must escape any FIELDS TERMINATED BY,
 ESCAPED BY, or LINES TERMINATED BY characters to reliably be able to read
 the file back. ASCII 0 is escaped to make it easier to view with some
 pagers. As the resulting file doesn't have to conform to the SQL syntax,
 nothing else need be escaped. Here follows an example of getting a file in
 the format used by many old programs.
 SELECT a,b,a+b INTO OUTFILE /tmp/result.text
 FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY ''
 LINES TERMINATED BY \n
 FROM test_table;

 HTH!

 Jay




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




Re: [PHP-DB] how to create a graph from a db?

2002-06-04 Thread Andy

Hi Chris,

this is very easy done with a library called jpgraph.

Check out:
http://www.aditus.nu/jpgraph/

A nice example can be found on my website at:
http://www.globosapiens.net/community/03010001.html

Hope this helps,

Andy

--

http://www.globosapiens.net
Global Travellers Network!



Cal Evans [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 never done it myself but look into the png/jpg routines built into PHP.
You
 can use them to dynamically create an image. What you DO with the image is
 up to you. :)

 Seriously, there are some tutorials out there about this very topic.  hit
 phpbuilder.com or google.com to find them.

 =C=

 *
 * Cal Evans
 * Journeyman Programmer
 * Techno-Mage
 * http://www.calevans.com
 *


 -Original Message-
 From: Chris Payne [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, June 05, 2002 12:01 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] how to create a graph from a db?


 Hi there everyone,

 I have a db and the last column is id2 – this adds a 1 everytime a
 banner is clicked so that I can track which banners are being clicked
 the most – that works great, no problems – but how can I get the result
 out as a chart on the screen?  I’d like to list the 5 most popular
 banners on the screen, that I can do, but how do I display the numbers
 as images in a chart?  Any help would REALLY be appreciated.

 Thanks

 Chris Payne


 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.368 / Virus Database: 204 - Release Date: 5/29/2002





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




[PHP-DB] Converting non latin characters

2002-06-04 Thread Andy

Hi there,

I have a table containing cities of the world. Now I am running into
problems because people are starting to complain that some mayor cities are
not in the db like Tokyo. After checking my table I discovered that there
lots of cities are written with some non latin characters.

Tokyo is written like this: Tðkyð

Should, and if how, I convert this characters into latin ones. And what
happens if somebody from Japan with a different keyboard tries to find
Tokyo? Anyway what type of character is this 'ð' anyway? It does not look
Japanese to me :-)

Thank you for any help on that,

Andy


http://www.globosapiens.net
Global Travellers Network!



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




[PHP-DB] php is connecting to the wrong mysql server

2002-05-31 Thread andy

Hi there,

I am just trying to configure my root server. The provider has preinstalled
mysql on suse72. So I did try to get rid of this installation with yast, but
this did not work out. After compiling php,apache and mysql, PHP is still
trying to connect to the old server. The new server is running but how could
I tell php to connect to the right server?

Thanx for any help on that,

Andy



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




[PHP-DB] How to store an image into a db?

2002-05-25 Thread andy

Hi there,

I recently heard about storing images in a blob column in MySQl. Now I am
wondering how to do that. I mean isn't there a potential security problem
because of buffer over flow? How would I do that with php anyway?

Thank you guys for any hint.

Andy



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




[PHP-DB] Re: displaying records

2002-05-23 Thread andy

Hi Natividad,

I do not see exactly your problem, but you could do this in a better kind of
way. Lets say your table contains 1 Million records, do you want to transfer
them all over the network??!! I hop not :-) Pull out just the records you
want with the limit statement:

SELECT colum_name
FROM table_name
WHERE criteria
LIMIT 1,10

This will pull out the first 10 records http://www.mysql.com/doc

Hope this helps,

Andy



Natividad Castro [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi to all,
 I'm displaying a set of records in different pages.
 The user will be able to search by category, let say a user wants to
search
 projects that belong to 'PHP' category, so I will list all the projects
that
 belong to that category.
 My problem is: the first 10 records on the first page display without any
 problem, but when I try to go to the next page it doesn't display any
 record.
 The weird thing is that if I write my query: SELECT * FROM 150BK WHERE
 CATEGORY='PHP', I don't any problem I can see all my record and go through
 from page to page. But when I write my query requesting the name from the
 drop down menu from the search page I get just the first 10 records.
 For example, SELECT * FROM 150BK WHERE CATEGORY='$category' //here is
where
 the problem

 Any help is greatly appreciate
 Thanks in advanced
 Nato

 here is my code
 ?
 include ./connection.php;
 ?
 html
 head
 titleRecord Set Paging with Page Navigation/title
 /head
 body
 font face='verdana, arial' size=3b
 PHP/MySQL Record Set Paging with Page Navigation/bfont size=2br
 ?
 global $limit, $sql, $url, $pagesize, $pagecount, $absolutepage,
 $recordcount;

 $sql = (SELECT * from 150bk wehere category='$category');
$result = mysql_query($sql);
$record_count = mysql_num_rows($result);


 $pagesize = 10 ;
 $url = $PHP_SELF ;
 if (!isset($absolutepage)) {// Set offset and absolutepage if not set
 $absolutepage = 1;
 $offset = 0;
 }  else {
$offset = ( $absolutepage - 1 ) * $pagesize  ;
 }
 if (!isset($total_rows)) {// Get total_rows at startup
$result = mysql_query($sql);
$recordcount = ( mysql_num_rows($result) ) -1;
$pagecount = intval($recordcount / $pagesize);
if ($recordcount % $pagesize ) $pagecount++;
 }
 if ($recordcount  0) {
$sql .=  LIMIT $offset, $pagesize ;   // Get record set = pagesize
 every time
$result = mysql_query($sql);
if ($absolutepage == 1) {
 $pag1 = $absolutepage;
} else {
 $pag1 = (($absolutepage - 1) * $pagesize) + 1;
}
$pag2 = $pag1 + ($pagesize - 1);
if ($pag2  $recordcount)
 $pag2 = $recordcount;
echo hrfont face='verdana, arial' size=2;
echo Displaying records $pag1 to $pag2 (of  . $recordcount.)hr;
PagNav($pagesize, $pagecount, $absolutepage, $recordcount, $sql, $url)
;
echo hr;
$fields = mysql_num_fields($result);
  for ($i=0; $i  $pagesize; $i++) {
  while($query_data = mysql_fetch_array($result))
  {
  $id = $query_data[ID];
  $name = $query_data[NAME];
   echo $id.  | .$name.   . a href='resPNav2.php?test=$id'read
 more... . /a . br;
   echo hr;
   }
echo br\n;
}

} else {
echo No records found.;
 }
 echo /body/html;


 function PagNav($pagesize, $pagecount, $absolutepage, $recordcount, $sql,
 $url)
 {
 global $sql, $url, $pagesize, $pagecount, $absolutepage, $recordcount;
 $pad= ;
 $maxpages = $pagecount ;
 if ( ($absolutepage % 10) == 0) {
$counterstart =  $absolutepage - 9 ;
 } else {
$counterstart = $absolutepage - ($absolutepage % 10) + 1 ;
 }
 $counterend = $counterstart + 9 ;
 echo font size=1bPage .$absolutepage. of .$pagecount.: /b;
 if ($counterend  $maxpages) $counterend = $maxpages ;
 if ($counterstart != 1) {
$ref = a href=' . $url ;
$ref .= ?absolutepage= . 1 ;
$ref .= 'First/anbsp;|nbsp; ;
echo $ref ;
$ref = a href=' . $url ;
$ref .= ?absolutepage= . ($counterstart - 1) ;
$ref .= 'Prev 10 Pages/anbsp; ;
echo $ref ;
 }
 echo b[ /b ;
 for ($counter = $counterstart; $counter  $counterend +1;$counter++ ) {
 if ($counter = 10) $pad= ;
 if (! ($counter == $absolutepage)) {
$ref = a href=' . $url ;
$ref .= ?absolutepage= . $counter ;
$ref .= ' . $pad . $counter . /a ;
 } else {
$ref = b . $pad . $counter . /b ;
 }
 echo $ref ;
 if (!($counter == $counterend)) print   ;
 }
 echo b ]/b ;
 if ($counterend != $maxpages) {
 $ref = nbsp;a href=' . $url ;
 $ref .= ?absolutepage= . ($counterend + 1) ;
 $ref .= 'Next 10 Pages/a ;
 echo $ref ;
 $ref = nbsp;|nbsp;a href=' . $url ;
 $ref .= ?absolutepage= . $maxpages ;
 $ref .= 'Last/a ;
 echo $ref ;
 }
 echo /font;
 }
 ?




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




[PHP-DB] Problem with JOIN

2002-05-23 Thread andy

Hi there,

I do want to pull out some data of a user. I did normalize the tables, so
there is a table for website, comment ...

Now I would like to pull out the users website, comment.. but only if there
is one.

Unfortunatelly my select stmt returns all 5 records of the website
table:

SELECT
w.website,
c.comment,
i.icq,
s.signature
FROM
user_websites
LEFT JOIN user_comments AS c ON c.user_id = '3'
LEFT JOIN user_icq AS i ON i.user_id = '3'
LEFT JOIN user_signature AS s ON s.user_id = '3'
LEFT JOIN user_websites AS w ON w.user_id = '3'

Somehow my syntax must be wrong, but I can not find the error :-(

Maybe one of you guys does know why.

Thanx in advance,

Andy



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




[PHP-DB] Re: 50.000 records, 2 values and 1.5 s to find out?!!

2002-05-22 Thread andy

oh... on MySQL










Andy [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi there,

 I have a user table, containing a column on gender. Type is tinyint(1) and
1
 is male 2 is female. No index. 5 entries

 This statement:
 SELECT sex, count(*) AS c
 FROM user GROUP BY sex

 takes 1.5 s to execute

 I am wondering if ti wuold be possible to find this out any faster ?

 SELECT count(*) AS c
 FROM .user
 where sex = 1

 takes about half the time :-)

 So maybe some of you guys do have some experiance on that. This is just
way
 to long.

 I appreciate every help on that,

 Thanx in advance, Andy





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




[PHP-DB] indexing text fields in mysql ?

2002-05-19 Thread andy

Hi there,

I am wondering if it would be anyhow possible to make a search on a
textfield faster. Right now the table contains 294000 entries and takes
about 40 MB of space. Is there a way to apply a index with a resonable
amount of disk space? I am also not so sure if I should use text or
smalltext columns as the info may vary between 1 and 1000 chars.

Thanx for any help on that,

Andy



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




[PHP-DB] mysql crashed and created huge .MYI files. All data lost? :-((

2002-05-19 Thread andy

Hi there,

during a wrong select statement  on a table containing over 2 mill. records
(involving other tables) mysql and the whole linux server crashed.

After rebooting I did run myisamchk and this reported that some tables are
damaged but still can be read. So I did shut down the server und run
myisamchk --recover --quick *.MYI

Right now mysql is recovering a table named #sql-98a_1b.MYI which I do not
know where it comes from. I did definatelly not create this table. Recovery
is in process now for more than 30 minutes on this table and it is counting
a valueup (right now 15)

Does anybody know what happened here? I hope I do not need to role out my
backup tapes :-(

Thanx for any help,

Andy



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




[PHP-DB] problem with grant

2002-05-11 Thread andy

Hi there,

I am trying to understand the use of grant. do have some probs. Maybe
someone can give me hint..

I did try this command:
grant all privileges on *.* to [EMAIL PROTECTED] (xxx... = ip
adress)

Then I did try to connect from this remote machine to the server using this
user
The errormsg is:
Connection failed:
1045- Access denied for user:
[EMAIL PROTECTED] (using password NO)

What's wrong with my grant table statement? Or is there somehow a firewal
involved? php works with db access. I am running it on suse7.2

Thanx for your help guys

Andy



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




Re: [PHP-DB] problem with grant

2002-05-11 Thread andy

can you send me the link for the english mysql user group, please. I did
search  a while for this link on mysql.com but did not find any.

Thanx in advance,

Andy


Jason Wong [EMAIL PROTECTED] schrieb im Newsbeitrag
news:[EMAIL PROTECTED]...
 On Saturday 11 May 2002 19:19, andy wrote:
  Hi there,
 
  I am trying to understand the use of grant. do have some probs. Maybe
  someone can give me hint..
 
  I did try this command:
  grant all privileges on *.* to [EMAIL PROTECTED] (xxx... = ip
  adress)
 
  Then I did try to connect from this remote machine to the server using
this
  user
  The errormsg is:
  Connection failed:
  1045- Access denied for user:
  [EMAIL PROTECTED] (using password NO)
 
  What's wrong with my grant table statement? Or is there somehow a
firewal
  involved? php works with db access. I am running it on suse7.2

 You're better off asking on the mysql list.

 You do know that the above statement would grant privileges to /ALL/ your
 databases to the user mysqladmin connecting at xxx.xxx.xxx.xxx /WITHOUT/
 requiring the use of a password?

 After doing a grant you need to flush privileges before it will take
effect.

 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *


 /*
 Let me do my TRIBUTE to FISHNET STOCKINGS ...
 */



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




[PHP-DB] stmt should return user-id only once. difficult select statement.

2002-05-10 Thread andy

Hi there,

I have a huge statement doing a calculation and returning a userid with  a
ranking. This workes fine for one table. But due to normalisation I do have
2. table containing languages of the users. Up to 3 languages for each user.

The problem is, that I do get the same user 3 times with a different
ranking. How can I get rid of the 2 lower ones and just keep the one with
the highest ranking? I tryed around with max, but did not have any success.
If I do leave only :GROUP BY u.user_id
it returns only this user if the first language scores.So ... where to now??

Here is a sniplet of my statement:

SELECT DISTINCT
  u.userid
  if(u.country='gm',25,0) +
  if(u.age='4',25,0) +
  if(u.sex='2',25,0) +
  if(l.language_id='en',25,0)
  AS ranking

FROM
  data.user u,
  data.user_languages l,

INNER JOIN db.countries AS c ON c.country_code = u.country /* countries */
LEFT JOIN db.cities AS ct ON ct.ID = u.city /* cities */
WHERE
 u.user_id = l.user_id /* because it is a different table */
 AND u.country = 'gm'
 AND u.age = '4'
 AND u.sex = '2' /* for the mandatory fields */

GROUP BY u.user_id, l.language_id
HAVING ranking  0 /* dont return all users! */
ORDER BY ranking desc
LIMIT 0,5


Thanx for any help guys,

Andy



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




Re: [PHP-DB] stmt should return user-id only once. difficult select statement.

2002-05-10 Thread andy

unfortunatelly not. I did already try this. It does not make a difference.
Still three results for each user

do you have another idea?

thanks,

Andy

Ryan Jameson [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
This may only be preference but you've mixed join syntaxes here, it would be
easier to read if you stuck with just one.

Anyway, I think what you'll want is to max the whole expression. So, keep
the group by, but use

max (if(u.country='gm',25,0) +
 if(u.age='4',25,0) +
 if(u.sex='2',25,0) +
 if(l.language_id='en',25,0)) as ranking

that should work.

 Ryan

-

SELECT DISTINCT
  u.userid
  if(u.country='gm',25,0) +
  if(u.age='4',25,0) +
  if(u.sex='2',25,0) +
  if(l.language_id='en',25,0)
  AS ranking

FROM
  data.user u,
  data.user_languages l,

INNER JOIN db.countries AS c ON c.country_code = u.country /* countries */
LEFT JOIN db.cities AS ct ON ct.ID = u.city /* cities */
WHERE
 u.user_id = l.user_id /* because it is a different table */
 AND u.country = 'gm'
 AND u.age = '4'
 AND u.sex = '2' /* for the mandatory fields */

GROUP BY u.user_id, l.language_id
HAVING ranking  0 /* dont return all users! */
ORDER BY ranking desc
LIMIT 0,5





-Original Message-
From: andy [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 10, 2002 10:54 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] stmt should return user-id only once. difficult select
statement.


Hi there,

I have a huge statement doing a calculation and returning a userid with  a
ranking. This workes fine for one table. But due to normalisation I do have
2. table containing languages of the users. Up to 3 languages for each user.

The problem is, that I do get the same user 3 times with a different
ranking. How can I get rid of the 2 lower ones and just keep the one with
the highest ranking? I tryed around with max, but did not have any success.
If I do leave only :GROUP BY u.user_id
it returns only this user if the first language scores.So ... where to now??

Here is a sniplet of my statement:

SELECT DISTINCT
  u.userid
  if(u.country='gm',25,0) +
  if(u.age='4',25,0) +
  if(u.sex='2',25,0) +
  if(l.language_id='en',25,0)
  AS ranking

FROM
  data.user u,
  data.user_languages l,

INNER JOIN db.countries AS c ON c.country_code = u.country /* countries */
LEFT JOIN db.cities AS ct ON ct.ID = u.city /* cities */
WHERE
 u.user_id = l.user_id /* because it is a different table */
 AND u.country = 'gm'
 AND u.age = '4'
 AND u.sex = '2' /* for the mandatory fields */

GROUP BY u.user_id, l.language_id
HAVING ranking  0 /* dont return all users! */
ORDER BY ranking desc
LIMIT 0,5


Thanx for any help guys,

Andy



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




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




  1   2   >