Re: [PHP] PHP+MySQL question

2011-02-16 Thread Robert Cummings

On 11-02-16 11:37 AM, דניאל דנון wrote:

Hi.

I have a table called images with 4 columns - `image_id`, `item_name`,
`image_url`,  `image_views`
(Where image_id is UNIQUE and AUTO-INCREMENT).

Sometimes, there might be many items with the same name (but not with the
same url).

I want to make sure that each item name has at most 3 images (and
therefore I need to delete the rest).
The problem is that I want to keep the images with the most views.


I've tried to look for efficient solutions either in MySQL or in PHP, but
they are mostly very resource-intensive,
Such as selecting all different names in PHP (using GROUP BY), then, for
each name, doing DELETE FROM images WHERE item_name = 'ITEM-NAME-HERE' ORDER
BY image_views ASC LIMIT (here some sub-query with count on how many rows
have the name ITEM-NAME-HERE minus 3).


I'd be glad if anyone could help me or point me to the right direction.


I'd use a cron job to manage the purging process... and off the top of 
my head I'd probably go the following route:


Get the list of images with more than 3 of the same name:

SELECT item_name, SUM( 1 ) AS total FROM images HAVING total  3;

Get the 3 best images for each image returned above:

SELECT image_id FROM images WHERE image_name = '[[NAME]]' ORDER BY 
image_views DESC.


(Make sure to quote your criteria properly in the above-- this is pseudo 
codish).


Now delete the laggards using the ID we just retrieved:

DELETE FROM images WHERE image_id NOT IN ([[ID_LIST]]).

That should get you to a decent solution.

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



Re: [PHP] PHP+MySQL question

2011-02-16 Thread Robert Cummings



On 11-02-16 11:55 AM, Robert Cummings wrote:

On 11-02-16 11:37 AM, דניאל דנון wrote:

Hi.

I have a table called images with 4 columns - `image_id`, `item_name`,
`image_url`,  `image_views`
(Where image_id is UNIQUE and AUTO-INCREMENT).

Sometimes, there might be many items with the same name (but not with the
same url).

I want to make sure that each item name has at most 3 images (and
therefore I need to delete the rest).
The problem is that I want to keep the images with the most views.


I've tried to look for efficient solutions either in MySQL or in PHP, but
they are mostly very resource-intensive,
Such as selecting all different names in PHP (using GROUP BY), then, for
each name, doing DELETE FROM images WHERE item_name = 'ITEM-NAME-HERE' ORDER
BY image_views ASC LIMIT (here some sub-query with count on how many rows
have the name ITEM-NAME-HERE minus 3).


I'd be glad if anyone could help me or point me to the right direction.


I'd use a cron job to manage the purging process... and off the top of
my head I'd probably go the following route:

Get the list of images with more than 3 of the same name:

SELECT item_name, SUM( 1 ) AS total FROM images HAVING total  3;

Get the 3 best images for each image returned above:

SELECT image_id FROM images WHERE image_name = '[[NAME]]' ORDER BY
image_views DESC.


Oops... that should have a LIMIT clause on it:

SELECT image_id FROM images WHERE image_name = '[[NAME]]' ORDER BY 
image_views DESC LIMIT 3


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



Re: [PHP] PHP-MYSQL Question

2009-04-07 Thread HostWare Kft.

This isn't PHP but mysql question.

You didn't mention that the table itslef is created or not. If not, then it 
is probably a mysql error,

maybe your installation of mysql doesn't support INNODB.

SanTa

- Original Message - 
From: abdulazeez alugo defati...@hotmail.com

To: php-general@lists.php.net
Sent: Tuesday, April 07, 2009 3:05 PM
Subject: [PHP] PHP-MYSQL Question



Hi guys,

Please can anyone tell me what I'm doing wrong with the code below? It keep 
returning unsuccessful.




$result=mysql_query(CREATE TABLE table2(table2_id INT NOT NULL PRIMARY KEY 
AUTO_INCREMENT,

   table1_id INT NOT NULL,
name VARCHAR(100) NOT NULL,
   school VARCHAR(100) NOT NULL,
   comment TEXT NOT NULL,
   entrydate TIMESTAMP NOT NULL,
   FOREIGN KEY(table1_id) REFERENCES table1(table1_id))
   ENGINE = INNODB );

