[PHP] PHP Udate MySQL command

2010-06-04 Thread Gary
I am trying to get an update command to work in PHP.  I am able to update 
records going directly to phpmyadmin command line. I have even let it 
produce the php code to insert, but have not been able to get it to work.

I have it stripped down to one command hoping to get it to work then 
replicate entire forms for clients to use direct.I get no error codes, I 
only get my message It did not enter into DB;

Anyone see where I am going wrong?

Gary

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
head
meta http-equiv=Content-Type content=text/html; charset=utf-8 /
titleUntitled Document/title
/head

body
form action=?php echo $_SERVER['PHP_SELF']; ? method=post
testinput name=test type=text /
input name=submit type=submit value=submit /
/form

?php


$batchconnetion = mysql_connect(host, 'un', 'pw', 'db')//sanatized for board
or die('Error connecting with MySQL Database');

$test=$_POST['test'];

//$sql=update contact set type = \'$test\' where item_id = \'164\'; //this 
is the code created by phpmyadmin

 $sql = INSERT INTO contact  comments, VALUES = $test WHERE contact_id = 
33;

mysql_query($sql,$batchconnetion);

$result = mysql_query($sql,$batchconnetion);

if($result == true) {
   echo Successfully Inserted Records;
   } else {
   echo It did not enter into DB;
}

mysql_close($batchconnetion);

?


/body
/html 



__ Information from ESET Smart Security, version of virus signature 
database 5171 (20100604) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] PHP Udate MySQL command

2010-06-04 Thread Ashley Sheridan
On Fri, 2010-06-04 at 06:46 -0400, Gary wrote:

 I am trying to get an update command to work in PHP.  I am able to update 
 records going directly to phpmyadmin command line. I have even let it 
 produce the php code to insert, but have not been able to get it to work.
 
 I have it stripped down to one command hoping to get it to work then 
 replicate entire forms for clients to use direct.I get no error codes, I 
 only get my message It did not enter into DB;
 
 Anyone see where I am going wrong?
 
 Gary
 
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 html xmlns=http://www.w3.org/1999/xhtml;
 head
 meta http-equiv=Content-Type content=text/html; charset=utf-8 /
 titleUntitled Document/title
 /head
 
 body
 form action=?php echo $_SERVER['PHP_SELF']; ? method=post
 testinput name=test type=text /
 input name=submit type=submit value=submit /
 /form
 
 ?php
 
 
 $batchconnetion = mysql_connect(host, 'un', 'pw', 'db')//sanatized for board
 or die('Error connecting with MySQL Database');
 
 $test=$_POST['test'];
 
 //$sql=update contact set type = \'$test\' where item_id = \'164\'; //this 
 is the code created by phpmyadmin
 
  $sql = INSERT INTO contact  comments, VALUES = $test WHERE contact_id = 
 33;
 
 mysql_query($sql,$batchconnetion);
 
 $result = mysql_query($sql,$batchconnetion);
 
 if($result == true) {
echo Successfully Inserted Records;
} else {
echo It did not enter into DB;
 }
 
 mysql_close($batchconnetion);
 
 ?
 
 
 /body
 /html 
 
 
 
 __ Information from ESET Smart Security, version of virus signature 
 database 5171 (20100604) __
 
 The message was checked by ESET Smart Security.
 
 http://www.eset.com
 
 
 
 
 

Your problem is the way you're trying to connect to the DB:

$batchconnetion = mysql_connect(host, 'un', 'pw', 'db')//sanatized for
board
or die('Error connecting with MySQL Database');

The 4th argument to this function isn't a database name, it's a boolean
value for whether PHP should create a new link or reuse the old one. You
have to use the mysql_select_db() function to select the database to use
on that connection in order for your queries to run the way you have
them.

There does seem to be a bit of an inconsistency with the way you're
using quotation marks on your query strings as well. Your first
commented out query is escaping the single quotes within a double quoted
string (which isn't necessary), you've omitted the single quotes on your
insert line, and then on your amended email you've omitted the double
quotes. If this is your actual code and not a mistake made when copying
it into an email, then it would also be a second reason why things
aren't working as expected even once you get PHP to connect properly.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] PHP Udate MySQL command

2010-06-04 Thread Gary

Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
news:1275649100.2217.45.ca...@localhost...
 On Fri, 2010-06-04 at 06:46 -0400, Gary wrote:

 I am trying to get an update command to work in PHP.  I am able to update
 records going directly to phpmyadmin command line. I have even let it
 produce the php code to insert, but have not been able to get it to work.

 I have it stripped down to one command hoping to get it to work then
 replicate entire forms for clients to use direct.I get no error codes, I
 only get my message It did not enter into DB;

 Anyone see where I am going wrong?

 Gary

 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 html xmlns=http://www.w3.org/1999/xhtml;
 head
 meta http-equiv=Content-Type content=text/html; charset=utf-8 /
 titleUntitled Document/title
 /head

 body
 form action=?php echo $_SERVER['PHP_SELF']; ? method=post
 testinput name=test type=text /
 input name=submit type=submit value=submit /
 /form

 ?php


 $batchconnetion = mysql_connect(host, 'un', 'pw', 'db')//sanatized for 
 board
 or die('Error connecting with MySQL Database');

 $test=$_POST['test'];

 //$sql=update contact set type = \'$test\' where item_id = \'164\'; 
 //this
 is the code created by phpmyadmin

  $sql = INSERT INTO contact  comments, VALUES = $test WHERE contact_id =
 33;

 mysql_query($sql,$batchconnetion);

 $result = mysql_query($sql,$batchconnetion);

 if($result == true) {
echo Successfully Inserted Records;
} else {
echo It did not enter into DB;
 }

 mysql_close($batchconnetion);

 ?


 /body
 /html



 __ Information from ESET Smart Security, version of virus 
 signature database 5171 (20100604) __

 The message was checked by ESET Smart Security.

 http://www.eset.com






 Your problem is the way you're trying to connect to the DB:

 $batchconnetion = mysql_connect(host, 'un', 'pw', 'db')//sanatized for
 board
 or die('Error connecting with MySQL Database');

 The 4th argument to this function isn't a database name, it's a boolean
 value for whether PHP should create a new link or reuse the old one. You
 have to use the mysql_select_db() function to select the database to use
 on that connection in order for your queries to run the way you have
 them.

 There does seem to be a bit of an inconsistency with the way you're
 using quotation marks on your query strings as well. Your first
 commented out query is escaping the single quotes within a double quoted
 string (which isn't necessary), you've omitted the single quotes on your
 insert line, and then on your amended email you've omitted the double
 quotes. If this is your actual code and not a mistake made when copying
 it into an email, then it would also be a second reason why things
 aren't working as expected even once you get PHP to connect properly.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk





 __ Information from ESET Smart Security, version of virus 
 signature database 5171 (20100604) __

 The message was checked by ESET Smart Security.

 http://www.eset.com



Ashley

Thank you for your quick reply.

The $batchconnection works fine in numerous other files (the insert files) 
and is a c/p from one of those files. The db noted in my post was just to 
specify that the name of the database at this point, I thought it was a 
standard practice.  I will try your suggestion.

I will admit that I dont have the full grasp of the quotes, single or 
double.  Typically in a mysql command I start with a , however if I get a 
script that is not working, I will try to resolve the issue with switching 
up the singles with the doubles as well and adding parenthsis.

The mistake in the copying the code was I was trying to see if the insert 
command would work in place of the update.it did not..

Aside from that, do you see a problem with my update commands?

Thanks for your help.

gary




__ Information from ESET Smart Security, version of virus signature 
database 5171 (20100604) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] PHP Udate MySQL command Success

2010-06-04 Thread Gary

Gary gwp...@ptd.net wrote in message 
news:a9.ea.07323.381e8...@pb1.pair.com...

 Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
 news:1275649100.2217.45.ca...@localhost...
 On Fri, 2010-06-04 at 06:46 -0400, Gary wrote:

 I am trying to get an update command to work in PHP.  I am able to 
 update
 records going directly to phpmyadmin command line. I have even let it
 produce the php code to insert, but have not been able to get it to 
 work.

 I have it stripped down to one command hoping to get it to work then
 replicate entire forms for clients to use direct.I get no error codes, I
 only get my message It did not enter into DB;

 Anyone see where I am going wrong?

 Gary

 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 html xmlns=http://www.w3.org/1999/xhtml;
 head
 meta http-equiv=Content-Type content=text/html; charset=utf-8 /
 titleUntitled Document/title
 /head

 body
 form action=?php echo $_SERVER['PHP_SELF']; ? method=post
 testinput name=test type=text /
 input name=submit type=submit value=submit /
 /form

 ?php


 $batchconnetion = mysql_connect(host, 'un', 'pw', 'db')//sanatized for 
 board
 or die('Error connecting with MySQL Database');

 $test=$_POST['test'];

 //$sql=update contact set type = \'$test\' where item_id = \'164\'; 
 //this
 is the code created by phpmyadmin

  $sql = INSERT INTO contact  comments, VALUES = $test WHERE contact_id 
 =
 33;

 mysql_query($sql,$batchconnetion);

 $result = mysql_query($sql,$batchconnetion);

 if($result == true) {
echo Successfully Inserted Records;
} else {
echo It did not enter into DB;
 }

 mysql_close($batchconnetion);

 ?


 /body
 /html



 __ Information from ESET Smart Security, version of virus 
 signature database 5171 (20100604) __

 The message was checked by ESET Smart Security.

 http://www.eset.com






 Your problem is the way you're trying to connect to the DB:

 $batchconnetion = mysql_connect(host, 'un', 'pw', 'db')//sanatized for
 board
 or die('Error connecting with MySQL Database');

 The 4th argument to this function isn't a database name, it's a boolean
 value for whether PHP should create a new link or reuse the old one. You
 have to use the mysql_select_db() function to select the database to use
 on that connection in order for your queries to run the way you have
 them.

 There does seem to be a bit of an inconsistency with the way you're
 using quotation marks on your query strings as well. Your first
 commented out query is escaping the single quotes within a double quoted
 string (which isn't necessary), you've omitted the single quotes on your
 insert line, and then on your amended email you've omitted the double
 quotes. If this is your actual code and not a mistake made when copying
 it into an email, then it would also be a second reason why things
 aren't working as expected even once you get PHP to connect properly.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk





 __ Information from ESET Smart Security, version of virus 
 signature database 5171 (20100604) __

 The message was checked by ESET Smart Security.

 http://www.eset.com



 Ashley

 Thank you for your quick reply.

 The $batchconnection works fine in numerous other files (the insert files) 
 and is a c/p from one of those files. The db noted in my post was just to 
 specify that the name of the database at this point, I thought it was a 
 standard practice.  I will try your suggestion.

 I will admit that I dont have the full grasp of the quotes, single or 
 double.  Typically in a mysql command I start with a , however if I get a 
 script that is not working, I will try to resolve the issue with switching 
 up the singles with the doubles as well and adding parenthsis.

 The mistake in the copying the code was I was trying to see if the insert 
 command would work in place of the update.it did not..

 Aside from that, do you see a problem with my update commands?

 Thanks for your help.

 gary




 __ Information from ESET Smart Security, version of virus 
 signature database 5171 (20100604) __

 The message was checked by ESET Smart Security.

 http://www.eset.com





Ashley

Thanks for your input, I think what corrected the problem was I added single
qoutes to the $test variable.

I did also change to your suggestion.

The working code is

body
form action=?php echo $_SERVER['PHP_SELF']; ? method=post
testinput name=test type=text /
input name=submit type=submit value=submit /
/form

?php


$batchconnetion = mysql_connect(sanatized)
or die('Error connecting with MySQL Database');
mysql_select_db('sanatized', $batchconnetion)or die('Error connecting with
MySQL Database2');;
$test=$_POST['test'];

//$sql=update contact set type = \'$test\' where item_id = \'164\';

 $sql = UPDATE contact  SET comments = '$test' WHERE contact_id = 33;

mysql_query($sql,$batchconnetion);


$result = 

[PHP] PHP and MySQL SELECT COUNT (*)

2008-09-17 Thread Vinny Gullotta
What I want to do is find the top 10 servers where the column steps = 
iisreset. The following code works great except that the page is not 
displaying the servername in the 'Server Name' column of my results (nothing 
appears, the column is just blank).


servername and steps are the important columns in the database table. 
$_POST[time1] and $_POST[time2] come from a form submitted.


When I copy and paste the entire select statement into the SQL tab in 
phpmyadmin (and replace the time variables with actual times corresponding 
to the timestamp column), it displays the correct results including 
servername. Everything works in the php page's results except for the 
servername. I feel like it's right in front of my face and that's why I 
can't see it lol. Any help would be greatly appreciated. Thanks in advance 
=)


My code...

$query = SELECT servername, COUNT(steps) FROM monitoring WHERE steps LIKE 
'iisreset' AND timestamp = '$_POST[time2]' AND timestamp = '$_POST[time1]' 
GROUP BY servername ORDER BY COUNT(*) DESC LIMIT 10;

$result = mysql_query($query) or die(mysql_error());

# display column titles
echo centertable class='table'tr;
echo td class='tableHeader'centersmallbCount/b/small/td;
echo td class='tableHeader'centersmallbServer 
Name/b/small/td;

echo /tr;

#display results
while($i = mysql_fetch_row($result))
{
echo trtdsmallcenter, $i[COUNT('steps')], 
/center/small/td;

echo tdsmallcenter, $i[servername] ,/center/small/td/tr;
}
echo /table/centerbr; 



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



Re: [PHP] PHP and MySQL SELECT COUNT (*)

2008-09-17 Thread Dan Joseph
On Wed, Sep 17, 2008 at 2:17 PM, Vinny Gullotta [EMAIL PROTECTED]wrote:

 What I want to do is find the top 10 servers where the column steps =
 iisreset. The following code works great except that the page is not
 displaying the servername in the 'Server Name' column of my results (nothing
 appears, the column is just blank).

 servername and steps are the important columns in the database table.
 $_POST[time1] and $_POST[time2] come from a form submitted.

 When I copy and paste the entire select statement into the SQL tab in
 phpmyadmin (and replace the time variables with actual times corresponding
 to the timestamp column), it displays the correct results including
 servername. Everything works in the php page's results except for the
 servername. I feel like it's right in front of my face and that's why I
 can't see it lol. Any help would be greatly appreciated. Thanks in advance
 =)

 My code...

 $query = SELECT servername, COUNT(steps) FROM monitoring WHERE steps LIKE
 'iisreset' AND timestamp = '$_POST[time2]' AND timestamp = '$_POST[time1]'
 GROUP BY servername ORDER BY COUNT(*) DESC LIMIT 10;
 $result = mysql_query($query) or die(mysql_error());

 # display column titles
 echo centertable class='table'tr;
 echo td class='tableHeader'centersmallbCount/b/small/td;
 echo td class='tableHeader'centersmallbServer
 Name/b/small/td;
 echo /tr;

 #display results
 while($i = mysql_fetch_row($result))
 {
 echo trtdsmallcenter, $i[COUNT('steps')],
 /center/small/td;
 echo tdsmallcenter, $i[servername] ,/center/small/td/tr;
 }
 echo /table/centerbr;

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


Change that COUNT(steps) to COUNT(steps) AS CountSteps, that might be
the issue.  Then you're using $i['CountSteps'].  That seems a bit more
normal looking to me atleast.

Also, try echoing out your query on the screen to see that its formating
properly in the PHP code.  You may have something wrong in there, although I
don't see any off hand.

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.


Re: [PHP] PHP and MySQL SELECT COUNT (*)

2008-09-17 Thread Vinny Gullotta
Dan Joseph [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
On Wed, Sep 17, 2008 at 2:17 PM, Vinny Gullotta 
[EMAIL PROTECTED]wrote:



What I want to do is find the top 10 servers where the column steps =
iisreset. The following code works great except that the page is not
displaying the servername in the 'Server Name' column of my results 
(nothing

appears, the column is just blank).

servername and steps are the important columns in the database table.
$_POST[time1] and $_POST[time2] come from a form submitted.

When I copy and paste the entire select statement into the SQL tab in
phpmyadmin (and replace the time variables with actual times 
corresponding

to the timestamp column), it displays the correct results including
servername. Everything works in the php page's results except for the
servername. I feel like it's right in front of my face and that's why I
can't see it lol. Any help would be greatly appreciated. Thanks in 
advance

=)

My code...

$query = SELECT servername, COUNT(steps) FROM monitoring WHERE steps 
LIKE
'iisreset' AND timestamp = '$_POST[time2]' AND timestamp = 
'$_POST[time1]'

GROUP BY servername ORDER BY COUNT(*) DESC LIMIT 10;
$result = mysql_query($query) or die(mysql_error());

# display column titles
echo centertable class='table'tr;
echo td class='tableHeader'centersmallbCount/b/small/td;
echo td class='tableHeader'centersmallbServer
Name/b/small/td;
echo /tr;

#display results
while($i = mysql_fetch_row($result))
{
echo trtdsmallcenter, $i[COUNT('steps')],
/center/small/td;
echo tdsmallcenter, $i[servername] 
,/center/small/td/tr;

}
echo /table/centerbr;

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



Change that COUNT(steps) to COUNT(steps) AS CountSteps, that might be
the issue.  Then you're using $i['CountSteps'].  That seems a bit more
normal looking to me atleast.

Also, try echoing out your query on the screen to see that its formating
properly in the PHP code.  You may have something wrong in there, although 
I

don't see any off hand.

--
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.




Adding as CountSteps $i['CountSteps'] still leaves the column blank.

echo $result; gives me an output of:
Resource id #3

and

echo $query;

just gives me an error.

One thing I don't understand is why echo $result; gives me Resource id #3 as 
an output. What does that mean? 



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



Re: [PHP] PHP and MySQL SELECT COUNT (*)

2008-09-17 Thread Dan Joseph
On Wed, Sep 17, 2008 at 2:30 PM, Vinny Gullotta [EMAIL PROTECTED]wrote:

 Dan Joseph [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]

  On Wed, Sep 17, 2008 at 2:17 PM, Vinny Gullotta [EMAIL PROTECTED]
 wrote:

  What I want to do is find the top 10 servers where the column steps =
 iisreset. The following code works great except that the page is not
 displaying the servername in the 'Server Name' column of my results
 (nothing
 appears, the column is just blank).

 servername and steps are the important columns in the database table.
 $_POST[time1] and $_POST[time2] come from a form submitted.

 When I copy and paste the entire select statement into the SQL tab in
 phpmyadmin (and replace the time variables with actual times
 corresponding
 to the timestamp column), it displays the correct results including
 servername. Everything works in the php page's results except for the
 servername. I feel like it's right in front of my face and that's why I
 can't see it lol. Any help would be greatly appreciated. Thanks in
 advance
 =)

 My code...

 $query = SELECT servername, COUNT(steps) FROM monitoring WHERE steps
 LIKE
 'iisreset' AND timestamp = '$_POST[time2]' AND timestamp =
 '$_POST[time1]'
 GROUP BY servername ORDER BY COUNT(*) DESC LIMIT 10;
 $result = mysql_query($query) or die(mysql_error());

 # display column titles
 echo centertable class='table'tr;
 echo td class='tableHeader'centersmallbCount/b/small/td;
 echo td class='tableHeader'centersmallbServer
 Name/b/small/td;
 echo /tr;

 #display results
 while($i = mysql_fetch_row($result))
 {
 echo trtdsmallcenter, $i[COUNT('steps')],
 /center/small/td;
 echo tdsmallcenter, $i[servername]
 ,/center/small/td/tr;
 }
 echo /table/centerbr;

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


  Change that COUNT(steps) to COUNT(steps) AS CountSteps, that might
 be
 the issue.  Then you're using $i['CountSteps'].  That seems a bit more
 normal looking to me atleast.

 Also, try echoing out your query on the screen to see that its formating
 properly in the PHP code.  You may have something wrong in there, although
 I
 don't see any off hand.

 --
 -Dan Joseph

 www.canishosting.com - Plans start @ $1.99/month.

 Build a man a fire, and he will be warm for the rest of the day.
 Light a man on fire, and will be warm for the rest of his life.



 Adding as CountSteps $i['CountSteps'] still leaves the column blank.

 echo $result; gives me an output of:
 Resource id #3

 and

 echo $query;

 just gives me an error.

 One thing I don't understand is why echo $result; gives me Resource id #3
 as an output. What does that mean?

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