if($result){ printSuccessful;}
else {print Unsuccessful;}



Thanks in advance. Cheers.

Alugo Abdulazeez.


_
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx 



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



Re: [PHP] PHP-MYSQL Question

2009-04-07 Thread Per Jessen
abdulazeez alugo wrote:

 
 Hi guys,
 
 Please can anyone tell me what I'm doing wrong with the code below? It
 keep returning unsuccessful.
 

Why don't you print out  mysql_error() ? It'll tell you right away.

/Per


-- 
Per Jessen, Zürich (20.1°C)


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



RE: [PHP] PHP-MYSQL Question

2009-04-07 Thread abdulazeez alugo


 

 From: p...@computer.org
 Date: Tue, 7 Apr 2009 15:18:35 +0200
 To: php-general@lists.php.net
 Subject: Re: [PHP] PHP-MYSQL Question
 
 abdulazeez alugo wrote:
 
  
  Hi guys,
  
  Please can anyone tell me what I'm doing wrong with the code below? It
  keep returning unsuccessful.
  
 
 Why don't you print out mysql_error() ? It'll tell you right away.
 
 /Per
 
 
Thanks Per,

I should have thought of that. Now I owe you a beer.

Cheers.

_
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/

Re: [PHP] PHP/mySQL question using ORDER BY with logic

2008-10-23 Thread Robert Cummings
On Fri, 2008-10-24 at 00:18 -0400, Rob Gould wrote:
 Question about mySQL and PHP, when using the mySQL ORDER BY method...
 
 
   Basically I've got data coming from the database where a wine  
 producer-name is a word like:
 
   Château Bahans Haut-Brion
 
   or
 
   La Chapelle de La Mission Haut-Brion
 
   or
 
   Le Clarence de Haut-Brion
 
 but I need to ORDER BY using a varient of the string:
 
   1)  If it begins with Château, don't include Chateau in the  
 string to order by.
   2)  If it begins with La, don't order by La, unless the first  
 word is Chateau, and then go ahead and order by La.
 
 
   Example sort:  Notice how the producer as-in comes before the  
 parenthesis, but the ORDER BY actually occurs after a re-ordering of  
 the producer-string, using the above rules.
 
   Red: Château Bahans Haut-Brion (Bahans Haut-Brion, Château )
   Red: La Chapelle de La Mission Haut-Brion (Chapelle de La Mission  
 Haut-Brion, La )
   Red: Le Clarence de Haut-Brion (Clarence de Haut-Brion, Le )
   Red: Château Haut-Brion (Haut-Brion, Château )
   Red: Château La Mission Haut-Brion (La Mission Haut-Brion, Château )
   Red: Domaine de La Passion Haut Brion (La Passion Haut Brion,  
 Domaine de )
   Red: Château La Tour Haut-Brion (La Tour Haut-Brion, Château )
   Red: Château Larrivet-Haut-Brion (Larrivet-Haut-Brion, Château )
   Red: Château Les Carmes Haut-Brion (Les Carmes Haut-Brion, Château )
 
 
   That logic between mySQL and PHP, I'm just not sure how to  
 accomplish?  I think it might involve a mySQL alias-technique but I  
 could be wrong.
 
 Right now, my PHP call to generate the search is this:
 
 $query = 'SELECT * FROM wine WHERE MATCH(producer, varietal,  
 appellation, designation, region, vineyard, subregion, country,  
 vintage) AGAINST ( ' . $searchstring . ')  ORDER BY producer LIMIT  
 0,100';

Maybe there's a good way to do it with the table as is... but I'm
doubtful. I would create a second field that contains a pre-processed
version of the name that performs stripping to achieve what you want.
This could be done by a PHP script when the data is inserted into the
database, or if not possible like that, then a cron job could run once
in a while, check for entries with this field empty and generate it.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



RE: [PHP] PHP/mySQL question about groups

2008-02-07 Thread Warren Vail
You are correct, but that is what I meant by all columns (all those in the
query, and therefore subject to the distinct).  