That's basically your result set ID number inside PHP.

as for $query, what error are you getting?  Does this $query echo out:

$query = SELECT servername, COUNT(steps) AS CountSteps FROM monitoring
WHERE steps LIKE 'iisreset' AND timestamp = ' . $_POST['time2'] . ' AND
timestamp = ' . $_POST['time1'] . ' GROUP BY servername ORDER BY COUNT(*)
DESC LIMIT 10;

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.


Re: [PHP] PHP and MySQL SELECT COUNT (*)

2008-09-17 Thread Vinny Gullotta
Dan Joseph [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
On Wed, Sep 17, 2008 at 2:30 PM, Vinny Gullotta 
[EMAIL PROTECTED]wrote:



Dan Joseph [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 On Wed, Sep 17, 2008 at 2:17 PM, Vinny Gullotta 
[EMAIL PROTECTED]

wrote:

 What I want to do is find the top 10 servers where the column steps =

iisreset. The following code works great except that the page is not
displaying the servername in the 'Server Name' column of my results
(nothing
appears, the column is just blank).

servername and steps are the important columns in the database table.
$_POST[time1] and $_POST[time2] come from a form submitted.

When I copy and paste the entire select statement into the SQL tab in
phpmyadmin (and replace the time variables with actual times
corresponding
to the timestamp column), it displays the correct results including
servername. Everything works in the php page's results except for the
servername. I feel like it's right in front of my face and that's why I
can't see it lol. Any help would be greatly appreciated. Thanks in
advance
=)

My code...

$query = SELECT servername, COUNT(steps) FROM monitoring WHERE steps
LIKE
'iisreset' AND timestamp = '$_POST[time2]' AND timestamp =
'$_POST[time1]'
GROUP BY servername ORDER BY COUNT(*) DESC LIMIT 10;
$result = mysql_query($query) or die(mysql_error());

# display column titles
echo centertable class='table'tr;
echo td 
class='tableHeader'centersmallbCount/b/small/td;

echo td class='tableHeader'centersmallbServer
Name/b/small/td;
echo /tr;

#display results
while($i = mysql_fetch_row($result))
{
echo trtdsmallcenter, $i[COUNT('steps')],
/center/small/td;
echo tdsmallcenter, $i[servername]
,/center/small/td/tr;
}
echo /table/centerbr;

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


 Change that COUNT(steps) to COUNT(steps) AS CountSteps, that might

be
the issue.  Then you're using $i['CountSteps'].  That seems a bit more
normal looking to me atleast.

Also, try echoing out your query on the screen to see that its formating
properly in the PHP code.  You may have something wrong in there, 
although

I
don't see any off hand.

--
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.




Adding as CountSteps $i['CountSteps'] still leaves the column blank.

echo $result; gives me an output of:
Resource id #3

and

echo $query;

just gives me an error.

One thing I don't understand is why echo $result; gives me Resource id #3
as an output. What does that mean?

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



That's basically your result set ID number inside PHP.

as for $query, what error are you getting?  Does this $query echo out:

$query = SELECT servername, COUNT(steps) AS CountSteps FROM monitoring
WHERE steps LIKE 'iisreset' AND timestamp = ' . $_POST['time2'] . ' AND
timestamp = ' . $_POST['time1'] . ' GROUP BY servername ORDER BY 
COUNT(*)

DESC LIMIT 10;

--
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.



It's actually not an error, it's the select statement that is echo'd

echo $query;

yields

SELECT servername, COUNT(steps) as CountSteps FROM monitoring WHERE steps = 
'IISRESET' AND timestamp = '2008-09-17 11:40:34' AND timestamp = 
'2008-08-17' GROUP BY servername ORDER BY COUNT(*) DESC LIMIT 10 



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



Re: [PHP] PHP and MySQL SELECT COUNT (*)

2008-09-17 Thread Micah Gersten
You'll want to change your Order By statement to 'ORDER BY CountSteps DESC'.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Vinny Gullotta wrote:
 echo $query;

 yields

 SELECT servername, COUNT(steps) as CountSteps FROM monitoring WHERE
 steps = 'IISRESET' AND timestamp = '2008-09-17 11:40:34' AND
 timestamp = '2008-08-17' GROUP BY servername ORDER BY COUNT(*) DESC
 LIMIT 10


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



Re: [PHP] PHP and MySQL SELECT COUNT (*)

2008-09-17 Thread Vinny Gullotta

Still no luck displaying the stupid servername. Any other things I can try?


Micah Gersten [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
You'll want to change your Order By statement to 'ORDER BY CountSteps 
DESC'.


Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Vinny Gullotta wrote:

echo $query;

yields

SELECT servername, COUNT(steps) as CountSteps FROM monitoring WHERE
steps = 'IISRESET' AND timestamp = '2008-09-17 11:40:34' AND
timestamp = '2008-08-17' GROUP BY servername ORDER BY COUNT(*) DESC
LIMIT 10




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



Re: [PHP] PHP and MySQL SELECT COUNT (*)

2008-09-17 Thread Dan Joseph
On Wed, Sep 17, 2008 at 2:17 PM, Vinny Gullotta [EMAIL PROTECTED]wrote:

 What I want to do is find the top 10 servers where the column steps =
 iisreset. The following code works great except that the page is not
 displaying the servername in the 'Server Name' column of my results (nothing
 appears, the column is just blank).

 servername and steps are the important columns in the database table.
 $_POST[time1] and $_POST[time2] come from a form submitted.

 When I copy and paste the entire select statement into the SQL tab in
 phpmyadmin (and replace the time variables with actual times corresponding
 to the timestamp column), it displays the correct results including
 servername. Everything works in the php page's results except for the
 servername. I feel like it's right in front of my face and that's why I
 can't see it lol. Any help would be greatly appreciated. Thanks in advance
 =)

 My code...

 $query = SELECT servername, COUNT(steps) FROM monitoring WHERE steps LIKE
 'iisreset' AND timestamp = '$_POST[time2]' AND timestamp = '$_POST[time1]'
 GROUP BY servername ORDER BY COUNT(*) DESC LIMIT 10;
 $result = mysql_query($query) or die(mysql_error());

 # display column titles
 echo centertable class='table'tr;
 echo td class='tableHeader'centersmallbCount/b/small/td;
 echo td class='tableHeader'centersmallbServer
 Name/b/small/td;
 echo /tr;

 #display results
 while($i = mysql_fetch_row($result))
 {
 echo trtdsmallcenter, $i[COUNT('steps')],
 /center/small/td;
 echo tdsmallcenter, $i[servername] ,/center/small/td/tr;
 }
 echo /table/centerbr;

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


$i[servername]

Try:  $i['servername']

notice the ' and ' around the name.  I've heard you can do w/o those, but
I've had issues in the past where it didn't work.  ITs also good practice to
use 'em.

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.


Re: [PHP] PHP and MySQL SELECT COUNT (*)

2008-09-17 Thread Micah Gersten
Do var_dump($i) in the loop to see if you're getting the data you want.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Vinny Gullotta wrote:
 Still no luck displaying the stupid servername. Any other things I can
 try?


 Micah Gersten [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 You'll want to change your Order By statement to 'ORDER BY CountSteps
 DESC'.

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 Vinny Gullotta wrote:
 echo $query;

 yields

 SELECT servername, COUNT(steps) as CountSteps FROM monitoring WHERE
 steps = 'IISRESET' AND timestamp = '2008-09-17 11:40:34' AND
 timestamp = '2008-08-17' GROUP BY servername ORDER BY COUNT(*) DESC
 LIMIT 10




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



Re: [PHP] PHP and MySQL SELECT COUNT (*)

2008-09-17 Thread Vinny Gullotta
Dan Joseph [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
On Wed, Sep 17, 2008 at 2:17 PM, Vinny Gullotta 
[EMAIL PROTECTED]wrote:



What I want to do is find the top 10 servers where the column steps =
iisreset. The following code works great except that the page is not
displaying the servername in the 'Server Name' column of my results 
(nothing

appears, the column is just blank).

servername and steps are the important columns in the database table.
$_POST[time1] and $_POST[time2] come from a form submitted.

When I copy and paste the entire select statement into the SQL tab in
phpmyadmin (and replace the time variables with actual times 
corresponding

to the timestamp column), it displays the correct results including
servername. Everything works in the php page's results except for the
servername. I feel like it's right in front of my face and that's why I
can't see it lol. Any help would be greatly appreciated. Thanks in 
advance

=)

My code...

$query = SELECT servername, COUNT(steps) FROM monitoring WHERE steps 
LIKE
'iisreset' AND timestamp = '$_POST[time2]' AND timestamp = 
'$_POST[time1]'

GROUP BY servername ORDER BY COUNT(*) DESC LIMIT 10;
$result = mysql_query($query) or die(mysql_error());

# display column titles
echo centertable class='table'tr;
echo td class='tableHeader'centersmallbCount/b/small/td;
echo td class='tableHeader'centersmallbServer
Name/b/small/td;
echo /tr;

#display results
while($i = mysql_fetch_row($result))
{
echo trtdsmallcenter, $i[COUNT('steps')],
/center/small/td;
echo tdsmallcenter, $i[servername] 
,/center/small/td/tr;

}
echo /table/centerbr;

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



$i[servername]

Try:  $i['servername']

notice the ' and ' around the name.  I've heard you can do w/o those, but
I've had issues in the past where it didn't work.  ITs also good practice 
to

use 'em.

--
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.




yeah, I've tried that combination before, but just for grins I tried it 
again, and same result. It displays the counts but not the servernames. 



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



Re: [PHP] PHP and MySQL SELECT COUNT (*)

2008-09-17 Thread Vinny Gullotta
var_dump($i); looks messy, but I can see the server names in there and they 
are the correct names.



Micah Gersten [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

Do var_dump($i) in the loop to see if you're getting the data you want.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Vinny Gullotta wrote:

Still no luck displaying the stupid servername. Any other things I can
try?


Micah Gersten [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

You'll want to change your Order By statement to 'ORDER BY CountSteps
DESC'.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Vinny Gullotta wrote:

echo $query;

yields

SELECT servername, COUNT(steps) as CountSteps FROM monitoring WHERE
steps = 'IISRESET' AND timestamp = '2008-09-17 11:40:34' AND
timestamp = '2008-08-17' GROUP BY servername ORDER BY COUNT(*) DESC
LIMIT 10







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



Re: [PHP] PHP and MySQL SELECT COUNT (*)

2008-09-17 Thread Micah Gersten
What is the key for the server name?  That's what you need when you
output it.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Vinny Gullotta wrote:
 var_dump($i); looks messy, but I can see the server names in there and
 they are the correct names.


 Micah Gersten [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 Do var_dump($i) in the loop to see if you're getting the data you want.

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 Vinny Gullotta wrote:
 Still no luck displaying the stupid servername. Any other things I can
 try?


 Micah Gersten [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 You'll want to change your Order By statement to 'ORDER BY CountSteps
 DESC'.

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 Vinny Gullotta wrote:
 echo $query;

 yields

 SELECT servername, COUNT(steps) as CountSteps FROM monitoring WHERE
 steps = 'IISRESET' AND timestamp = '2008-09-17 11:40:34' AND
 timestamp = '2008-08-17' GROUP BY servername ORDER BY COUNT(*) DESC
 LIMIT 10






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



Re: [PHP] PHP and MySQL SELECT COUNT (*)

2008-09-17 Thread Dan Joseph
On Wed, Sep 17, 2008 at 4:21 PM, Vinny Gullotta [EMAIL PROTECTED]wrote:

 var_dump($i); looks messy, but I can see the server names in there and they
 are the correct names.


 Micah Gersten [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]

  Do var_dump($i) in the loop to see if you're getting the data you want.

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 Vinny Gullotta wrote:

 Still no luck displaying the stupid servername. Any other things I can
 try?


 Micah Gersten [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]

 You'll want to change your Order By statement to 'ORDER BY CountSteps
 DESC'.

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 Vinny Gullotta wrote:

 echo $query;

 yields

 SELECT servername, COUNT(steps) as CountSteps FROM monitoring WHERE
 steps = 'IISRESET' AND timestamp = '2008-09-17 11:40:34' AND
 timestamp = '2008-08-17' GROUP BY servername ORDER BY COUNT(*) DESC
 LIMIT 10





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


Can you show us one of the var_dumps?

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.


Re: [PHP] PHP and MySQL SELECT COUNT (*)

2008-09-17 Thread Vinny Gullotta

var_dump looks like this:

array(2) { [0]= string(9) wehost006 [1]= string(2) 72 } array(2) { 
[0]= string(8) H7848-49 [1]= string(2) 71 } array(2) { [0]= string(7) 
H7853-2 [1]= string(2) 70 } array(2) { [0]= string(7) H7842-2 [1]= 
string(2) 64 } array(2) { [0]= string(9) WEHOST005 [1]= string(2) 
64 } array(2) { [0]= string(7) h7835-2 [1]= string(2) 57 } array(2) 
{ [0]= string(9) wehost007 [1]= string(2) 56 } array(2) { [0]= 
string(7) H7814-1 [1]= string(2) 55 } array(2) { [0]= string(5) 
H0542 [1]= string(2) 54 } array(2) { [0]= string(8) H7811-12 [1]= 
string(2) 54 }



Dan Joseph [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
On Wed, Sep 17, 2008 at 4:21 PM, Vinny Gullotta 
[EMAIL PROTECTED]wrote:


var_dump($i); looks messy, but I can see the server names in there and 
they

are the correct names.


Micah Gersten [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 Do var_dump($i) in the loop to see if you're getting the data you want.


Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Vinny Gullotta wrote:


Still no luck displaying the stupid servername. Any other things I can
try?


Micah Gersten [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]


You'll want to change your Order By statement to 'ORDER BY CountSteps
DESC'.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Vinny Gullotta wrote:


echo $query;

yields

SELECT servername, COUNT(steps) as CountSteps FROM monitoring WHERE
steps = 'IISRESET' AND timestamp = '2008-09-17 11:40:34' AND
timestamp = '2008-08-17' GROUP BY servername ORDER BY COUNT(*) DESC
LIMIT 10







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



Can you show us one of the var_dumps?

--
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.




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



Re: [PHP] PHP and MySQL SELECT COUNT (*)

2008-09-17 Thread Vinny Gullotta

If by key you mean the column in the database, it's called: servername

Micah Gersten [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

What is the key for the server name?  That's what you need when you
output it.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Vinny Gullotta wrote:

var_dump($i); looks messy, but I can see the server names in there and
they are the correct names.


Micah Gersten [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

Do var_dump($i) in the loop to see if you're getting the data you want.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Vinny Gullotta wrote:

Still no luck displaying the stupid servername. Any other things I can
try?


Micah Gersten [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

You'll want to change your Order By statement to 'ORDER BY CountSteps
DESC'.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Vinny Gullotta wrote:

echo $query;

yields

SELECT servername, COUNT(steps) as CountSteps FROM monitoring WHERE
steps = 'IISRESET' AND timestamp = '2008-09-17 11:40:34' AND
timestamp = '2008-08-17' GROUP BY servername ORDER BY COUNT(*) DESC
LIMIT 10










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



Re: [PHP] PHP and MySQL SELECT COUNT (*)

2008-09-17 Thread Micah Gersten
That's your problem, you need to use mysql_fetch_assoc instead of
mysql_fetch_row.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Vinny Gullotta wrote:
 var_dump looks like this:

 array(2) { [0]= string(9) wehost006 [1]= string(2) 72 } array(2)
 { [0]= string(8) H7848-49 [1]= string(2) 71 } array(2) { [0]=
 string(7) H7853-2 [1]= string(2) 70 } array(2) { [0]= string(7)
 H7842-2 [1]= string(2) 64 } array(2) { [0]= string(9)
 WEHOST005 [1]= string(2) 64 } array(2) { [0]= string(7)
 h7835-2 [1]= string(2) 57 } array(2) { [0]= string(9)
 wehost007 [1]= string(2) 56 } array(2) { [0]= string(7)
 H7814-1 [1]= string(2) 55 } array(2) { [0]= string(5) H0542
 [1]= string(2) 54 } array(2) { [0]= string(8) H7811-12 [1]=
 string(2) 54 }


 Dan Joseph [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 On Wed, Sep 17, 2008 at 4:21 PM, Vinny Gullotta
 [EMAIL PROTECTED]wrote:

 var_dump($i); looks messy, but I can see the server names in there
 and they
 are the correct names.


 Micah Gersten [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]

  Do var_dump($i) in the loop to see if you're getting the data you
 want.

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 Vinny Gullotta wrote:

 Still no luck displaying the stupid servername. Any other things I
 can
 try?


 Micah Gersten [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]

 You'll want to change your Order By statement to 'ORDER BY
 CountSteps
 DESC'.

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 Vinny Gullotta wrote:

 echo $query;

 yields

 SELECT servername, COUNT(steps) as CountSteps FROM monitoring WHERE
 steps = 'IISRESET' AND timestamp = '2008-09-17 11:40:34' AND
 timestamp = '2008-08-17' GROUP BY servername ORDER BY COUNT(*)
 DESC
 LIMIT 10





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


 Can you show us one of the var_dumps?

 -- 
 -Dan Joseph

 www.canishosting.com - Plans start @ $1.99/month.

 Build a man a fire, and he will be warm for the rest of the day.
 Light a man on fire, and will be warm for the rest of his life.




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



Re: [PHP] PHP and MySQL SELECT COUNT (*)

2008-09-17 Thread Dan Joseph
On Wed, Sep 17, 2008 at 4:30 PM, Vinny Gullotta [EMAIL PROTECTED]wrote:

 If by key you mean the column in the database, it's called: servername

 Micah Gersten [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]

  What is the key for the server name?  That's what you need when you
 output it.

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 Vinny Gullotta wrote:

 var_dump($i); looks messy, but I can see the server names in there and
 they are the correct names.


 Micah Gersten [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]

 Do var_dump($i) in the loop to see if you're getting the data you want.

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 Vinny Gullotta wrote:

 Still no luck displaying the stupid servername. Any other things I can
 try?


 Micah Gersten [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]

 You'll want to change your Order By statement to 'ORDER BY CountSteps
 DESC'.

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 Vinny Gullotta wrote:

 echo $query;

 yields

 SELECT servername, COUNT(steps) as CountSteps FROM monitoring WHERE
 steps = 'IISRESET' AND timestamp = '2008-09-17 11:40:34' AND
 timestamp = '2008-08-17' GROUP BY servername ORDER BY COUNT(*) DESC
 LIMIT 10







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


Thanks, I know your problem, sorry for not seeing this sooner.
mysql_fetch_row returns the numerical array types.  $array[0]...  You want
to use mysql_fetch_array().  Change to that, and you should be seeing the
servername's.

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.


Re: [PHP] PHP and MySQL SELECT COUNT (*)

2008-09-17 Thread Micah Gersten
I meant key in the array that was returned by MySQL.  I answered you in
my other post.  The array was numerically index based instead of column
based.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Vinny Gullotta wrote:
 If by key you mean the column in the database, it's called: servername

 Micah Gersten [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 What is the key for the server name?  That's what you need when you
 output it.

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 Vinny Gullotta wrote:
 var_dump($i); looks messy, but I can see the server names in there and
 they are the correct names.


 Micah Gersten [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 Do var_dump($i) in the loop to see if you're getting the data you
 want.

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 Vinny Gullotta wrote:
 Still no luck displaying the stupid servername. Any other things I
 can
 try?


 Micah Gersten [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 You'll want to change your Order By statement to 'ORDER BY
 CountSteps
 DESC'.

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 Vinny Gullotta wrote:
 echo $query;

 yields

 SELECT servername, COUNT(steps) as CountSteps FROM monitoring WHERE
 steps = 'IISRESET' AND timestamp = '2008-09-17 11:40:34' AND
 timestamp = '2008-08-17' GROUP BY servername ORDER BY COUNT(*)
 DESC
 LIMIT 10








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



Re: [PHP] PHP and MySQL SELECT COUNT (*)

2008-09-17 Thread Vinny Gullotta

That was it!!! Thank you all so much for your help!!! =D


Dan Joseph [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
On Wed, Sep 17, 2008 at 4:30 PM, Vinny Gullotta 
[EMAIL PROTECTED]wrote:



If by key you mean the column in the database, it's called: servername

Micah Gersten [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 What is the key for the server name?  That's what you need when you

output it.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Vinny Gullotta wrote:


var_dump($i); looks messy, but I can see the server names in there and
they are the correct names.


Micah Gersten [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

Do var_dump($i) in the loop to see if you're getting the data you 
want.


Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Vinny Gullotta wrote:

Still no luck displaying the stupid servername. Any other things I 
can

try?


Micah Gersten [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

You'll want to change your Order By statement to 'ORDER BY 
CountSteps

DESC'.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Vinny Gullotta wrote:


echo $query;

yields

SELECT servername, COUNT(steps) as CountSteps FROM monitoring WHERE
steps = 'IISRESET' AND timestamp = '2008-09-17 11:40:34' AND
timestamp = '2008-08-17' GROUP BY servername ORDER BY COUNT(*) 
DESC

LIMIT 10










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



Thanks, I know your problem, sorry for not seeing this sooner.
mysql_fetch_row returns the numerical array types.  $array[0]...  You want
to use mysql_fetch_array().  Change to that, and you should be seeing the
servername's.

--
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.




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



Re: [PHP] PHP and MySQL SELECT COUNT (*)

2008-09-17 Thread Jochem Maas

Dan Joseph schreef:

On Wed, Sep 17, 2008 at 2:17 PM, Vinny Gullotta [EMAIL PROTECTED]wrote:


...




$i[servername]

Try:  $i['servername']

notice the ' and ' around the name.  I've heard you can do w/o those, but
I've had issues in the past where it didn't work.  ITs also good practice to
use 'em.


yes, not quoting the array key will generate an E_NOTICE, php first looks for
a constant named **servername** doesn't find it and falls back to using the
literal as a string value, namely 'servername'

developed with error_reporting set to E_ALL and such things are explained to 
you.






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



Re: [PHP] PHP querying mysql db for data limited to the last month

2008-08-05 Thread Per Jessen
Vinny Gullotta wrote:

 So I have this code I'm working with (pasted below) that queries a
 mysql db table called timetracking. The goal of the page is to search
 the db for all data based on a certain engineer, sorted by product and
 it takes pre-defined values based on actions performed, sums them
 based on product and display's the percentage of time an engineer has
 spent on each product. Everything works great except I need to limit
 the results to the last months data only, but everything I try seems
 to just break it. Can anyone push me in the right direction a little?

I can't see a timestamp field in your code, but I'm assuming you've got
one? 

SELECT *,SUM(timespent) FROM timetracking 
WHERE engineer=engineer AND
month(timestamp)=month(date_sub(now(),interval 1 month))
GROUP BY product;


/Per Jessen, Zürich


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



Re: [PHP] PHP querying mysql db for data limited to the last month

2008-08-05 Thread Vinny Gullotta
Sorry, I took that stuff out because it was making the page not load and so 
I figured it was wrong. I guess I should have posted the whole thing, but 
since it didn't work I left it out.


Micah, thank you very much for the idea, it is working great!!!


Micah Gersten [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

1.  To get last months date, you can use strtotime(1 month ago)
instead of mktime.
2.  I don't see anywhere in the code where you are limiting by date.
Try using  and .  Between is tricky on dates.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Vinny Gullotta wrote:

So I have this code I'm working with (pasted below) that queries a
mysql db table called timetracking. The goal of the page is to search
the db for all data based on a certain engineer, sorted by product and
it takes pre-defined values based on actions performed, sums them
based on product and display's the percentage of time an engineer has
spent on each product. Everything works great except I need to limit
the results to the last months data only, but everything I try seems
to just break it. Can anyone push me in the right direction a little?
I have tried using BETWEEN in the SELECT statement, some while
statements and if statements, and all I do is keep breaking it. If
anyone has any ideas, it would be exceptionally helpful.

Thanks in advance,
Vinny


?php
$total = 0;
$today = date('Y-m-d h:i:s');
$monthago = date(Y-m-d h:i:s, mktime(date(h), date(i),
date(s), date(m)-1, date(d),   date(Y)));
echo Today = , $today;
echo brOne Month Ago = , $monthago, br;

$query = SELECT *, SUM(timespent) FROM timetracking WHERE engineer =
'$engineer' GROUP BY product;
$result = mysql_query($query) or die(mysql_error());
$result2 = mysql_query($query) or die(mysql_error());
echo center;

 while($row = mysql_fetch_array($result)){
  $total = $row['SUM(timespent)'] + $total;
 }
 while($row = mysql_fetch_array($result2)){
  $perc = $row['SUM(timespent)'] * 100 / $total;
  echo [ font color=#1E429B size=+1, $row[product].  = .
number_format($perc,2), %/font ];
 }

?





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



[PHP] PHP querying mysql db for data limited to the last month

2008-08-04 Thread Vinny Gullotta
So I have this code I'm working with (pasted below) that queries a mysql db 
table called timetracking. The goal of the page is to search the db for all 
data based on a certain engineer, sorted by product and it takes pre-defined 
values based on actions performed, sums them based on product and display's 
the percentage of time an engineer has spent on each product. Everything 
works great except I need to limit the results to the last months data only, 
but everything I try seems to just break it. Can anyone push me in the right 
direction a little? I have tried using BETWEEN in the SELECT statement, some 
while statements and if statements, and all I do is keep breaking it. If 
anyone has any ideas, it would be exceptionally helpful.


Thanks in advance,
Vinny


?php
$total = 0;
$today = date('Y-m-d h:i:s');
$monthago = date(Y-m-d h:i:s, mktime(date(h), date(i), date(s), 
date(m)-1, date(d),   date(Y)));

echo Today = , $today;
echo brOne Month Ago = , $monthago, br;

$query = SELECT *, SUM(timespent) FROM timetracking WHERE engineer = 
'$engineer' GROUP BY product;

$result = mysql_query($query) or die(mysql_error());
$result2 = mysql_query($query) or die(mysql_error());
echo center;

 while($row = mysql_fetch_array($result)){
  $total = $row['SUM(timespent)'] + $total;
 }
 while($row = mysql_fetch_array($result2)){
  $perc = $row['SUM(timespent)'] * 100 / $total;
  echo [ font color=#1E429B size=+1, $row[product].  = . 
number_format($perc,2), %/font ];

 }

?


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



Re: [PHP] PHP querying mysql db for data limited to the last month

2008-08-04 Thread Micah Gersten
1.  To get last months date, you can use strtotime(1 month ago)
instead of mktime.
2.  I don't see anywhere in the code where you are limiting by date. 
Try using  and .  Between is tricky on dates.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Vinny Gullotta wrote:
 So I have this code I'm working with (pasted below) that queries a
 mysql db table called timetracking. The goal of the page is to search
 the db for all data based on a certain engineer, sorted by product and
 it takes pre-defined values based on actions performed, sums them
 based on product and display's the percentage of time an engineer has
 spent on each product. Everything works great except I need to limit
 the results to the last months data only, but everything I try seems
 to just break it. Can anyone push me in the right direction a little?
 I have tried using BETWEEN in the SELECT statement, some while
 statements and if statements, and all I do is keep breaking it. If
 anyone has any ideas, it would be exceptionally helpful.

 Thanks in advance,
 Vinny


 ?php
 $total = 0;
 $today = date('Y-m-d h:i:s');
 $monthago = date(Y-m-d h:i:s, mktime(date(h), date(i),
 date(s), date(m)-1, date(d),   date(Y)));
 echo Today = , $today;
 echo brOne Month Ago = , $monthago, br;

 $query = SELECT *, SUM(timespent) FROM timetracking WHERE engineer =
 '$engineer' GROUP BY product;
 $result = mysql_query($query) or die(mysql_error());
 $result2 = mysql_query($query) or die(mysql_error());
 echo center;

  while($row = mysql_fetch_array($result)){
   $total = $row['SUM(timespent)'] + $total;
  }
  while($row = mysql_fetch_array($result2)){
   $perc = $row['SUM(timespent)'] * 100 / $total;
   echo [ font color=#1E429B size=+1, $row[product].  = .
 number_format($perc,2), %/font ];
  }

 ?



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



[PHP] PHP + PDO + MySQL + Stored Procedure + PREPARE = Problem

2007-08-31 Thread Uzed

Hi all,

I've found a bug when working on a PHP script using a PDO connector.

When I made a Store Procedure using the PREPARE statement something 
messed up the result im my PHP script.



Please go to my blog http://huzed.com/zed/?p=21 and see code.



Tanks for help.


ZED

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



Re: [PHP] PHP 6: Mysql with iso-8859-1 chars outputting utf-8: Could not convert binary string to Unicode string

2007-05-02 Thread Richard Lynch
This is a question from a guy who does NOT really do Unicode very well...

If everything else in your entire system is iso-8859-1 (aka Latin1)
why are you making your output be utf-8?

Seems to me that that is where the conversion is probably taking place...

On Sun, April 29, 2007 11:07 am, Rangel Reale wrote:
 Hello!

 I have a MySQL database where all tables are in the latin1 character
 set, with accented (Portuguese) characters.

 In my php.ini I have

 
 ; Unicode settings ;
 

 unicode.semantics = on
 unicode.runtime_encoding = iso-8859-1
 unicode.script_encoding = iso-8859-1
 unicode.output_encoding = utf-8
 unicode.from_error_mode = U_INVALID_SUBSTITUTE
 unicode.from_error_subst_char = 3f
 unicode.fallback_encoding = iso-8859-1

 because all my files and data in mysql server are in iso-8859-1.


 When connecting to mysql I issue:

   mysql_query('set names latin1', $this-mysql_link);

 but when I do query in any record that have accented characters I get
 this warning (using mysql_fetch_assoc):

 --
 Could not convert binary string to Unicode string (converter UTF-8
 failed on bytes (0xE7) at offset 9)
 --

 for all accented characters in all fields.


 If I changed the set names query to:

   mysql_query('set names utf8', $this-mysql_link);

 it works, but I would like to keep compatibility with PHP 5, and for
 my application it requires set names to be latin1. Also, my databases
 are not created with the utf8 option.

 As I understood PHP 6's unicode support, all string characters
 (including mysql result values) are converted from
 unicode.runtime_encoding to unicode (utf-16), but looks like it is
 trying to convert from ASCII, which does not have all the accented
 characters. Am I assuming right? How to make mysql_fetch_assoc assume
 field values are in iso-8859-1 instead of ASCII?

 Thanks,
 Rangel Reale



-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] PHP 6: Mysql with iso-8859-1 chars outputting utf-8: Could not convert binary string to Unicode string

2007-05-02 Thread Rangel Reale

You are right, I really don't know Unicode very much! :P

What I was trying to understand was, because unicode.runtime_encoding =
iso-8859-1, I tought that all internal operations were done in this
encoding, and only when outputting (unicode.output_encoding = utf-8) data
would be converted to utf-8. So to me, I did a mysql query with latin1, data
comes to my variables as iso-8859-1, I use them, and only when I echo'ed
them, they would become utf-8, from a iso-8859-1-to-utf-8-like function.

The strange thing to me, is the mysql_fetch_assoc function give this error
even before I accessed the field values, as I understanded from the above
explanation.

Did I understood it wrong?

Thanks,
Rangel

- Original Message - 
From: Richard Lynch [EMAIL PROTECTED]

To: Rangel Reale [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Wednesday, May 02, 2007 6:53 PM
Subject: Re: [PHP] PHP 6: Mysql with iso-8859-1 chars outputting utf-8:
Could not convert binary string to Unicode string



This is a question from a guy who does NOT really do Unicode very well...

If everything else in your entire system is iso-8859-1 (aka Latin1)
why are you making your output be utf-8?

Seems to me that that is where the conversion is probably taking place...

On Sun, April 29, 2007 11:07 am, Rangel Reale wrote:

Hello!

I have a MySQL database where all tables are in the latin1 character
set, with accented (Portuguese) characters.

In my php.ini I have


; Unicode settings ;


unicode.semantics = on
unicode.runtime_encoding = iso-8859-1
unicode.script_encoding = iso-8859-1
unicode.output_encoding = utf-8
unicode.from_error_mode = U_INVALID_SUBSTITUTE
unicode.from_error_subst_char = 3f
unicode.fallback_encoding = iso-8859-1

because all my files and data in mysql server are in iso-8859-1.


When connecting to mysql I issue:

  mysql_query('set names latin1', $this-mysql_link);

but when I do query in any record that have accented characters I get
this warning (using mysql_fetch_assoc):

--
Could not convert binary string to Unicode string (converter UTF-8
failed on bytes (0xE7) at offset 9)
--

for all accented characters in all fields.


If I changed the set names query to:

  mysql_query('set names utf8', $this-mysql_link);

it works, but I would like to keep compatibility with PHP 5, and for
my application it requires set names to be latin1. Also, my databases
are not created with the utf8 option.

As I understood PHP 6's unicode support, all string characters
(including mysql result values) are converted from
unicode.runtime_encoding to unicode (utf-16), but looks like it is
trying to convert from ASCII, which does not have all the accented
characters. Am I assuming right? How to make mysql_fetch_assoc assume
field values are in iso-8859-1 instead of ASCII?

Thanks,
Rangel Reale




--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?




--
Internal Virus Database is out-of-date.
Checked by AVG Free Edition.
Version: 7.5.463 / Virus Database: 269.6.1/776 - Release Date: 25/4/2007
12:19




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



Re: [PHP] PHP 6: Mysql with iso-8859-1 chars outputting utf-8: Could not convert binary string to Unicode string

2007-05-02 Thread Richard Lynch
On Wed, May 2, 2007 5:32 pm, Rangel Reale wrote:
 You are right, I really don't know Unicode very much! :P

 What I was trying to understand was, because unicode.runtime_encoding
 =
 iso-8859-1, I tought that all internal operations were done in this
 encoding, and only when outputting (unicode.output_encoding = utf-8)
 data
 would be converted to utf-8. So to me, I did a mysql query with
 latin1, data
 comes to my variables as iso-8859-1, I use them, and only when I
 echo'ed
 them, they would become utf-8, from a iso-8859-1-to-utf-8-like
 function.

 The strange thing to me, is the mysql_fetch_assoc function give this
 error
 even before I accessed the field values, as I understanded from the
 above
 explanation.

 Did I understood it wrong?

No, you're probably right...

I think that PHP may be biased toward UTF-16 (32?) internally, and
be converting to/from UTF-16 and keeping everything in UTF-16
internally...

But, really, since PHP 6 is not actually released yet, you probably
need to be asking about this on Internals, I think, to get a real
answer...

I suspect you'll still want to use iso-8859-1 on the output after you
solve this bug, though, if you don't want it converted to utf-8 in the
end..

You may also want to just try it with unicode semantics OFF, since
that's probably the least debugged and biggest change in PHP 6, and if
you do *everything* in Latin1, that's pretty much the state PHP was in
since nineteen-ninety-mumble, and it will just work anyway...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



[PHP] PHP 6: Mysql with iso-8859-1 chars outputting utf-8: Could not convert binary string to Unicode string

2007-04-29 Thread Rangel Reale
Hello!

I have a MySQL database where all tables are in the latin1 character set, with 
accented (Portuguese) characters.

In my php.ini I have


; Unicode settings ;


unicode.semantics = on
unicode.runtime_encoding = iso-8859-1
unicode.script_encoding = iso-8859-1
unicode.output_encoding = utf-8
unicode.from_error_mode = U_INVALID_SUBSTITUTE
unicode.from_error_subst_char = 3f
unicode.fallback_encoding = iso-8859-1

because all my files and data in mysql server are in iso-8859-1.


When connecting to mysql I issue:

  mysql_query('set names latin1', $this-mysql_link);

but when I do query in any record that have accented characters I get this 
warning (using mysql_fetch_assoc):

--
Could not convert binary string to Unicode string (converter UTF-8 failed on 
bytes (0xE7) at offset 9)
--

for all accented characters in all fields.


If I changed the set names query to:

  mysql_query('set names utf8', $this-mysql_link);

it works, but I would like to keep compatibility with PHP 5, and for my 
application it requires set names to be latin1. Also, my databases are not 
created with the utf8 option.

As I understood PHP 6's unicode support, all string characters (including mysql 
result values) are converted from unicode.runtime_encoding to unicode (utf-16), 
but looks like it is trying to convert from ASCII, which does not have all the 
accented characters. Am I assuming right? How to make mysql_fetch_assoc assume 
field values are in iso-8859-1 instead of ASCII?

Thanks,
Rangel Reale


[PHP] php and mysql date mapping question

2006-10-10 Thread Dave Goodchild

Hi all, I am in the process of creating a national events directory where
people can enter their events (car boot sales, evening classes etc) and
specify whether those events are one-ff events or repeating (daily, weekly
etc) affairs and people can search for those events by postcode, date range,
category etc.

I have a table containing all dates between Oct 1 2006 and 2030, including
leap years etc. I am pretty new to relational design so here's my question:

I have an events table and a dates table. As an event can happen on many
dates and a date can hold many events, I created an intermediary table
called dates_events to express that many-to-many relationship. The data
entry works like a dream as does the search.

However, the dates_events table is growing quite large (200,000 mapped
relationships for 300+ test events), but the logic I used seemed clear. When
the system goes live, allowing for a sweeper script that removes outdated
mappings from all three tables, I estimate that this mapping table may grow
to 2-3 million records at least.

Does this sound flawed, and will mysql handle this kind of data volume?
Anyone have any experience building a similar system. I am happy to use this
method for the initial test run but may re-engineer it before we go national
if suggestions lead me that way.

I am unable to release the URL as yet.

--
http://www.web-buddha.co.uk


Re: [PHP] php and mysql date mapping question

2006-10-10 Thread Jochem Maas
Dave Goodchild wrote:
 Hi all, I am in the process of creating a national events directory where
 people can enter their events (car boot sales, evening classes etc) and
 specify whether those events are one-ff events or repeating (daily, weekly
 etc) affairs and people can search for those events by postcode, date
 range,
 category etc.
 
 I have a table containing all dates between Oct 1 2006 and 2030, including

Dave, if you are starting a calendar/event DB with a table full of dates
something is probably wrong. you only need to store dates for actual events (in 
theory).

 leap years etc. I am pretty new to relational design so here's my question:
 
 I have an events table and a dates table. As an event can happen on many
 dates and a date can hold many events, I created an intermediary table
 called dates_events to express that many-to-many relationship. The data
 entry works like a dream as does the search.
 
 However, the dates_events table is growing quite large (200,000 mapped
 relationships for 300+ test events), but the logic I used seemed clear.
 When
 the system goes live, allowing for a sweeper script that removes outdated
 mappings from all three tables, I estimate that this mapping table may grow
 to 2-3 million records at least.

asuming you tables are correctly indexes and the relations are correctly
defined record count is not the limiting factor at all.

it does sound like you have one table too many. a one to many relationship
between an events table and a dates table should suffice.

then again your denormalized design may allow for much faster data retrieval,
in which case stick with it :-) only one way to find out though.


 
 Does this sound flawed, and will mysql handle this kind of data volume?

yup :-) use InnoDB as the storage format and even the 4Gig limit is history.

 Anyone have any experience building a similar system. I am happy to use
 this
 method for the initial test run but may re-engineer it before we go
 national
 if suggestions lead me that way.
 
 I am unable to release the URL as yet.
 

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



Re: [PHP] PHP and mySQL dates

2006-09-15 Thread Richard Lynch
On Wed, September 13, 2006 5:56 am, Dave Goodchild wrote:
 Hi all. I am building an online events registry and have mapped out
 all the
 dates between Oct 1 2006 and Dec 31 2030, stored in the database as
 timestamps incremented by 86400 to give daily slots. I have output the
 values using the php date function and all is well. Users can enter
 either
 one-off or regular events, and I am using a mapping table to tie
 events to
 dates as they comprise a many-to-many relationship.

If I'm reading this correctly, you've created a table of every single
date, just to provide a JOIN table of massive proportions?

That's... Not Good (tm) almost for sure...

 I am struggling with some date conversions, however. When a user
 enters a
 single event for example, the data is entered into the events table,
 the
 inserted id captured, and then the system will look for the relevant
 record
 in the dates table, and eventually enter the event id and date id into
 the
 mapping table for later joins during the search process.

Now it sounds like you are inserting even MORE entries into another
table to make an even more confusing JOIN...

 To do this, I call:

 $date_string =
 mktime(0,0,0,$_SESSION['month],$_SESSION['day'],$_SESSION['year'])

 to assemble a timestamp from the supplied user data, and now I need to
 look
 for the matching date in the dates table. My problem is in converting
 between UNIX and mySQL timestamp values. My first attempt to match
 used this
 (query extract):

 SELECT id FROM dates WHERE FROM_UNIXTIME($date_string) = date

SELECT id FROM dates WHERE date = '$month/$day/$year'
has always worked for me...

If date is a timestamp or datetime, you have to convert THAT to a
date, so that the hours:minutes:seconds don't mess you up.

You're making all of this way too hard ... :-)

Re-think the concept of having a row for every possible day.

Just make sure all your tests for date equality are using the same
type of data -- DATE, not DATETIME, TIMESTAMP, etc.

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



[PHP] PHP and mySQL dates

2006-09-13 Thread Dave Goodchild

Hi all. I am building an online events registry and have mapped out all the
dates between Oct 1 2006 and Dec 31 2030, stored in the database as
timestamps incremented by 86400 to give daily slots. I have output the
values using the php date function and all is well. Users can enter either
one-off or regular events, and I am using a mapping table to tie events to
dates as they comprise a many-to-many relationship.

I am struggling with some date conversions, however. When a user enters a
single event for example, the data is entered into the events table, the
inserted id captured, and then the system will look for the relevant record
in the dates table, and eventually enter the event id and date id into the
mapping table for later joins during the search process.

To do this, I call:

$date_string =
mktime(0,0,0,$_SESSION['month],$_SESSION['day'],$_SESSION['year'])

to assemble a timestamp from the supplied user data, and now I need to look
for the matching date in the dates table. My problem is in converting
between UNIX and mySQL timestamp values. My first attempt to match used this
(query extract):

SELECT id FROM dates WHERE FROM_UNIXTIME($date_string) = date

then

SELECT id FROM dates WHERE UNIX_TIMESTAMP(date) = $date_string

neither is working. Am I making some fundamental error here or missing
something? Any help appreciated!

--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk


RE: [PHP] PHP and mySQL dates

2006-09-13 Thread Peter Lauri
[snip]
Hi all. I am building an online events registry and have mapped out all the
dates between Oct 1 2006 and Dec 31 2030, stored in the database as
timestamps incremented by 86400 to give daily slots. 
[/snip]

I do not really understand the purpose of mapping all dates between Oct 1
2006 and Dec 31 2030 and store them into a database as a timestamp. First of
all, a date is a date, not a timestamp. A timestamp is date and time
together.

Why don't you just save the events with the date as DATE format and then
compare them with CURDATE() or similar. Or just with $_SESSION[year]-
$_SESSION[month]- $_SESSION[day]

Just some thoughts.

/Peter

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



Re: [PHP] PHP and mySQL dates

2006-09-13 Thread Dave Goodchild

Thanks. I have been so up close and personal with this that I can't see the
wood for the trees. Of course, so obvious. Thank you - you have made me very
happy.







--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk


RE: [PHP] PHP and mySQL dates

2006-09-13 Thread Peter Lauri
No problem, now I will go and make my girlfriend happy :)

-Original Message-
From: Dave Goodchild [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 13, 2006 6:27 PM
To: Peter Lauri
Cc: PHP General
Subject: Re: [PHP] PHP and mySQL dates

Thanks. I have been so up close and personal with this that I can't see the
wood for the trees. Of course, so obvious. Thank you - you have made me very
happy.





-- 
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk

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



Re: [PHP] PHP and mySQL dates

2006-09-13 Thread Dave Goodchild

Good luck with that.






--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk





--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk


Re: [PHP] PHP and mySQL getting smashed...

2006-05-18 Thread Richard Lynch
On Wed, May 17, 2006 6:55 am, Russell Jones wrote:
 I have a site that is getting 30K+ traffic daily and it is smashing
 mySQL -
 any ideas on what to do to make the mysql connections more efficient,
 or
 anything in general. No bandwidth issue here, just the server getting
 killed.

It depends on the application.

For something with many reads and fewer writes like a forum or basic,
if busy, e-commerce you'd consider setting up MySQL replication with
one master for WRITE operations and multiple slaves for SELECT
operations.

For something with a high write/read ratio such as eBay, that would be
a wildly-unsuitable solution.

Your best bet is to ask the MySQL folks, honestly, since it's unlikely
that anything in PHP is going to be the answer to this one.

If you have RAM to spare, you could:
Configure /etc/my.cnf to have N + X connections
Use http://php.net/mysql_pconnect

N would be the number of Apache Max children

X would be a few spare connections so that, if, say, you NEED to use
shell 'mysql' monitor to DO something, the fact that ALL N connections
are taken by Apache, won't lock you out.

There are significant RAM issues with pconnect, as well as some bugs
in various versions of PHP/MySQL that make this answer a no-go.  Tread
carefully.

But it's at least an on-topic answer, even if an incomplete and maybe
downright bad answer.

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



[PHP] PHP and mySQL getting smashed...

2006-05-17 Thread Russell Jones

I have a site that is getting 30K+ traffic daily and it is smashing mySQL -
any ideas on what to do to make the mysql connections more efficient, or
anything in general. No bandwidth issue here, just the server getting
killed.


Thanks


Re: [PHP] PHP and mySQL getting smashed...

2006-05-17 Thread Dave Goodchild

I have a site that is getting 30K+ traffic daily and it is smashing mySQL -

any ideas on what to do to make the mysql connections more efficient, or
anything in general. No bandwidth issue here, just the server getting
killed.

...I may be wrong but using persistent connections (mysql_pconnect) may

help. Also, optimise your tables and use the explain command to see how
efficient your queries are.
--
http://www.web-buddha.co.uk

dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css)

look out for project karma, our new venture, coming soon!


Re: [PHP] PHP and mySQL getting smashed...

2006-05-17 Thread Angelo Zanetti

perhaps post some code so we can look at how you doing your queries...


HTH
Angelo Zanetti
Z Logic
www.zlogic.co.za
[c] +27 72 441 3355
[t] +27 21 469 1052
[f] +27 86 681 5885

Dave Goodchild wrote:

I have a site that is getting 30K+ traffic daily and it is smashing mySQL -


any ideas on what to do to make the mysql connections more efficient, or
anything in general. No bandwidth issue here, just the server getting
killed.

...I may be wrong but using persistent connections (mysql_pconnect) may


help. Also, optimise your tables and use the explain command to see how
efficient your queries are.


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



RE: [PHP] PHP and mySQL getting smashed...

2006-05-17 Thread Jay Blanchard
[snip]
I have a site that is getting 30K+ traffic daily and it is smashing
mySQL -
any ideas on what to do to make the mysql connections more efficient, or
anything in general. No bandwidth issue here, just the server getting
killed.
[/snip]

Without seeing any code or table information my bet would be that none
of your tables are indexed properly. 

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



Re: [PHP] PHP and mySQL getting smashed...

2006-05-17 Thread Alister Bulman

On 17/05/06, Dave Goodchild [EMAIL PROTECTED] wrote:

I have a site that is getting 30K+ traffic daily and it is smashing mySQL -
 any ideas on what to do to make the mysql connections more efficient, or
 anything in general. No bandwidth issue here, just the server getting
 killed.

 ...I may be wrong but using persistent connections (mysql_pconnect) may
help. Also, optimise your tables and use the explain command to see how
efficient your queries are.


And caching things that don't need to looked up form the database
right now.  Even the fastest server in the world would wilt under a
slashdotting, if it had to do a dozen big queries for every page
display.  Meanwhile a Pentium3 with a decent network can serve
hundreds of requests a second of a few static pages.

Alister

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



Re: [PHP] PHP and mySQL getting smashed...

2006-05-17 Thread Jochem Maas

Jay Blanchard wrote:

[snip]
I have a site that is getting 30K+ traffic daily and it is smashing
mySQL -
any ideas on what to do to make the mysql connections more efficient, or
anything in general. No bandwidth issue here, just the server getting
killed.
[/snip]

Without seeing any code or table information my bet would be that none
of your tables are indexed properly. 


and/or that the OP is using some killing JOINS in his queries - these
often have a detremental effect regardless of indexes.





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



[PHP] PHP based MySQL report generators?

2005-09-22 Thread Aaron Gould
Has anyone encountered an open-source PHP-based report generator for 
MySQL?  I haven't been able to find one yet.


We have several people in our company that need to create reports from a 
master database (consisting of several tables).


Ideally I'd like a similar functionality that MS Access or Navicat 
(navicat.com) offer.  We don't need a huge number of features, but we do 
at least need the ability to select the fields deemed necessary, and 
correlate them into a report.


We are currently using Access for this, but would like to move away from 
Microsoft (including Office).


I'm sure it's not out of reach to write this from scratch, but if I 
don't need to...


--
Aaron Gould
Programmer/Systems Administrator
PARTS CANADA

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



Re: [PHP] PHP and MySQL and resouce limits

2005-07-21 Thread Richard Lynch
On Wed, July 20, 2005 5:22 pm, John Hinton said:
 I don't get it... I have been upping my memory limit for PHP. 32megs
 now... and am making calls to a database on a different server. I see
 the loads run up on the other server as it cruches the numbers.. and PHP
 is in the process of creating a single little page with about 40 numbers
 on it, from these returns. Now, I do know I'm crunching a LOT of data in
 this instance, but it seems like MySQL is doing the work and that PHP
 shouldn't be hitting 32 my 32meg wall. Running the same query on a
 smaller dataset doesn't hit this limit, so I know it's not a function of
 the PHP code itself.

 So, I must be missing something, why is PHP somehow tied to the work
 MySQL is doing? As in memory usage seems that MySQL should be simply
 sending PHP the returns on its commands... hm

Print out the query you are sending off to MySQL.

Inspect it carefully.

Use the mysql monitor to run it.

Can MySQL, without PHP in the picture, run that query in practical
time/memory constraints?

How many rows does it actually return?

How much data in each row?

Dollars to doughnuts sez your query isn't doing what you think it's doing,
and it's returning *WAY* more rows than you think, and poor PHP is trying
to process them all...

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



[PHP] PHP and MySQL and resouce limits

2005-07-20 Thread John Hinton
I don't get it... I have been upping my memory limit for PHP. 32megs 
now... and am making calls to a database on a different server. I see 
the loads run up on the other server as it cruches the numbers.. and PHP 
is in the process of creating a single little page with about 40 numbers 
on it, from these returns. Now, I do know I'm crunching a LOT of data in 
this instance, but it seems like MySQL is doing the work and that PHP 
shouldn't be hitting 32 my 32meg wall. Running the same query on a 
smaller dataset doesn't hit this limit, so I know it's not a function of 
the PHP code itself.


So, I must be missing something, why is PHP somehow tied to the work 
MySQL is doing? As in memory usage seems that MySQL should be simply 
sending PHP the returns on its commands... hm


Thanks,
John Hinton

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



Re: [PHP] PHP and MySQL and resouce limits

2005-07-20 Thread Matt Darby



John Hinton wrote:

I don't get it... I have been upping my memory limit for PHP. 32megs 
now... and am making calls to a database on a different server. I see 
the loads run up on the other server as it cruches the numbers.. and 
PHP is in the process of creating a single little page with about 40 
numbers on it, from these returns. Now, I do know I'm crunching a LOT 
of data in this instance, but it seems like MySQL is doing the work 
and that PHP shouldn't be hitting 32 my 32meg wall. Running the same 
query on a smaller dataset doesn't hit this limit, so I know it's not 
a function of the PHP code itself.


So, I must be missing something, why is PHP somehow tied to the work 
MySQL is doing? As in memory usage seems that MySQL should be 
simply sending PHP the returns on its commands... hm


Thanks,
John Hinton



Are you sure your query is correct? This happens to me sometimes if the 
query is rather crazy...


Matt Darby

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



[PHP] Php with mysql

2005-05-23 Thread Rittwick Banerjee

Hi friends,

I am Rittwick Banerjee

Some one gave me an idea about that past php code that is :

   $sql = SELECT `User_name` AND `User_pass` FROM `user` 
WHERE `User_name` = '$_POST['user_id']' AND  '$_POST['user_id']' ;


but I found that it still not working ...
Plaese give me another code , by the way I am using Fedora 2(PCQ Linux 2004)

Thank you..

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



RE: [PHP] Php with mysql

2005-05-23 Thread Mark Rees
This is a beginner's guide to SQL syntax, please review it
http://www.webdevelopersnotes.com/tutorials/sql/mysql_guide_querying_mys
ql_tables.php3?PHPSESSID=fb6c7c7a548b6a271a75d623ce04cc9c

The answer to your question (which someone has already given in a
previous reply to you) is 

SELECT `User_name` , (replaces AND) `User_pass` FROM `user` 
WHERE `User_name` = '$_POST['user_id']' AND  '$_POST['user_id']'

-Original Message-
From: Rittwick Banerjee [mailto:[EMAIL PROTECTED] 
Sent: 23 May 2005 09:01
To: php-general@lists.php.net
Subject: [PHP] Php with mysql


Hi friends,

I am Rittwick Banerjee

Some one gave me an idea about that past php code that is :

$sql = SELECT `User_name` AND `User_pass` FROM
`user` 
WHERE `User_name` = '$_POST['user_id']' AND  '$_POST['user_id']' ;

but I found that it still not working ...
Plaese give me another code , by the way I am using Fedora 2(PCQ Linux
2004)

Thank you..

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

EOE

**
**


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



RE: [PHP] Php with mysql

2005-05-23 Thread Mark Rees
(posted again with another syntax error corrected)

This is a beginner's guide to SQL syntax, please review it
http://www.webdevelopersnotes.com/tutorials/sql/mysql_guide_querying_mys
ql_tables.php3?PHPSESSID=fb6c7c7a548b6a271a75d623ce04cc9c

The answer to your question (which someone has already given in a
previous reply to you) is 

SELECT `User_name` , (replaces AND) `User_pass` FROM `user` 
WHERE `User_name` = '$_POST['user_id']' AND (PASSWORD= ADDED HERE)
PASSWORD='$_POST['user_id']'

-Original Message-
From: Rittwick Banerjee [mailto:[EMAIL PROTECTED] 
Sent: 23 May 2005 09:01
To: php-general@lists.php.net
Subject: [PHP] Php with mysql


Hi friends,

I am Rittwick Banerjee

Some one gave me an idea about that past php code that is :

$sql = SELECT `User_name` AND `User_pass` FROM
`user` 
WHERE `User_name` = '$_POST['user_id']' AND  '$_POST['user_id']' ;

but I found that it still not working ...
Plaese give me another code , by the way I am using Fedora 2(PCQ Linux
2004)

Thank you..

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades,
D-Link, Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO
9001 2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not
the intended recipient, please notify the sender IMMEDIATELY; you should
not copy the email or use it for any purpose or disclose its contents to
any other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may
not necessarily reflect the view of Gamma Global (UK) Ltd. Be advised
that no content herein may be held binding upon Gamma Global (UK) Ltd or
any associated company unless confirmed by the issuance of a formal
contractual document or Purchase Order,  subject to our Terms and
Conditions available from http://www.gammaglobal.com

EOE

**
**


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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

EOE

**
**


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



RE: [PHP] Php with mysql

2005-05-23 Thread Jay Blanchard
[snip]
$sql = SELECT `User_name` AND `User_pass` FROM `user` WHERE `User_name`
= '$_POST['user_id']' AND  '$_POST['user_id']' ;
[/snip]

echo $sql; //to see the query and check the syntax

$sql = SELECT `User_name` AND `User_pass` FROM `user` WHERE `User_name`
= ' . $_POST['user_id'] . ' AND  ' . $_POST['user_id'] . ' ;

Your variables may not be parsed due to the single quotes.

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



[PHP] PHP 5, mySQL and Win XP. I NEED HELP

2005-05-09 Thread Rory Browne
Sorry - forgot to CC to list.

Personally I have a feeling that if you take out the :3306, your
script might just work.

I read somewhere that on unix, mysql used a unix socket whenever the
hostname was localhost. On unix localhost:something means that
something is a unix socket, when it would otherwise be a port, so I
think your system may be looking for a file named 3306(which would
just happen to be a socket.

Failing that replace localhost with 127.0.0.1

This is as well of course just a guess, and probably not a very educated one.


On 5/9/05, Richard Lynch [EMAIL PROTECTED] wrote:
 On Sat, May 7, 2005 4:56 am, Deep said:
  Hi,
 
   If you are using localhost, i dont think u need to
  specify the port number. Localhost would be enough.
  Also pls check the user privileges and all in the
  database.
 
  ..Deep..
 
  --- Oscar Andersson [EMAIL PROTECTED]
  wrote:
 
  I have made a instal of the latest mySQL and PHP 5
  on my computer.
  I have made the following changes to my php.ini file
 
  extension=php_mysql.dll
  extension_dir = c:\php\
 
  and i have put the php_mysql. and libmysql.dll in
  c:\php\ and in c:\windows
  to
 
  Now i try this in my php-file
  $con = mysql_connect(localhost:3306, buddy,
  bestbuddy);
 
  I cant connect to mySQL. I dont know what is wrong.
  mySQL listen to port
  3306. I have tried with my IP to. I get this warning
  Warning: mysql_connect() [function.mysql-connect]:
  Too many open links (0)
  in myfilename.php.

 Too many open links sounds to me like you've set up MySQL to only allow X
 connections, and you are trying to open up X+1 connection.

 The 0 would make me guess that X is 0.

 So I'd *GUESS* you have a setting in my.cnf that says to limit number of
 connections to 0, and that means you can't have any connections at all...

 Just a GUESS.

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



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



Re: [PHP] PHP 5, mySQL and Win XP. I NEED HELP

2005-05-08 Thread Richard Lynch
On Sat, May 7, 2005 4:56 am, Deep said:
 Hi,

  If you are using localhost, i dont think u need to
 specify the port number. Localhost would be enough.
 Also pls check the user privileges and all in the
 database.

 ..Deep..

 --- Oscar Andersson [EMAIL PROTECTED]
 wrote:

 I have made a instal of the latest mySQL and PHP 5
 on my computer.
 I have made the following changes to my php.ini file

 extension=php_mysql.dll
 extension_dir = c:\php\

 and i have put the php_mysql. and libmysql.dll in
 c:\php\ and in c:\windows
 to

 Now i try this in my php-file
 $con = mysql_connect(localhost:3306, buddy,
 bestbuddy);

 I cant connect to mySQL. I dont know what is wrong.
 mySQL listen to port
 3306. I have tried with my IP to. I get this warning
 Warning: mysql_connect() [function.mysql-connect]:
 Too many open links (0)
 in myfilename.php.

Too many open links sounds to me like you've set up MySQL to only allow X
connections, and you are trying to open up X+1 connection.

The 0 would make me guess that X is 0.

So I'd *GUESS* you have a setting in my.cnf that says to limit number of
connections to 0, and that means you can't have any connections at all...

Just a GUESS.

-- 
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 5, mySQL and Win XP. I NEED HELP

2005-05-07 Thread Deep
Hi,

 If you are using localhost, i dont think u need to
specify the port number. Localhost would be enough.
Also pls check the user privileges and all in the
database.

..Deep..

--- Oscar Andersson [EMAIL PROTECTED]
wrote:

 I have made a instal of the latest mySQL and PHP 5
 on my computer.
 I have made the following changes to my php.ini file
 
 extension=php_mysql.dll
 extension_dir = c:\php\
 
 and i have put the php_mysql. and libmysql.dll in
 c:\php\ and in c:\windows 
 to
 
 Now i try this in my php-file
 $con = mysql_connect(localhost:3306, buddy,
 bestbuddy);
 
 I cant connect to mySQL. I dont know what is wrong.
 mySQL listen to port 
 3306. I have tried with my IP to. I get this warning
 Warning: mysql_connect() [function.mysql-connect]:
 Too many open links (0) 
 in myfilename.php.
 
 
 I hope for help
 Oscar Andersson
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 



Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony

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



[PHP] PHP 5, mySQL and Win XP. I NEED HELP

2005-05-05 Thread Oscar Andersson
I have made a instal of the latest mySQL and PHP 5 on my computer.
I have made the following changes to my php.ini file

extension=php_mysql.dll
extension_dir = c:\php\

and i have put the php_mysql. and libmysql.dll in c:\php\ and in c:\windows 
to

Now i try this in my php-file
$con = mysql_connect(localhost:3306, buddy, bestbuddy);

I cant connect to mySQL. I dont know what is wrong. mySQL listen to port 
3306. I have tried with my IP to. I get this warning
Warning: mysql_connect() [function.mysql-connect]: Too many open links (0) 
in myfilename.php.


I hope for help
Oscar Andersson

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



Re: [PHP] PHP 5, mySQL and Win XP. I NEED HELP

2005-05-05 Thread bala chandar
hey

On 5/5/05, Oscar Andersson [EMAIL PROTECTED] wrote:
 I have made a instal of the latest mySQL and PHP 5 on my computer.
 I have made the following changes to my php.ini file
 
 extension=php_mysql.dll
 extension_dir = c:\php\
 
 and i have put the php_mysql. and libmysql.dll in c:\php\ and in c:\windows
 to
 
 Now i try this in my php-file
 $con = mysql_connect(localhost:3306, buddy, bestbuddy);

stop the mysql server and restart and again run your php script. there
might be some disk space constraint all be there

 
 I cant connect to mySQL. I dont know what is wrong. mySQL listen to port
 3306. I have tried with my IP to. I get this warning
 Warning: mysql_connect() [function.mysql-connect]: Too many open links (0)
 in myfilename.php.
 
 I hope for help
 Oscar Andersson
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
bala balachandar muruganantham
blog lynx http://chandar.blogspot.com
web http://www.chennaishopping.com

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



[PHP] PHP 4.3/MySQL phpinfo()

2005-04-05 Thread Todd Cary
I have installed FC 3 with Apache and MySQL.  When I run phpinfo(), I do 
not see MySQL listed as a database nor can I connect via php.

Does something have to be specially done with the FC 3 install?
Todd
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP 4.3/MySQL phpinfo()

2005-04-05 Thread Andy Pieters
On Tuesday 05 April 2005 23:35, Todd Cary wrote:
 Does something have to be specially done with the FC 3 install?

I kindly redirect you to google for LAMP which is short for Linux Apache MySQL 
PHP

I have also learned to setup this kind of system on Fedora Core 3. 

While you CAN rely on the rpms, you're better of compiling each yourself 
(exluding Linux).  For example, the precompiled rpms from Fedora (read Red 
Hat) do not include GD on php.

Required items:

An internet connection
A good deal of time
Much more patience
Much commitment.
Some reading glasses


Andy
-- 
Registered Linux User Number 379093
--
Feel free to check out these few
php utilities that I released under the GPL2 and 
that are meant for use with a php cli binary:
http://www.vlaamse-kern.com/sas/
--

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



RE: [PHP] PHP 4.3/MySQL phpinfo()

2005-04-05 Thread Chris W. Parker
Todd Cary mailto:[EMAIL PROTECTED]
on Tuesday, April 05, 2005 2:35 PM said:

 I have installed FC 3 with Apache and MySQL.  When I run phpinfo(), I
 do not see MySQL listed as a database nor can I connect via php.
 
 Does something have to be specially done with the FC 3 install?

Other than choosing the correct packages at install time, no. I
installed FC3 about two weeks ago, carefully selecting all my pakages,
and everything works fine.

If you've got time, I suggest you just reinstall update all the RPM's
via up2date (or yum or whatever). I think I finally got the install
right on the 3rd try.



Chris.

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



Re: [PHP] PHP/5.0.3 MySQL 5.0.2 Stored procedure (OUT)

2005-02-08 Thread Ian Porter
Curt Zirzow wrote:

 * Thus wrote Ian Porter:
 Hi,
 
 I am just wondering how to obtain the result from a mysql procedure OUT
 parameter within PHP e.g.
 
 MYSQL
 create procedure test_out(OUT testvar int)
 BEGIN
  select max_connections into testvar from mysql.user limit 1;
 END
 
 PHP
 
 $query = 'call test_out('.$test_val.')';
 $query_handle = mysql_query($query);
 
 You should really be using the mysqli* interface to mysql. It
 provides better ways to execute things like that.
 
 http://php.net/mysqli

Thanks very much, that did the trick.

Cheers
Ian
 
 
 Curt

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



[PHP] PHP/5.0.3 MySQL 5.0.2 Stored procedure (OUT)

2005-02-07 Thread Ian Porter
Hi,

I am just wondering how to obtain the result from a mysql procedure OUT 
parameter within PHP e.g.

MYSQL
create procedure test_out(OUT testvar int)
BEGIN
 select max_connections into testvar from mysql.user limit 1;
END

PHP

$query = 'call test_out('.$test_val.')';
$query_handle = mysql_query($query);

but there is nothing within the $test.val, after searching the web there 
appears to be something like this for oracle connection with the bind, but I 
cannot find the mysql version ?

Any advice ?

Cheers
Ian

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



Re: [PHP] PHP/5.0.3 MySQL 5.0.2 Stored procedure (OUT)

2005-02-07 Thread Curt Zirzow
* Thus wrote Ian Porter:
 Hi,
 
 I am just wondering how to obtain the result from a mysql procedure OUT 
 parameter within PHP e.g.
 
 MYSQL
 create procedure test_out(OUT testvar int)
 BEGIN
  select max_connections into testvar from mysql.user limit 1;
 END
 
 PHP
 
 $query = 'call test_out('.$test_val.')';
 $query_handle = mysql_query($query);

You should really be using the mysqli* interface to mysql. It
provides better ways to execute things like that.

http://php.net/mysqli


Curt
-- 
Quoth the Raven, Nevermore.

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



[PHP] PHP based mysql search tool

2005-01-26 Thread Daniel Baughman



I am looking for a full featured search tool I can plug into a couple of
databases via a php front end.

I currently have some of the text indexing done and have some basic search
setup, using mysql queries like 
select from table where match 'search term' against column;

But am looking for something like a prebuilt advance search tool that I
can just plug in some variables into and have functional. Anyone know of
anything like that?

 
Dan Baughman
IT Technician
Professional Bull Riders, Inc.
 

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



Re: [PHP] PHP any Mysql connection- new b

2005-01-09 Thread Zareef Ahmed
On Sat, 8 Jan 2005 16:10:47 + (GMT), babu [EMAIL PROTECTED] wrote:
 Hi all,
 
 I am using php 3.0 and mysql and win xp.
 i want to add users to database through php page.
 
 adduser.php
 html
 FORM METHOD=post ACTION=add.php
 Real Name: INPUT TYPE=text MAXLENGTH=70 NAME=real_name SIZE=20Br
 Username: INPUT TYPE=text MAXLENGTH=70 NAME=username SIZE=20Br
 Password: Input Type=text Maxlength=70 Name=userpass Size=10Br
 
 INPUT TYPE=submit VALUE=Add INPUT type=reset VALUE=Reset Form/form
 /tr/td/table/tr/td/table
 /body
 /html
 
 when i enter the fileds and submit ,the action is not performed, instead 
 add.php file is opened.
What do you mean by it? You have action as add.php then it must be
opened. Are you getting all page code in plain text? If so please
check your php installation.
BTW php3 is outdated and I never see it running on Apache 2 with win xp.

zareef ahmed 




 add.php
 ?
 
 $ID = uniqid(userID);
 
 $db = mysql_connect(localhost,root,halfdinner);
 
 mysql_select_db (userpass);
 
 $result = mysql_query (INSERT INTO users (id, real_name, username, password )
 VALUES ('$ID', '$real_name', '$username', '$userpass') );
 if(!$result)
 {
 echo bUser not added:/b , mysql_error();
 exit;
 }
 if($result)
 {
 mysql_close($db);
 print User b$username/b added sucessfully!;
 }
 else
 {
 print (Wrong Password);
 }
 ?
 
 is the problem due to mysql and php connection.i am using windows xp with 
 apache2.
 
 i followed the steps said by someone in the previous thread.that is adding 
 libmysql.dll to system32 and so on. I cannot find php_mysql.dll in php.ini.
 can some one help
 
 Thanks
 babu
 
 
 -
  ALL-NEW Yahoo! Messenger - all new features - even more fun!
 


-- 
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

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



[PHP] PHP any Mysql connection- new b

2005-01-08 Thread babu
Hi all,

I am using php 3.0 and mysql and win xp.
i want to add users to database through php page.

adduser.php 
html 
FORM METHOD=post ACTION=add.php 
Real Name: INPUT TYPE=text MAXLENGTH=70 NAME=real_name SIZE=20Br 
Username: INPUT TYPE=text MAXLENGTH=70 NAME=username SIZE=20Br 
Password: Input Type=text Maxlength=70 Name=userpass Size=10Br 

INPUT TYPE=submit VALUE=Add INPUT type=reset VALUE=Reset Form/form 
/tr/td/table/tr/td/table 
/body 
/html 

when i enter the fileds and submit ,the action is not performed, instead 
add.php file is opened.

add.php
? 

$ID = uniqid(userID); 

$db = mysql_connect(localhost,root,halfdinner); 

mysql_select_db (userpass); 

$result = mysql_query (INSERT INTO users (id, real_name, username, password ) 
VALUES ('$ID', '$real_name', '$username', '$userpass') ); 
if(!$result) 
{ 
echo bUser not added:/b , mysql_error(); 
exit; 
} 
if($result) 
{ 
mysql_close($db); 
print User b$username/b added sucessfully!; 
} 
else 
{ 
print (Wrong Password); 
} 
? 

is the problem due to mysql and php connection.i am using windows xp with 
apache2.

i followed the steps said by someone in the previous thread.that is adding 
libmysql.dll to system32 and so on. I cannot find php_mysql.dll in php.ini.
can some one help
 
Thanks
babu
   


-
 ALL-NEW Yahoo! Messenger - all new features - even more fun!  

[PHP] PHP 5 MySql 4.1 issue - can't connect to mysql.sock

2004-12-18 Thread Barley
I am familiar with MySql, Linux and database programming in general, but I
have not used PHP very much.

On my server, I had an application running just fine under PHP 4.1 and MySql
3.23. For various reasons, I needed to move to MySql 4.1. When I did so, the
PHP application was broken. I poked around and found that I needed to
upgrade to PHP 5 to get mysqli support. I did so with no problems. I built
PHP from source on a RedHat 7.3 box.

Here's the problem: I can only connect to MySql via a PHP script if I run
that script as root. Here is the example script I have been using:

?php
$DB = mysqli_connect(localhost,user,pass);
if (! $DB) {
echo No.;
} else {
echo Yes.;
}
?

If I run the script from a shell prompt as root, it outputs Yes. If I run
as any other user, it outputs No. It also gives this error:
Warning: mysqli_connect(): Can't connect to local MySQL server through
socket '/var/lib/mysql/mysql.sock' (13)

This means I can't run PHP scripts via apache.

I can log in to mysql via the command line with user/pass without any
problems.

Apache is connecting to PHP no problem, as I have a Hello world type PHP
script running and can access it via the web.

But no PHP script can connect to MySql unless it is run as root...

Can anyone point me in the right direction? I have a feeling this is
something very simple. Thanks!

Gregg



[PHP] PHP info: MySQL client API version: 3.23?

2004-11-24 Thread Olaf van der Spek
In the phpinfo() output, the MySQL client API version is shown as 3.23.49.
Shouldn't this be upgraded to 4.1 (generally available/stable)?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP info: MySQL client API version: 3.23?

2004-11-24 Thread Steve Buehler
At 07:38 AM 11/24/2004, you wrote:
In the phpinfo() output, the MySQL client API version is shown as 3.23.49.
Shouldn't this be upgraded to 4.1 (generally available/stable)?

To do so, you would need to upgrade it.  I know I am being a smartaleck 
when I say this, but it won't upgrade on its own and it won't upgrade just 
because you upgraded just PHP itself.  PHP only reads what the version is 
from what you have installed, not something that is internal to PHP 
itself.  So if you upgrade your mysql, it will show you a different version 
when you run your phpinfo.  Here is an rpm -qa result from one of my machines:
[root]# rpm -qa|grep mysql
php-mysql-4.3.2-14.ent
mysql-server-3.23.58-1
libdbi-dbd-mysql-0.6.5-5
mysql-devel-3.23.58-2.3
mysql-3.23.58-2.3

My phpinfo client API shows: 3.23.58
Which would be because that is the version of mysql that I am running.  My 
mysql, mysql-server and mysql-devel are all 3.23.58.  Only my php-mysql 
module is 4.3.2-14

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


Re: [PHP] PHP info: MySQL client API version: 3.23?

2004-11-24 Thread John Nichel
Steve Buehler wrote:
To do so, you would need to upgrade it.  I know I am being a smartaleck 
when I say this, but it won't upgrade on its own and it won't upgrade 
just because you upgraded just PHP itself.  PHP only reads what the 
version is from what you have installed, not something that is internal 
to PHP itself.  So if you upgrade your mysql, it will show you a 
different version when you run your phpinfo.  Here is an rpm -qa result 
from one of my machines:
[root]# rpm -qa|grep mysql
php-mysql-4.3.2-14.ent
mysql-server-3.23.58-1
libdbi-dbd-mysql-0.6.5-5
mysql-devel-3.23.58-2.3
mysql-3.23.58-2.3

My phpinfo client API shows: 3.23.58
Which would be because that is the version of mysql that I am running.  
My mysql, mysql-server and mysql-devel are all 3.23.58.  Only my 
php-mysql module is 4.3.2-14
No, this is not the case.  If you install with RPM, or you compile from 
source and only use --with-mysql, the client API is going to be whatever 
was bundled with PHP at the time.  Update your MySQL version, and you're 
phpinfo will still show the 3.23.58 client library.  The only way to 
change this in PHP4 is to configure and compile php with the version of 
MySQL _you_ have installedotherwise, it will use the bundled MySQL 
client.

--
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 info: MySQL client API version: 3.23?

2004-11-24 Thread Olaf van der Spek
On Wed, 24 Nov 2004 10:37:19 -0600, Steve Buehler [EMAIL PROTECTED] wrote:
 At 07:38 AM 11/24/2004, you wrote:
 
 In the phpinfo() output, the MySQL client API version is shown as 3.23.49.
 Shouldn't this be upgraded to 4.1 (generally available/stable)?
 
 To do so, you would need to upgrade it.  I know I am being a smartaleck

;-

 when I say this, but it won't upgrade on its own and it won't upgrade just
 because you upgraded just PHP itself.  PHP only reads what the version is
 from what you have installed, not something that is internal to PHP
 itself.  So if you upgrade your mysql, it will show you a different version
 when you run your phpinfo.  Here is an rpm -qa result from one of my machines:
 [root]# rpm -qa|grep mysql
 php-mysql-4.3.2-14.ent
 mysql-server-3.23.58-1
 libdbi-dbd-mysql-0.6.5-5
 mysql-devel-3.23.58-2.3
 mysql-3.23.58-2.3
 
 My phpinfo client API shows: 3.23.58
 Which would be because that is the version of mysql that I am running.  My
 mysql, mysql-server and mysql-devel are all 3.23.58.  Only my php-mysql
 module is 4.3.2-14

But on a up2date Debian Linux Sarge server with MySQL 4.0 and PHP
4.3.9, it still shows 3.23.56
On a Windows XP server with MySQL 4.1 and PHP 4.3.10 (RC1) it shows 3.23.49.

So what exactly do I need to upgrade?

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



Re: [PHP] PHP info: MySQL client API version: 3.23?

2004-11-24 Thread Olaf van der Spek
John Nichel wrote:
Steve Buehler wrote:
My phpinfo client API shows: 3.23.58
Which would be because that is the version of mysql that I am 
running.  My mysql, mysql-server and mysql-devel are all 3.23.58.  
Only my php-mysql module is 4.3.2-14

No, this is not the case.  If you install with RPM, or you compile from 
source and only use --with-mysql, the client API is going to be whatever 
was bundled with PHP at the time.  Update your MySQL version, and you're 
phpinfo will still show the 3.23.58 client library.  The only way to 
change this in PHP4 is to configure and compile php with the version of 
MySQL _you_ have installedotherwise, it will use the bundled MySQL 
client.
But why is the bundled client not upgraded?
Aren't 4.0 and 4.1 clients backwards compatible with 3.23 server?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP info: MySQL client API version: 3.23?

2004-11-24 Thread John Nichel
Olaf van der Spek wrote:
But why is the bundled client not upgraded?
Aren't 4.0 and 4.1 clients backwards compatible with 3.23 server?
Why they didn't upgrade the bundle to include the 4.0 release, I don't 
know.  However with the password 'issues' between 4.1 and earlier 
versions, I'm sure that's a good reason not to bundle the 4.1 client. 
Bundled support has been dropped in php5.

--
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 info: MySQL client API version: 3.23?

2004-11-24 Thread Steve Buehler
At 10:59 AM 11/24/2004, you wrote:
On Wed, 24 Nov 2004 10:37:19 -0600, Steve Buehler [EMAIL PROTECTED] wrote:
 At 07:38 AM 11/24/2004, you wrote:

 In the phpinfo() output, the MySQL client API version is shown as 3.23.49.
 Shouldn't this be upgraded to 4.1 (generally available/stable)?

 To do so, you would need to upgrade it.  I know I am being a smartaleck
;-
 when I say this, but it won't upgrade on its own and it won't upgrade just
 because you upgraded just PHP itself.  PHP only reads what the version is
 from what you have installed, not something that is internal to PHP
 itself.  So if you upgrade your mysql, it will show you a different version
 when you run your phpinfo.  Here is an rpm -qa result from one of my 
machines:
 [root]# rpm -qa|grep mysql
 php-mysql-4.3.2-14.ent
 mysql-server-3.23.58-1
 libdbi-dbd-mysql-0.6.5-5
 mysql-devel-3.23.58-2.3
 mysql-3.23.58-2.3

 My phpinfo client API shows: 3.23.58
 Which would be because that is the version of mysql that I am running.  My
 mysql, mysql-server and mysql-devel are all 3.23.58.  Only my php-mysql
 module is 4.3.2-14

But on a up2date Debian Linux Sarge server with MySQL 4.0 and PHP
4.3.9, it still shows 3.23.56
On a Windows XP server with MySQL 4.1 and PHP 4.3.10 (RC1) it shows 3.23.49.
So what exactly do I need to upgrade?
I have already been corrected on what I said.  I guess you learn something 
new and different every day.  Anyway, John Nichel did the correction.  You 
might want to read his email.  I didn't think it worked that way, but maybe 
I am wrongI usually am. :)

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


Re: [PHP] PHP info: MySQL client API version: 3.23?

2004-11-24 Thread Olaf van der Spek
John Nichel wrote:
Olaf van der Spek wrote:
But why is the bundled client not upgraded?
Aren't 4.0 and 4.1 clients backwards compatible with 3.23 server?
Why they didn't upgrade the bundle to include the 4.0 release, I don't 
know.  However with the password 'issues' between 4.1 and earlier 
versions, I'm sure that's a good reason not to bundle the 4.1 client. 
Isn't that only an issue for  4.1 clients and = 4.1 servers and not 
for the 'other way around'?
I was actually asking because I have a 4.1 server and I couldn't use PHP 
to connect, because it doesn't support new passwords.

Bundled support has been dropped in php5.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP info: MySQL client API version: 3.23?

2004-11-24 Thread John Nichel
Olaf van der Spek wrote:
snip
Isn't that only an issue for  4.1 clients and = 4.1 servers and not 
for the 'other way around'?
I was actually asking because I have a 4.1 server and I couldn't use PHP 
to connect, because it doesn't support new passwords.
It works both ways.  You can make your 4.1 client treat passwords as 
=4.0, and your 4.1 server accept older passwords.  If you want the 4.1 
client used in PHP, you'll have to compile it from source and use PHP5. 
 I don't think php4 supports 4.1 (mysql vs mysqli).

--
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 info: MySQL client API version: 3.23?

2004-11-24 Thread Olaf van der Spek
John Nichel wrote:
Olaf van der Spek wrote:
snip
Isn't that only an issue for  4.1 clients and = 4.1 servers and not 
for the 'other way around'?
I was actually asking because I have a 4.1 server and I couldn't use 
PHP to connect, because it doesn't support new passwords.

It works both ways.  You can make your 4.1 client treat passwords as 
=4.0, and your 4.1 server accept older passwords.  If you want the 4.1 
Where in the client lib can you change that?
I thought = 4.1 clients would automatically use  4.1 passwords if 
connecting to a  4.1 server.

client used in PHP, you'll have to compile it from source and use PHP5. 
 I don't think php4 supports 4.1 (mysql vs mysqli).


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


[PHP] php with mysql ( support data manipulation or not )??

2004-08-19 Thread ayman amin
Hi , 

Regarding to php with mysql , if the php with mysql implement data manipulating like 
(insert , update , delete ..etc) or just implement the query operation only ??.

Best Regards,,
ayman amin
Egypt - Cairo 

RE: [PHP] php with mysql ( support data manipulation or not )??

2004-08-19 Thread Jay Blanchard
[snip]
Regarding to php with mysql , if the php with mysql implement data
manipulating like (insert , update , delete ..etc) or just implement the
query operation only ??.
[/snip]

You can do any SQL operation with PHP and MySQL.

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



[PHP] PHP and MySQL Installation on Apache for Windows

2004-07-15 Thread Sean Vasey
Does anyone know how to get PHP to detect MySQL after it has been installed and is 
running on an Apache 1.3.1 server for Windows? Any help would be greatly appreciated.


[PHP] PHP + Multiple MySQL-4.0.20

2004-06-07 Thread Minuk Choi
I have a RedHat9 machine.

I needed to have multiple MySQL installations, so I removed the RPM
installation and did a binary installation of MySQL-4.0.20.  As it stands, I
have the following installations

/usr/local/mysql-4.0.20-webpage
/usr/local/mysql-4.0.20-exp
/usr/local/mysql-4.0.20-def

These are all the same BINARY installations of MySQL-4.0.20, I just need to
have 3 distinct set of mysql databases(along with their specific custom
database/tables).  It seems to have worked, as I can get the mysql instances
up and running.

BUT, I can't seem to make PHP access these databases.  More specifically,
phpMyAdmin-2.5.6 says

cannot load MySQL extension,
please check PHP Configuration.
Documentation

I haven't a clue as to how to resolve this.  My guess is, like the MySQL
RPM, uninstall it and do a non-RPM install...

If I get the source and run configure... it seems like the --with-mysql=
field only takes 1 mysql path.  What should I do in my case, where there are
3 paths, 3 sockets, and 3 ports on which mysql resides?

Thanks in advance,

-Minuk

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



Re: [PHP] PHP + Multiple MySQL-4.0.20

2004-06-07 Thread Curt Zirzow
* Thus wrote Minuk Choi ([EMAIL PROTECTED]):
 I have a RedHat9 machine.
 
 I needed to have multiple MySQL installations, so I removed the RPM
 installation and did a binary installation of MySQL-4.0.20.  As it stands, I
 have the following installations
 
 /usr/local/mysql-4.0.20-webpage
 /usr/local/mysql-4.0.20-exp
 /usr/local/mysql-4.0.20-def

This seems a little odd. You should be able to use the same
binaries with different startup scripts. But if its working no need
to step backward and redo you're mysql installation.

 
 BUT, I can't seem to make PHP access these databases.  More specifically,
 phpMyAdmin-2.5.6 says

To get more detailed information as what is happening try this:

php -d display_errors=On \
-d display_startup_errors=On \
-d error_reporting=E_ALL \
-r mysql_connect()

 
 cannot load MySQL extension,
 please check PHP Configuration.
 Documentation
 

solution 1 (recommended):
remove the php rpm and install from source. this can be a nightmare
since most *-dev rpm's wont be installed.


solution 2:
you're going to need to rebuild the mysql.so that it is looking at
the right mysqlclient. And change you're php.ini settings to the
appropriate port/socket

In theory you can do something like this:
 - download exact version of php's source used with redhat.
 - extract and issue the following commands:

   cd php-4.x.x/ext/mysql
   phpize
   ./configure --with-mysql=shared,/usr/local/mysql-4.x.x-webpage
   make
   su 
   make install

This will make the mysql.so and should place it in the right place,
see the /etc/php.ini:extension_dir setting for the right place.


As for you mysql port settings see:

php.ini:
mysql.default_port = ;set to mysql-webpage mysql port
mysql.default_socket =   ;set to mysql-webpage mysql socket



Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



[PHP] php/apache/mysql on ntfs

2004-04-24 Thread Andy B
hi...
we are upgrading test servers to xp home and want to know if its possible to
run php/apache/mysql and all that sort of stuff on ntfs or does the servers
have to run fat32??

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



Fw: [PHP] php/apache/mysql on ntfs

2004-04-24 Thread Andy B
does anybody have any idea why this message keeps coming up every time i
send a msg to the list?? im sort of confused now

- Original Message - 
From: [EMAIL PROTECTED]
To: Andy B [EMAIL PROTECTED]
Sent: Saturday, April 24, 2004 7:17 AM
Subject: NDN: [PHP] php/apache/mysql on ntfs


 Sorry. Your message could not be delivered to:

 PHP Net List [Conference] (Mailbox or Conference is full.)



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



Re: [PHP] php/apache/mysql on ntfs

2004-04-24 Thread -{ Rene Brehmer }-
Sure you can :) ... I've been doing it for a very long time now ... works
alot better than FAT32 actually ... much faster...

The programs don't care about the file system, that's for the OS to deal
with. Only pure DOS programs have problems with the NTFS ... for all other
programs they can't see what FS it is anyway, since it's not for them to
worry about ... 


Rene

According to historical records, on Sat, 24 Apr 2004 07:18:40 -0400 Andy B
wrote about [PHP] php/apache/mysql on ntfs:

hi...
we are upgrading test servers to xp home and want to know if its possible to
run php/apache/mysql and all that sort of stuff on ntfs or does the servers
have to run fat32??

-- 
Rene Brehmer
aka Metalbunny

~ If you don't like what I have to say ... don't read it ~

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums at http://forums.metalbunny.net/

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



Re: [PHP] php/apache/mysql on ntfs

2004-04-24 Thread -{ Rene Brehmer }-
Because someone that's subscribed to the list has a full mailbox ... I get
it too ... all the time ... just like the address harvesters masquerading as
banks ... Advance Credit Suisse Bank [EMAIL PROTECTED] and
Information Desk [EMAIL PROTECTED]


Rene

According to historical records, on Sat, 24 Apr 2004 07:28:07 -0400 Andy B
wrote about Fw: [PHP] php/apache/mysql on ntfs:

does anybody have any idea why this message keeps coming up every time i
send a msg to the list?? im sort of confused now

- Original Message - 
From: [EMAIL PROTECTED]
To: Andy B [EMAIL PROTECTED]
Sent: Saturday, April 24, 2004 7:17 AM
Subject: NDN: [PHP] php/apache/mysql on ntfs


 Sorry. Your message could not be delivered to:

 PHP Net List [Conference] (Mailbox or Conference is full.)



-- 
Rene Brehmer
aka Metalbunny

~ If you don't like what I have to say ... don't read it ~

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums at http://forums.metalbunny.net/

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



Re: Fw: [PHP] php/apache/mysql on ntfs

2004-04-24 Thread Curt Zirzow
* Thus wrote Andy B ([EMAIL PROTECTED]):
 does anybody have any idea why this message keeps coming up every time i
 send a msg to the list?? im sort of confused now

I've gotten so used to them now, that I consider them receipts that
my messages have been posted to everyone :)


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



RE: [PHP] php and mysql help

2004-04-17 Thread David Robley
[EMAIL PROTECTED] (Jay Blanchard) wrote in 
news:[EMAIL PROTECTED]:

 Why are you sending this to me? You're at Stanford, you can probably
 figure out the unsubscribe link and stuff
 
 -Original Message-
 From: David A. Stevens [mailto:[EMAIL PROTECTED] 
 Sent: Friday, April 16, 2004 12:41 PM
 To: Jay Blanchard
 Subject: RE: [PHP] php and mysql help
 
 
 Please remove my address from any future correspondence about PHP.
 

Jay, you are confusing persons at a university with persons who may have a 
Clue [TM]

David (also recipient of this message)

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



RE: [PHP] php and mysql help

2004-04-16 Thread Jay Blanchard
Why are you sending this to me? You're at Stanford, you can probably
figure out the unsubscribe link and stuff

-Original Message-
From: David A. Stevens [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 16, 2004 12:41 PM
To: Jay Blanchard
Subject: RE: [PHP] php and mysql help


Please remove my address from any future correspondence about PHP.

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



[PHP] php and mysql help

2004-04-14 Thread webmaster
Hello i need help with mysql_create_db i found the solution once but cant remember 
what it was if someone could tell me the proper way to create a database with php and 
mysql i would be greatly thankfull.
Thank you.


Re: [PHP] php and mysql help

2004-04-14 Thread Curt Zirzow
* Thus wrote webmaster ([EMAIL PROTECTED]):
 Hello i need help with mysql_create_db i found the solution once but cant remember 
 what it was if someone could tell me the proper way to create a database with php 
 and mysql i would be greatly thankfull.

You just need to issue a create database statement passed to
mysql_query()

mysql_create_db() is depricated and isn't available in php that is
compiled with the mysql4 client libraries.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



RE: [PHP] php and mysql help

2004-04-14 Thread Jay Blanchard
[snip]
Hello i need help with mysql_create_db i found the solution once but
cant remember what it was if someone could tell me the proper way to
create a database with php and mysql i would be greatly thankfull.
Thank you.
[/snip]

http://www.php.net/mysql_create_db
You're welcome.

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



[PHP] php with mysql COUNT, DISTINCT syntax, might be a bit 0T

2004-02-09 Thread Ryan A
Hi,
I have a table where a users details are entered for the products he bought,
the only part that is repeated is the order_id,
I basically need to only get the order per person, and paginate for all the
customers

eg:
if user tom bought 3 items in the database it would be entered as:
order_id  item_name
023 soap
023 brush
023 towel

So i am trying this:
$num_rows = mysql_result(mysql_query(SELECT COUNT(*),
DISTINCT(order_number)   FROM .$prefix._purchases),0);

(the idea being taht $num_rows will give my paginating part of the program
the total number of records
that match my search.)


which gives me the most pretty error of:
Warning: mysql_result(): supplied argument is not a valid MySQL result
resource in \www\p\admin\show_purc.php on line 9

I''m pretty sure the problem is in my SQL statement, but have had no luck
searching and reading in the mysql manual for
count with distinct but am pretty sure it can be done as i have not
found anything saying the opposite...any ideas?

Thanks,
-Ryan

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



Re: [PHP] php with mysql COUNT, DISTINCT syntax, might be a bit 0T

2004-02-09 Thread Shaunak Kashyap
Try this:

SELECT COUNT(*), order_number FROM  . $prefix . _purchases GROUP BY
order_number

as your query.

Shaunak

- Original Message - 
From: Ryan A [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, February 09, 2004 8:36 PM
Subject: [PHP] php with mysql COUNT, DISTINCT syntax, might be a bit 0T


 Hi,
 I have a table where a users details are entered for the products he
bought,
 the only part that is repeated is the order_id,
 I basically need to only get the order per person, and paginate for all
the
 customers

 eg:
 if user tom bought 3 items in the database it would be entered as:
 order_id  item_name
 023 soap
 023 brush
 023 towel

 So i am trying this:
 $num_rows = mysql_result(mysql_query(SELECT COUNT(*),
 DISTINCT(order_number)   FROM .$prefix._purchases),0);

 (the idea being taht $num_rows will give my paginating part of the program
 the total number of records
 that match my search.)


 which gives me the most pretty error of:
 Warning: mysql_result(): supplied argument is not a valid MySQL result
 resource in \www\p\admin\show_purc.php on line 9

 I''m pretty sure the problem is in my SQL statement, but have had no luck
 searching and reading in the mysql manual for
 count with distinct but am pretty sure it can be done as i have not
 found anything saying the opposite...any ideas?

 Thanks,
 -Ryan

 -- 
 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 with mysql COUNT, DISTINCT syntax, might be a bit 0T

2004-02-09 Thread Ryan A
Hey,
Thanks for replying.

Nope, that didnt work, but i modified my search terms on google and kept on
trying with different search terms and got the solution here:
http://dbforums.com/arch/230/2002/11/623223

Cheers,
-Ryan


On 2/10/2004 3:14:21 AM, Shaunak Kashyap ([EMAIL PROTECTED])
wrote:
 Try this:

 SELECT COUNT(*), order_number FROM  . $prefix .
 _purchases GROUP BY
 order_number

 as your query.

 Shaunak

 - Original Message -
 From: Ryan A [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, February 09, 2004 8:36 PM
 Subject: [PHP] php with mysql COUNT, DISTINCT syntax, might be a bit 0T


  Hi,
  I have a table where a users details are entered for the products he
 bought,
  the only part that is repeated is the order_id,
  I basically need to only get the order per person, and paginate for all
 the
  customers
 
  eg:
  if user tom bought 3 items in the database it would be entered as:
  order_id  item_name
  023 soap
  023 brush
  023 towel
 
  So i am trying this:
  $num_rows =
 mysql_result(mysql_query(SELECT COUNT(*),
  DISTINCT(order_number)   FROM .
 $prefix._purchases),0);
 
  (the idea being taht $num_rows will give my paginating part of the
 program
  the total number of

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



[PHP] PHP and MySQL date

2003-12-15 Thread Cesar Aracena
Hi all,

I'm making a site and need some tables from wich I can extract date, time
and/or date/time later with PHP and I neved had very clear the way the
possible formats work with each other so my question is what is the best (or
recommended) method to store dates and/or times in a MySQL DB for PHP to
work later?

Thanks in advanced,
___
Cesar L. Aracena
Commercial Manager / Developer
ICAAM Web Solutions
2K GROUP
Neuquen, Argentina
Tel: +54.299.4774532
Cel: +54.299.6356688
E-mail: [EMAIL PROTECTED]

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



  1   2   3   >