At this point different database engines work differently, without an order
by, some will use the primary sequence, some will scan table space (in other
words, without an order by [or group by], some engines will give you a
performance hit).  It's always good practice to write your queries to help
your DB engine find an index.

Warren

 -Original Message-
 From: Andrew Ballard [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 07, 2008 7:16 AM
 To: PHP General list
 Subject: Re: [PHP] PHP/mySQL question about groups
 
 On Feb 7, 2008 1:20 AM, Warren Vail [EMAIL PROTECTED] wrote:
  I did some looking into performance issues many years ago at company
 that
  developed and marketed another database server, comparing the query plan
 to
  the actual code, and a query plan usually shows the processes that
 consume
  the major amount of time, disk I/O, index or table searches and such,
 but
  doesn't show time consumed comparing, discriminating, and totaling,
 mostly
  because they are negligible.
 
  On the other hand distinct depends on comparison of all columns and will
  have no help in reducing row counts unless accompanied by an order by
  clause, where as group by implys an orderby and can be faster if indexes
 are
  available for use in row ordering, and while the same totaling occurs,
  comparison is limited to the columns specified in the group by.
 
 Does DISTINCT really compare all columns? I would think it would only
 compare the columns explicitly included in the SELECT clause.
 
 
  The biggest impact on one or the other would be a well placed index, but
 for
  the most part they should be about the same.
 
  Warren Vail
 
 
 I have seen discussions where in GROUP BY can be faster than DISTINCT
 depending on whether the query uses things like correlated subqueries,
 but this is not applicable in the current case. At any rate, I don't
 want to stray the conversation any further away than I already have.
 
 Andrew
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

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



Re: [PHP] PHP/mySQL question about groups

2008-02-07 Thread Andrew Ballard
On Feb 7, 2008 1:20 AM, Warren Vail [EMAIL PROTECTED] wrote:
 I did some looking into performance issues many years ago at company that
 developed and marketed another database server, comparing the query plan to
 the actual code, and a query plan usually shows the processes that consume
 the major amount of time, disk I/O, index or table searches and such, but
 doesn't show time consumed comparing, discriminating, and totaling, mostly
 because they are negligible.

 On the other hand distinct depends on comparison of all columns and will
 have no help in reducing row counts unless accompanied by an order by
 clause, where as group by implys an orderby and can be faster if indexes are
 available for use in row ordering, and while the same totaling occurs,
 comparison is limited to the columns specified in the group by.

Does DISTINCT really compare all columns? I would think it would only
compare the columns explicitly included in the SELECT clause.


 The biggest impact on one or the other would be a well placed index, but for
 the most part they should be about the same.

 Warren Vail


I have seen discussions where in GROUP BY can be faster than DISTINCT
depending on whether the query uses things like correlated subqueries,
but this is not applicable in the current case. At any rate, I don't
want to stray the conversation any further away than I already have.

Andrew

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



Re: [PHP] PHP/mySQL question about groups

2008-02-06 Thread Nathan Nobbe
On Feb 6, 2008 8:46 PM, Rob Gould [EMAIL PROTECTED] wrote:

 Let's say I have a PHP-based wine application, and it's taking a set of
 mySQL data that looks like this:

 wineidname
 size
 123 Silver Oak
 750ML
 123 Silver Oak
  1.5L
 123 Silver Oak
  1.5L
 456 Liberty School
 750ML
 456 Liberty School
 750ML
 456 Liberty School
 750ML
 456 Liberty School
 1.5L


i think you can just do

group by wineid, size

-nathan


RE: [PHP] PHP/mySQL question about groups

2008-02-06 Thread Bastien Koert

Select * from wine where name = 'Silver Oak' GROUP BY wineid,size
 
 
bastien Date: Wed, 6 Feb 2008 17:46:52 -0800 From: [EMAIL PROTECTED] To: 
php-general@lists.php.net Subject: [PHP] PHP/mySQL question about groups  
Let's say I have a PHP-based wine application, and it's taking a set of mySQL 
data that looks like this:  wineid name size  123 Silver Oak 750ML 123 
Silver Oak 1.5L 123 Silver Oak 1.5L 456 Liberty School 750ML 456 Liberty 
School 750ML 456 Liberty School 750ML 456 Liberty School 1.5L   If I do 
a:  Select * from wine where name = 'Silver Oak' GROUP BY 'wineid'  I'd 
get:  Silver Oak   However, what I'd REALLY like to return is:  Silver 
Oak 750ML Silver Oak 1.5L  I'd like the groupby to group by wineid, BUT ALSO 
separate the groups by 'size'. So there'd be a '750ML' group, and a '1.5L' 
group  Can anyone tell me how I'd do that? I'm hoping I don't have to write a 
PHP script that loops through the results and separates things manually.  -- 
 PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: 
http://www.php.net/unsub.php 
_



Re: [PHP] PHP/mySQL question about groups

2008-02-06 Thread Andrew Ballard
On Feb 6, 2008 8:46 PM, Rob Gould [EMAIL PROTECTED] wrote:
 Let's say I have a PHP-based wine application, and it's taking a set of mySQL 
 data that looks like this:

 wineidname 
 size
 123 Silver Oak 
 750ML
 123 Silver Oak  
 1.5L
 123 Silver Oak  
 1.5L
 456 Liberty School   750ML
 456 Liberty School   750ML
 456 Liberty School   750ML
 456 Liberty School   1.5L


 If I do a:

 Select * from wine where name = 'Silver Oak' GROUP BY 'wineid'

 I'd get:

 Silver Oak


 However, what I'd REALLY like to return is:

 Silver Oak   750ML
 Silver Oak   1.5L

 I'd like the groupby to group by wineid, BUT ALSO separate the groups by 
 'size'.  So there'd be a '750ML' group, and a '1.5L' group

 Can anyone tell me how I'd do that?  I'm hoping I don't have to write a PHP 
 script that loops through the results and separates things manually.


That's something MySQL will allow that IMO it should not. Being able
to use SELECT * and GROUP BY at the same time can create confusion as
it did here. The other suggestions would probably work, but a good
rule of thumb is not to use any columns in the SELECT clause unless
they are either included in the GROUP BY clause or else use one of the
aggregate functions like COUNT, SUM, AVG, etc. (I'm not sure of the
actual SQL standard on this point, but SQL Server insists on it.)

SELECT  name, size
FROMwine
GROUP BY name, size

Of course, in this case you could just avoid all the confusion with
this statement as well:

SELECT DISTINCT name, size
FROMwine

Andrew

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



Re: [PHP] PHP/mySQL question about groups

2008-02-06 Thread Nathan Nobbe
On Feb 6, 2008 10:59 PM, Andrew Ballard [EMAIL PROTECTED] wrote:

 Of course, in this case you could just avoid all the confusion with
 this statement as well:

 SELECT DISTINCT name, size
 FROMwine


im not sure why, but i think distinct is typically way slower than group by.

-nathan


Re: [PHP] PHP/mySQL question about groups

2008-02-06 Thread Andrew Ballard
On Feb 6, 2008 11:20 PM, Nathan Nobbe [EMAIL PROTECTED] wrote:
 On Feb 6, 2008 10:59 PM, Andrew Ballard [EMAIL PROTECTED] wrote:

  Of course, in this case you could just avoid all the confusion with
  this statement as well:
 
  SELECT DISTINCT name, size
  FROMwine

 im not sure why, but i think distinct is typically way slower than group by.

 -nathan


I can't really say for MySQL, but in my experience I'd say it
depends. It seems to me that for this case they should be about the
same, as it's always been my thinking that GROUP BY did a DISTINCT
implicitly. However, I don't really know the internals of any DB
platform so I can't confirm that. I ran DESCRIBE on a couple different
tables, and they both return the same plan. I don't see any notable
difference in the queries either. However, I'll leave it to the OP to
test and see if one is better for his question.

Andrew

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



RE: [PHP] PHP/mySQL question about groups

2008-02-06 Thread Warren Vail
I did some looking into performance issues many years ago at company that
developed and marketed another database server, comparing the query plan to
the actual code, and a query plan usually shows the processes that consume
the major amount of time, disk I/O, index or table searches and such, but
doesn't show time consumed comparing, discriminating, and totaling, mostly
because they are negligible.

On the other hand distinct depends on comparison of all columns and will
have no help in reducing row counts unless accompanied by an order by
clause, where as group by implys an orderby and can be faster if indexes are
available for use in row ordering, and while the same totaling occurs,
comparison is limited to the columns specified in the group by.

The biggest impact on one or the other would be a well placed index, but for
the most part they should be about the same.

Warren Vail

-Original Message-
From: Andrew Ballard [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 06, 2008 8:41 PM
To: PHP General list
Subject: Re: [PHP] PHP/mySQL question about groups

On Feb 6, 2008 11:20 PM, Nathan Nobbe [EMAIL PROTECTED] wrote:
 On Feb 6, 2008 10:59 PM, Andrew Ballard [EMAIL PROTECTED] wrote:

  Of course, in this case you could just avoid all the confusion with 
  this statement as well:
 
  SELECT DISTINCT name, size
  FROMwine

 im not sure why, but i think distinct is typically way slower than group
by.

 -nathan


I can't really say for MySQL, but in my experience I'd say it depends. It
seems to me that for this case they should be about the same, as it's always
been my thinking that GROUP BY did a DISTINCT implicitly. However, I don't
really know the internals of any DB platform so I can't confirm that. I ran
DESCRIBE on a couple different tables, and they both return the same plan. I
don't see any notable difference in the queries either. However, I'll leave
it to the OP to test and see if one is better for his question.

Andrew

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

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



Re: [PHP] php - mysql question

2006-10-15 Thread Chris

Dave Goodchild wrote:

Hi all. I am writing a web app with a mysql back end and there is every
chance one of the tables may have to handle 56+ million records. I am no
mysql expert but has anyone else here ever handled that volume of data, and
if so, any suggestions or caveats? The tables will of course be correctly
indexed and the database normalised.


There's no reason why it can't but the mysql list will be better to ask 
(because they could tell you what to do.. eg how much memory, what disks 
you should look to get etc to get decent performance).


Even with indexes and normalized data (which in some cases makes 
performance worse with all the joins you have to do) you'll need to 
tweak your server / settings to get something resembling reasonable 
performance.


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

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



RE: [PHP] PHP/MySQL question

2006-06-05 Thread Jay Blanchard
[snip]
I need to do an OR search on three columns, and AND the rest, anyone
have a good way to do this?  So far my searching on the MySQL lists have
been fruitless more then anything, and I figured we've probably come
across this ourselves at some point.
[/snip]

More of a MySQL question, but easily enough answered;

Always group the OR with parenthese and the AND individually. Write the
query and test with MySQL before placing into PHP code;

SELECT * FROM `table`
WHERE (`foo` = 'bar' 
   OR `foo` = 'glorp'
   OR `sqirk` = 'glorp')
AND `today` = CURDATE()
AND `userID` = 'Marvin'

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



Re: [PHP] PHP/MySQL question

2006-06-05 Thread Richard Lynch
On Mon, June 5, 2006 10:32 am, Wolf wrote:
 I have a php form that pulls data from the database (hence the
 problems)

 I need to do an OR search on three columns, and AND the rest, anyone
 have a good way to do this?  So far my searching on the MySQL lists
 have
 been fruitless more then anything, and I figured we've probably come
 across this ourselves at some point.

 Here's the code I have so far:

I'm confused just by the indenting (or lack thereof) but one standard
technique is to start off with a yeast such as:

$query = select * from honorclub ; //Fix * to be actual columns!
$query .=  WHERE 1 ;
if ($dead !=  ...){
  $query .=  AND Deceased = 'N' ;
}
$query .=  AND (First_name like '%$name%' or Last_name like '%$name%'
) ;

 $query = select * from honorclub;
 if ($dead !=  || $unknown !=  || $name !=  || $county !=  ||
 $year !=  || $countynow !=  || $state != )
 {$query .=  WHERE ;}
 if ($dead == )
 {$query .=  `Deceased`='N' AND;}
 if ($unknown == )
 {$query .=  `USPS_Unknown`='N' AND ;}
 if ($name != )
 {$query .=  `Last_Name` like '$name%' AND ;}
 if ($county != )
 {$query .=  `County` like '$county' AND ;}
 if ($year != )
 {$query .=  `Year_Tapped` like '$year' AND ;}
 if ($countynow != )
 {$query .=  `County_Now` like '$countynow' AND ;}
 if ($state != )
 {$query .=  `State_Now` like '$state' AND ;}
 $query = rtrim($query, AND);
 $query .=  order by $order_by;

 What needs to be 'OR' is the $name section to be:
 $query .= `Last_Name` like '%$name%' OR `First_Name` like '%$name%'
 OR
 `Maiden_Name` like '%$name%';

 Thanks,
 Wolf

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




-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP/MySQL question

2006-06-05 Thread Wolf
Thanks guys, I knew it was a stupid Q when I sent it, but I had another
one where I encapsulated them in () blow up on me, so I figured if I
asked and it was the same answer then I was on the right track.

And so far all the tests have shown positive.  :)

Wolf


 More of a MySQL question, but easily enough answered;
 
 Always group the OR with parenthese and the AND individually. Write the
 query and test with MySQL before placing into PHP code;
 
 SELECT * FROM `table`
 WHERE (`foo` = 'bar' 
OR `foo` = 'glorp'
OR `sqirk` = 'glorp')
 AND `today` = CURDATE()
 AND `userID` = 'Marvin'
 

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



RE: [PHP] php mySql question

2005-07-27 Thread Shaw, Chris - Accenture

Have you tried doing a search for the text php5 in the php.ini file that
sits in your c:\windows folder?

C.

-Original Message-
From: Ned Kotter [mailto:[EMAIL PROTECTED]
Sent: 26 July 2005 04:03
To: php-general@lists.php.net
Subject: [PHP] php mySql question


I have installed php 5.0.4 on my windows 2000, IIS 6.0 server.  PHP works but
when I try to connect to MySQL I get the Fatal error: Call to undefined
function mysql_connect().  I have uncommented the line in the php.ini file
that says 'extension=php_mysql.dll'.  I have path variables set for both
c:\php and c:\php\ext.  One very peculiar thing that I noticed when I ran
phpinfo() is that it shows the extension_dir is set to c:\php5 even though in
my php.ini file it is set to c:\php.  I have a feeling that this is where the
problem exists.  Any advice would be appreciated.

Thanks,
NK


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com




This message has been delivered to the Internet by the Revenue Internet e-mail 
service

*

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



Re: [PHP] php mySql question

2005-07-27 Thread Mark Rees
Yes, it is quite possible that you have more than one php.ini file. Check
this and delete as appropriate.
Shaw, Chris - Accenture [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
...

Have you tried doing a search for the text php5 in the php.ini file that
sits in your c:\windows folder?

C.

-Original Message-
From: Ned Kotter [mailto:[EMAIL PROTECTED]
Sent: 26 July 2005 04:03
To: php-general@lists.php.net
Subject: [PHP] php mySql question


I have installed php 5.0.4 on my windows 2000, IIS 6.0 server.  PHP works
but
when I try to connect to MySQL I get the Fatal error: Call to undefined
function mysql_connect().  I have uncommented the line in the php.ini file
that says 'extension=php_mysql.dll'.  I have path variables set for both
c:\php and c:\php\ext.  One very peculiar thing that I noticed when I ran
phpinfo() is that it shows the extension_dir is set to c:\php5 even though
in
my php.ini file it is set to c:\php.  I have a feeling that this is where
the
problem exists.  Any advice would be appreciated.

Thanks,
NK


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com




This message has been delivered to the Internet by the Revenue Internet
e-mail service

*

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



Re: [PHP] php mySql question

2005-07-27 Thread John Nichel

Ned Kotter wrote:

I have installed php 5.0.4 on my windows 2000, IIS 6.0 server.  PHP works but 
when I try to connect to MySQL I get the Fatal error: Call to undefined 
function mysql_connect().  I have uncommented the line in the php.ini file that 
says 'extension=php_mysql.dll'.  I have path variables set for both c:\php and 
c:\php\ext.  One very peculiar thing that I noticed when I ran phpinfo() is 
that it shows the extension_dir is set to c:\php5 even though in my php.ini 
file it is set to c:\php.  I have a feeling that this is where the problem 
exists.  Any advice would be appreciated.


Look at your phpinfo page and make sure it's reading the ini file that 
you think it is.


--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] php-mysql question

2001-10-28 Thread David Robley

On Fri, 26 Oct 2001 23:27, Gerard Onorato wrote:
 Hello,

 I am a recent return to the list. Wow has the traffic grown! This is
 awesome.

 I have a couple of questions and one may be a RTFM but I can't find the
 answer.

 #1) While I thought I was extremely familiar with the MYSQL functions
 available in PHP I found on e in a code snippet that I have not used
 before and can't find. It is simply MYSQL(dbname, querystring). On a
 *nix box with Apache it is returning a resource ID but on a w2k box
 with apache (or iss) it is returning nothing at all. It does execute
 the query however. Any ideas or any pointer as to where I can actually
 find this function would be appreciated! Thanks.

An older version of the docs here shows that mysql is available for 
downwards compatibility, from mysql_db_query, which is deprecated since 
4.06. Changing to mysql_query is recommended.

 #2) Does anyone know of a convention / conference which will have any
 PHP coverage in the North East?

Northeast of where :-)

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   I tripped over the lamp plug, Tom said cordially.

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




RE: [PHP] PHP/MySQL Question

2001-03-10 Thread Rick St Jean

That is database specific  no standard SQL.

To make it non specific.
you can put it in a for loop.  remember to check for eof.

Rick



At 06:01 PM 3/10/01 -0600, you wrote:
Select * from table limit 5;

http://www.calevans.com


-Original Message-
From: Kath [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 10, 2001 6:01 PM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP/MySQL Question


Having some problems with syntax.

If I wanted to SELECT only 5 instances of something from a database and
order it by datetime, how would I do that?

- Kath


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

##
#  Rick St Jean,
#  [EMAIL PROTECTED]
#  President of Design Shark,
#  http://www.designshark.com/
#  Quick Contact:  http://www.designshark.com/messaging.ihtml
#  Tel: 905-684-2952
##


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




Re: [PHP] PHP/MySQL question

2001-01-29 Thread Johannes Janson

reset($array), if this is what you need.
this resets (who would have thought it?) the internal pointer back to the
first
position.


""Julia A . Case"" [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Is it possible to move through an array that is returned as a recordset
 and then move back to the beginning of the array.

 Julia

 --
 [  Julia Anne Case  ] [Ships are safe inside the harbor,   ]
 [Programmer at large] [  but is that what ships are really for.]
 [   Admining Linux  ] [   To thine own self be true.   ]
 [ Windows/WindowsNT ] [ Fair is where you take your cows to be judged. ]


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




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




RE: [PHP] PHP/MySQL question

2001-01-29 Thread Joe Sheble (Wizaerd)

// loops through the entire recordset
while( $qrResults = mysql_fetch_array( $rQuery )) {
print( $qrResults["SomeField"]
}

// reset the recordpointer to the first record
mysql_data_seek( $rQuery, 0 );

Joseph E. Sheble
a.k.a. Wizaerd
Wizaerd's Realm
Canvas, 3D, Graphics,
ColdFusion, PHP, and mySQL
http://www.wizaerd.com
=

 -Original Message-
 From: Julia A . Case [mailto:[EMAIL PROTECTED]]
 Sent: Monday, January 29, 2001 4:15 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] PHP/MySQL question


 Is it possible to move through an array that is returned as a recordset
 and then move back to the beginning of the array.

 Julia

 --
 [  Julia Anne Case  ] [Ships are safe inside the harbor,   ]
 [Programmer at large] [  but is that what ships are really for.]
 [   Admining Linux  ] [   To thine own self be true.   ]
 [ Windows/WindowsNT ] [ Fair is where you take your cows to be judged. ]


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





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