[PHP] Re: PHP Udate MySQL command

2010-06-04 Thread Gary

Sorry, just noticed that I had this line in the post.  (should not post 
before coffee).

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

It is supposed to be

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


Gary gwp...@ptd.net wrote in message 
news:49.e6.07323.599d8...@pb1.pair.com...
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



 



__ 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] Re: PHP and MySQL SELECT COUNT (*)

2008-09-18 Thread Vinny Gullotta
Thanks all, I appreciate the follow ups and the help with the code. I'm 
still relatively new with this stuff, and never had any formal training, 
it's all just been learn as I go, and I have to learn fast as this project 
is relatively urgent to get completed. I plan on going through all of my 
code on all of these pages and cleaning it up at the end to make it more 
efficient, so I will use these tips to help do that.


Thanks again to all who helped troubleshoot this. It is working great now 
and I think my bosses will be happy. =D



Nathan Rixham [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

learn something new every day! cheers Micah :)

Micah Gersten wrote:

While it's true that '.' concatenates and ',' is a list separator, The
comma is actually more appropriate in this instance since you are just
outputting each piece.  It saves the overhead of concatenation before
output.

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



Nathan Rixham wrote:

6:  vs '
when you use  php will parse the enclosed string for variables, when
you use ' it won't; so ' leads for faster code, and also encourages
you to code strongly by closing strings and concatenating variables.
Further it allows you to use valid html  around attributes rather
than the invalid '

7: , vs .
there is no vs :) to concatenate we use . (period) not , (comma)

so for 6  7..
echo 'td' . $i['servername'] . '/td';

I'm going to stop there, hope it helps a little bit; and I won't go
any further as half the fun is learning; so you finding out how to
save time on queries and write your own db handlers etc is not my
domain I reckons

Regards

nathan




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



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

2008-09-17 Thread Nathan Rixham

Vinny Gullotta 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;


just a few little notes.. because I'm like this today

(none of it is a you must do, or meant badly, just aiming to save you 
some time by passing on a few *things*)


1: SQL
in mysql queries /should/ use backticks (`) around database, table and 
column names, stop's them getting confused with variables or reserved 
words (like timestamp) and saves you future trouble :)


further, you'll be needing to use AS to turn COUNT(steps) into a nice 
name like stepcount


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


2: you should be cleaning those posts before you add them to a mysql 
query; this has been covered many times so I won't repost it 
(mysql_real_escape() or sprintf or.. many different methods]


3: Needless multiple echo's; one will suffice just fine and show it up 
in your editor as a nice easily visible block of html :)


echo 'centertable class=tabletr
td class=tableHeadercentersmallbCount/b/small/td
td class=tableHeadercentersmallbServer Name/b/small/td
/tr';

4: valid xhtml; in my opinion there's no excuse now; it's been years 
since it came out (and you're already using css); this will do the same 
as above:

echo 'table class=center
tr
thCount/th
thServer Name/th
/tr';

[css to center the table would be]
table.center {
margin: 0 auto;
}

5: mysql_fetch_row() returns a numerical indexed array.. not associative 
thus:

$i = mysql_fetch_row($result)
print_r($i);

will show..
$i[0] = the server name
$i[1] = stepcount value

you'll be needing
$i = mysql_fetch_assoc($result);
print_r($i);

which will show
$i['servername'] = the server name
$i['stepcount'] = stepcount value

6:  vs '
when you use  php will parse the enclosed string for variables, when 
you use ' it won't; so ' leads for faster code, and also encourages you 
to code strongly by closing strings and concatenating variables.
Further it allows you to use valid html  around attributes rather than 
the invalid '


7: , vs .
there is no vs :) to concatenate we use . (period) not , (comma)

so for 6  7..
echo 'td' . $i['servername'] . '/td';

I'm going to stop there, hope it helps a little bit; and I won't go any 
further as half the fun is learning; so you finding out how to save time 
on queries and write your own db handlers etc is not my domain I reckons


Regards

nathan

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



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

2008-09-17 Thread Micah Gersten
While it's true that '.' concatenates and ',' is a list separator, The
comma is actually more appropriate in this instance since you are just
outputting each piece.  It saves the overhead of concatenation before
output.

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



Nathan Rixham wrote:

 6:  vs '
 when you use  php will parse the enclosed string for variables, when
 you use ' it won't; so ' leads for faster code, and also encourages
 you to code strongly by closing strings and concatenating variables.
 Further it allows you to use valid html  around attributes rather
 than the invalid '

 7: , vs .
 there is no vs :) to concatenate we use . (period) not , (comma)

 so for 6  7..
 echo 'td' . $i['servername'] . '/td';

 I'm going to stop there, hope it helps a little bit; and I won't go
 any further as half the fun is learning; so you finding out how to
 save time on queries and write your own db handlers etc is not my
 domain I reckons

 Regards

 nathan


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



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

2008-09-17 Thread Nathan Rixham

learn something new every day! cheers Micah :)

Micah Gersten wrote:

While it's true that '.' concatenates and ',' is a list separator, The
comma is actually more appropriate in this instance since you are just
outputting each piece.  It saves the overhead of concatenation before
output.

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



Nathan Rixham wrote:

6:  vs '
when you use  php will parse the enclosed string for variables, when
you use ' it won't; so ' leads for faster code, and also encourages
you to code strongly by closing strings and concatenating variables.
Further it allows you to use valid html  around attributes rather
than the invalid '

7: , vs .
there is no vs :) to concatenate we use . (period) not , (comma)

so for 6  7..
echo 'td' . $i['servername'] . '/td';

I'm going to stop there, hope it helps a little bit; and I won't go
any further as half the fun is learning; so you finding out how to
save time on queries and write your own db handlers etc is not my
domain I reckons

Regards

nathan



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



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

2008-09-17 Thread Chris



1: SQL
in mysql queries /should/ use backticks (`) around database, table and 
column names, stop's them getting confused with variables or reserved 
words (like timestamp) and saves you future trouble :)


.. which is a mysql-ism - no other database supports this. As soon as 
you need to use another db (regardless of whether it's this application 
or not), you're stuffed.


For reserved word column names, you don't have much choice but don't do 
that in the first place ;)


http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html

Other db's will have a similar list - though in most cases, if it's a 
function or sql keyword (eg 'table'), it'll be reserved in all.


further, you'll be needing to use AS to turn COUNT(steps) into a nice 
name like stepcount


Which is also a mysql-ism. Most other db's don't let you use aggregate 
aliases in an order by clause (I think because the sql standard says 
don't do that).


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


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



Re: [PHP] Re: [PHP-INSTALL] MySQL connector installation/upgrade problems

2007-10-23 Thread David Christopher Zentgraf

On  23. Oct 2007, at 20:33, Colin Guthrie wrote:


If you compile PHP and it finds v3 of mysql that means that you must
have the old development libraries for mysql 3 installed in some
capacity (I believe).

What is the output of:
rpm -qa --nosignature --nodigest | grep -i mysql

This should give some clues.


$ rpm -qa --nosignature --nodigest | grep -i mysql
MySQL-server-community-5.0.45-0.rhel3
mod_auth_mysql-20030510-2.ent
MySQL-shared-compat-5.0.45-0.rhel3
MySQL-client-community-5.0.45-0.rhel3
mysql-bench-3.23.58-16.RHEL3.1
MySQL-python-0.9.1-6
libdbi-dbd-mysql-0.6.5-5
perl-DBD-MySQL-2.1021-4.EL3
qt-MySQL-3.1.2-17.RHEL3
php-mysql-4.3.2-43.ent
MySQL-devel-community-5.0.45-0.rhel3

Now I'm even more confused, the 5.0.45 devel package *is* there.

I would imagine (don't know) that PHP would use the mysql_config  
program

to work out which mysql is installed and get the relevent cflags and
linking options. For me this is provided by the
MySQL-devel-community-5.0.27 package from MySQL... Is this definitely
installed?


$ mysql_config
Usage: /usr/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/include/mysql -g -pipe -march=i386 - 
mcpu=i686]

--include[-I/usr/include/mysql]
--libs   [-L/usr/lib/mysql -lmysqlclient -lz -lcrypt  
-lnsl -lm]
--libs_r [-L/usr/lib/mysql -lmysqlclient_r -lz - 
lpthread -lcrypt -lnsl -lm -lpthread]

--socket [/var/lib/mysql/mysql.sock]
--port   [3306]
--version[5.0.45]
--libmysqld-libs [-L/usr/lib/mysql -lmysqld -lz -lpthread - 
lcrypt -lnsl -lm -lpthread -lrt]


Doing a simple ls -l on both /usr/lib/mysql and /usr/include/mysql  
shows me that all libraries in there are from Jul 5th, which is too  
old to be my recent MySQL install. So these seem to be the files that  
need updating. Which package will do that for me?


Chrs,
Dav

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



Re: [PHP] Re: [PHP-INSTALL] MySQL connector installation/upgrade problems

2007-10-23 Thread Colin Guthrie
David Christopher Zentgraf wrote:
 On  23. Oct 2007, at 20:33, Colin Guthrie wrote:
 
 If you compile PHP and it finds v3 of mysql that means that you must
 have the old development libraries for mysql 3 installed in some
 capacity (I believe).

 What is the output of:
 rpm -qa --nosignature --nodigest | grep -i mysql

 This should give some clues.
 
 $ rpm -qa --nosignature --nodigest | grep -i mysql
 MySQL-server-community-5.0.45-0.rhel3
 mod_auth_mysql-20030510-2.ent
 MySQL-shared-compat-5.0.45-0.rhel3
 MySQL-client-community-5.0.45-0.rhel3
 mysql-bench-3.23.58-16.RHEL3.1
 MySQL-python-0.9.1-6
 libdbi-dbd-mysql-0.6.5-5
 perl-DBD-MySQL-2.1021-4.EL3
 qt-MySQL-3.1.2-17.RHEL3
 php-mysql-4.3.2-43.ent
 MySQL-devel-community-5.0.45-0.rhel3
 
 Now I'm even more confused, the 5.0.45 devel package *is* there.

Yeah that looks pretty OK to me (tho' not overly knowledgeable with
Fedora/Centos packaging)

 I would imagine (don't know) that PHP would use the mysql_config program
 to work out which mysql is installed and get the relevent cflags and
 linking options. For me this is provided by the
 MySQL-devel-community-5.0.27 package from MySQL... Is this definitely
 installed?
 
 $ mysql_config
 Usage: /usr/bin/mysql_config [OPTIONS]
 Options:
 --cflags [-I/usr/include/mysql -g -pipe -march=i386
 -mcpu=i686]
 --include[-I/usr/include/mysql]
 --libs   [-L/usr/lib/mysql -lmysqlclient -lz -lcrypt
 -lnsl -lm]
 --libs_r [-L/usr/lib/mysql -lmysqlclient_r -lz -lpthread
 -lcrypt -lnsl -lm -lpthread]
 --socket [/var/lib/mysql/mysql.sock]
 --port   [3306]
 --version[5.0.45]
 --libmysqld-libs [-L/usr/lib/mysql -lmysqld -lz -lpthread
 -lcrypt -lnsl -lm -lpthread -lrt]
 
 Doing a simple ls -l on both /usr/lib/mysql and /usr/include/mysql shows
 me that all libraries in there are from Jul 5th, which is too old to be
 my recent MySQL install. So these seem to be the files that need
 updating. Which package will do that for me?

No, I reckon Jul 5th could be about right when was .45 released? I
had it in my head it was august but Jul doesn't seem too far before that
so entirely possible.

Use rpm -qf filename to see which package owns which files.

you can also use rpm -V pck to verify that the package has not be
modified on disk.

Does PHP 4 perhaps come with it's own mysql library in the source?
Perhaps you have to pass an argument?

Try using something like: --with-mysql=shared,/usr in the configure to
PHP. That's certainly how I configure PHP5. The args for 4 may be
different tho'.

Col.

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



Re: [PHP] Re: [PHP-INSTALL] MySQL connector installation/upgrade problems

2007-10-23 Thread David Christopher Zentgraf

On  23. Oct 2007, at 21:07, Colin Guthrie wrote:


No, I reckon Jul 5th could be about right when was .45 released? I
had it in my head it was august but Jul doesn't seem too far before  
that

so entirely possible.


Ah sorry, I was thinking about source installs. RPMs keep the  
original creation date I guess. Not overly used to that.



Use rpm -qf filename to see which package owns which files.


Probing two random files in include/mysql and and lib/mysql show they  
belong to MySQL-devel-community-5.0.45-0.rhel3.



you can also use rpm -V pck to verify that the package has not be
modified on disk.


$ rpm -V MySQL-devel-community-5.0.45-0.rhel3
missing  d /usr/share/man/man1/comp_err.1.gz
missing  d /usr/share/man/man1/mysql_config.1.gz

I suppose this is, albeit not ideal, tolerable?


Does PHP 4 perhaps come with it's own mysql library in the source?
Perhaps you have to pass an argument?


Yes, as of PHP4 the --with-mysql is on by default. I tried specifying  
--with-mysql-dir=/usr and also shared,/usr, but to no avail.


Chrs,
Dav

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



Re: [PHP] Re: [PHP-INSTALL] MySQL connector installation/upgrade problems

2007-10-23 Thread Colin Guthrie
David Christopher Zentgraf wrote:
 $ rpm -V MySQL-devel-community-5.0.45-0.rhel3
 missing  d /usr/share/man/man1/comp_err.1.gz
 missing  d /usr/share/man/man1/mysql_config.1.gz
 
 I suppose this is, albeit not ideal, tolerable?

Yeah this is fine. Your system is probably not setup to install docs and
therefore these files just didn't get installed.

 Does PHP 4 perhaps come with it's own mysql library in the source?
 Perhaps you have to pass an argument?
 
 Yes, as of PHP4 the --with-mysql is on by default. I tried specifying
 --with-mysql-dir=/usr and also shared,/usr, but to no avail.

Sorry mate I'm out of ideas... Without tracing through the configure
script to nail it down, I'm kinda stumped.

Col

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



[PHP] Re: [PHP-INSTALL] MySQL connector installation/upgrade problems

2007-10-23 Thread Colin Guthrie
David Zentgraf wrote:
 Hi,
 
 I'm trying to upgrade a server running CentOS 3 to an up-to-date MySQL 5
 installation + PHP4. I installed the MySQL 5 package, server and client,
 via RPMs and they work fine, the client tells me it's version 5.0.45. I
 went on to recompile PHP 4.4.7 --with-mysql, but it's still using MySQL
 client libraries version 3.23.58. I'm kind of at a loss where it takes
 these versions from or how I can get it to use the newer libraries.
 
 Any hints would be greatly appreciated.

Do rpm -qa --nosignature | grep -i mysql and see what old libraries you
have lying around. Specifically look for the devel libraries/packages.
Remove the 3.x versions via RPM and make sure you've installed the
relevant -devel package from MySQL 5.

You can also use the MySQL 5 -shared-compat package to replace the
shared libraries needed by other apps in Fedora, although you may have
to do an rpm -e --nodeps to get rid of the currently installed library
prior to installing -shared-compat due to file conflicts. I always like
to test that this has worked tho (typically testing one of the apps in
the packages rpm moaned about when doing a normal rpm -e (sans
--nodeps) or by trying to rpm -e the newly installed -shared-compat just
to make sure it is providing the correct deps at least!

HTH


gripe
Be warned tho. If you use custom aggregate UDFs in MySQL 5 it the
current version will segfault on you. I tore my hair out over this.
Upstream MySQL have been pretty crap at responding or releasing
something that I reported months ago. The fact they removed all the
daily snapshots has not helped me help them to fix it either.

http://bugs.mysql.com/bug.php?id=30312

I had to stick with 5.0.27 for now.
/gripe

Col

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



Re: [PHP] Re: [PHP-INSTALL] MySQL connector installation/upgrade problems

2007-10-23 Thread Colin Guthrie
David Christopher Zentgraf wrote:
 On  23. Oct 2007, at 17:22, Colin Guthrie wrote:
 
 Do rpm -qa --nosignature | grep -i mysql and see what old libraries you
 have lying around. Specifically look for the devel libraries/packages.
 Remove the 3.x versions via RPM and make sure you've installed the
 relevant -devel package from MySQL 5.

 You can also use the MySQL 5 -shared-compat package to replace the
 shared libraries needed by other apps in Fedora, although you may have
 to do an rpm -e --nodeps to get rid of the currently installed library
 prior to installing -shared-compat due to file conflicts. I always like
 to test that this has worked tho (typically testing one of the apps in
 the packages rpm moaned about when doing a normal rpm -e (sans
 --nodeps) or by trying to rpm -e the newly installed -shared-compat just
 to make sure it is providing the correct deps at least!
 
 I did install the shared-compat package (sorry, forgot to mention),
 which littered libmysqlclient.so.10 to .so.15 around my /usr/lib, and I
 guess that PHP is using .so.10 for some reason instead of .so.15 (or
 simply libmysqlclient.so, which is symlinked to .so.15).
 Are you saying that it's save to remove the old libs or the whole
 shared-compat package and simply install the current libs instead? I was
 thinking about it, but then again, these things are there for
 compatibility, so I hoped there was a way to explicitly tell PHP to use
 the latest version while leaving the others around.

The .so file (without the .10 or .15) is just used for compile time
linking, it's not used at runtime.

No, the shared-compat is the correct one ot use here as some of the core
Centos rpms may need a mysql v3 compatible client library.


If you compile PHP and it finds v3 of mysql that means that you must
have the old development libraries for mysql 3 installed in some
capacity (I believe).

What is the output of:
rpm -qa --nosignature --nodigest | grep -i mysql

This should give some clues.

I would imagine (don't know) that PHP would use the mysql_config program
to work out which mysql is installed and get the relevent cflags and
linking options. For me this is provided by the
MySQL-devel-community-5.0.27 package from MySQL... Is this definitely
installed?

Col

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



[PHP] Re: PHP and mySQL dates

2006-09-13 Thread Colin Guthrie

 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!

I know yui've alreayd solved this, but for what it's worth, the first
form of statement is preferred to the second.

In the second you are applying a MYSQL function to a field which will
have to be repeated many times, in the first, you are applying a MYSQL
function to a constant which only has to be computed once.

Even now you have the solution, it may be worth considering the order of
your check and if possible use the MYSQL function ont he constant not
the field to get the additional performance gain.

Col.

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



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

2006-05-18 Thread Robert Samuel White
Upgrade your MySQL distribution to the latest version (5+).

 

Upgrade any shared MySQL libraries to the latest distribute.

 

Recompile MySQL with mysqli support.

 

http://php.net/mysqli

 

And use that instead of the regular MySQL functions.

 

That's what I did and it has made a huge difference.

 

Not to mention, the mysqli library has so many more functions available to
you.

 

~Samuel

 

 



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

2005-01-09 Thread Sagar C Nannapaneni
You didnt mentioned where your problem is and what the error that you are
getting.
check in the line

mysql_select_db (userpass);

That you have the grant and other administrative privilages to the user and
the database
you have to operate on is mysql

mysql_select_db (mysql);

Anyhow note that PHP5 has released...i dont see any good reason why u r
still using php 3.

/sagar
- Original Message -
From: M. Sokolewicz [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Saturday, January 08, 2005 9:55 PM
Subject: [PHP] Re: PHP any Mysql connection- new b


 php 3.0???!

 man, you seriously need to think about upgrading :| PHP 3 is seriously
 outdated

 - tul
 Babu 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.
 
  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 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



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

2005-01-08 Thread M. Sokolewicz
php 3.0???!
man, you seriously need to think about upgrading :| PHP 3 is seriously 
outdated

- tul
Babu 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.
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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

2004-12-20 Thread Barley
Bingo. Many thanks.


 Barley wrote:

  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)

 Check permissions on /var/lib/mysql. From the sockets manpage:

 NOTES
 In the Linux implementation, sockets which are visible in the filesystem
 honour the permissions of the directory they are in. Their owner, group
 and their permissions can be changed. Creation of a new socket will fail
 if the process does not have write and search (execute) permission on
 the directory the socket is created in. Connecting to the socket object
 requires read/write permission. This behavior differs from many
 BSD-derived systems which ignore permissions for Unix sockets. Portable
 programs should not rely on this feature for security.

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



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

2004-12-19 Thread user
Barley wrote:
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)
Check permissions on /var/lib/mysql. From the sockets manpage:
NOTES
In the Linux implementation, sockets which are visible in the filesystem 
honour the permissions of the directory they are in. Their owner, group 
and their permissions can be changed. Creation of a new socket will fail 
if the process does not have write and search (execute) permission on 
the directory the socket is created in. Connecting to the socket object 
requires read/write permission. This behavior differs from many 
BSD-derived systems which ignore permissions for Unix sockets. Portable 
programs should not rely on this feature for security.

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


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

2004-12-18 Thread Jed Smith
Try mysqli_connect(127.0.0.1, user, pass);
Then MySQLI will try to use TCP/IP as opposed to a local socket.
Jed
Barley wrote:
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


--
 _
(_)___Jed Smith, Code Monkey
| / __|   [EMAIL PROTECTED] | [EMAIL PROTECTED]
| \__ \   +1 541 606-4145
   _/ |___/   Signed mail preferred (PGP 0x703F9124)
  |__/http://personal.jed.bz/keys/jedsmith.asc
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: PHP and MySQL Installation on Apache for Windows

2004-07-16 Thread Ciprian Constantinescu
PHP doesn't detect anything. You need to have your mysql server running and
you try with mysql_connect() or mysql_pconnect() to see if you can connect
to the server

Sean Vasey [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: php and mysql help

2004-04-14 Thread Eric Bolikowski

Webmaster [EMAIL PROTECTED] wrote in message
news:[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.
Thank you.

?php

mysql_connect('user', 'pass', 'host');

$dbCreateQuery = CREATE DATABASE 'name_of_database';

mysql_query($dbCreateQuery);

?

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



[PHP] Re: PHP and MySQL date

2003-12-15 Thread Justin Patrin
Cesar Aracena wrote:

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]
The best way is to use a datetime or timestamp type in MySql, depending 
on your use of it. Using MySql's types allows you to use MySql's date 
comparison and functions for queries. You can get a UNIX timestamp using 
the UNIX_TIMESTAMP() function in mysql or by using strtotime() in PHP on 
the value.

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


[PHP] Re: PHP and MySQL date

2003-12-15 Thread Cesar Aracena
Thanks both of you for the answer.

I tried what both of you told me and I found very easy to use the datetime
value under MySQL and then fetch it using strtotime() as fireball at
sizzling dot com recommended at the User Contributed Notes of php.net's
function.date.php page rather than using mktime() which can output incorrect
dates.

Thankis to both and everyone.

Cesar Aracena [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
 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



Re: [PHP] Re: PHP and MySQL date

2003-12-15 Thread John W. Holmes
Cesar Aracena wrote:

I tried what both of you told me and I found very easy to use the datetime
value under MySQL and then fetch it using strtotime() as fireball at
sizzling dot com recommended at the User Contributed Notes of php.net's
function.date.php page rather than using mktime() which can output incorrect
dates.
You can also use the MySQL function DATE_FORMAT() to format the MySQL 
timestamp to your liking. It is very similar to the PHP date() function.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


[PHP] Re: PHP and MYSQL

2003-07-07 Thread Cybot
Here is the script for what it's worth.
...
body bgcolor=#FF text=#00
h2IS IT WORKING?/h2
plt;?php
 phpinfo();
?gt; /p
/body
/html
and the result is
IS IT WORKING?
?php phpinfo(); ?

are your trying to fool the list?

whate else do you expect than  when you write gt; ??

would ASP work if your write lt;% [ASP-CODE] %gt; ??

i think not,

in short just write  and  rather then lt; and gt;

html
body bgcolor=#FF text=#00
h2IS IT WORKING?/h2
p?php
 phpinfo();
? /p
/body
/html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: PHP and MYSQL

2003-07-07 Thread jsWalter

Bob G [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Please help I am going quite mad.

 ... The PHP.INI file is in the PHP directory.

the php.ini in your PHP directory is useless

It needs to be in 1 of 3 places...
 1) the IIS root directory, meaning where IIS EXE is at,
*not* the web root
 2) C:\WINNT (or where ever your system directory is called)
 3) C:\php4 (this is HARD CODED as a last resort)

I have mine in my web server directory *and* in my PHP directory.

That way I can run it via web server or command line.

Walter





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



[PHP] Re: php caches mysql connections to same host

2003-06-24 Thread dorgon
for better understanding:

phpCode
  $conn1 = mysql_connect(localhost, user, pwd);
  mysql_select_db(database1, $conn1);
  $conn2 = mysql_connect(localhost, user, pwd);
  mysql_select_db(database2, $conn2); // select two diff. DBs
  echo $conn1.br;
  echo $conn2.br;
/phpCode
returns:
  Resource id #2
  Resource id #2
BUT:
  $conn1 = mysql_connect(127.0.0.1, user, pwd);
  mysql_select_db(database1, $conn1);
  $conn2 = mysql_connect(localhost, user, pwd);
  mysql_select_db(database2, $conn2); // select two diff. DBs
...returns two different resource IDs (which I'd like to have).

When using mysql_pconnect I'm always getting correctly different
resource ids.
/dorgon

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


Re: [PHP] Re: php caches mysql connections to same host

2003-06-24 Thread Robert Cummings

See the new_link parameter option for mysql_connect. It should solve
your problem. On the other hand, what you are doing is fine, I did it
for my pool since I can't use the new_link option because I'm retaining
compatibility back to PHP 4.1.2

Cheers,
Rob.


dorgon wrote:
 
 for better understanding:
 
 phpCode
$conn1 = mysql_connect(localhost, user, pwd);
mysql_select_db(database1, $conn1);
 
$conn2 = mysql_connect(localhost, user, pwd);
mysql_select_db(database2, $conn2); // select two diff. DBs
 
echo $conn1.br;
echo $conn2.br;
 /phpCode
 
 returns:
Resource id #2
Resource id #2
 
 BUT:
$conn1 = mysql_connect(127.0.0.1, user, pwd);
mysql_select_db(database1, $conn1);
$conn2 = mysql_connect(localhost, user, pwd);
mysql_select_db(database2, $conn2); // select two diff. DBs
 
 ...returns two different resource IDs (which I'd like to have).
 
 When using mysql_pconnect I'm always getting correctly different
 resource ids.
 
 /dorgon
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
.-.
| Worlds of Carnage - http://www.wocmud.org   |
:-:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the  |
| stuff of nightmares grasp for your soul.|
`-'

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



[PHP] Re: php and mysql

2003-03-31 Thread Tim Burden
Assuming Month_Start is stored in MySQL date format (-mm-dd) you could
Select blah blah From blah Order By DATE_FORMAT(Month_Start,%m) ASC
The %m will pad on the zeroes.

http://www.mysql.com/doc/en/Date_and_time_functions.html

- Original Message -
From: Tyler Durdin [EMAIL PROTECTED]
Newsgroups: php.general
To: [EMAIL PROTECTED]
Sent: Monday, March 31, 2003 1:53 PM
Subject: php and mysql



 I have a db with events in it. i would like to pull the events out via
php,
 but i would like them to be ordered by month number (1-12). When I do this
 (Select blah blah From blah Order By Month_Start ASC) it orders the months
 by number, but it starts with october (month 10) I am pretty sure it is
 doing this because I have no events until april (month 4). So how can i
get
 it to order the months by their numbers starting with january (1) and
going
 to december (12) even if I do not have events until april (4)?




 _
 The new MSN 8: advanced junk mail protection and 2 months FREE*
 http://join.msn.com/?page=features/junkmail



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



Re: [PHP] Re: PHP and MySQL bug

2003-01-08 Thread Nuno Lopes
@mysql_select_db(be); // this doesn't fail, because only the second
(UPDATE) query fails. The first query (SELECT) is done!


- Original Message -
From: Marek Kilimajer [EMAIL PROTECTED]
To: Nuno Lopes [EMAIL PROTECTED]
Cc: MySQL List [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, January 07, 2003 5:06 PM
Subject: Re: [PHP] Re: PHP and MySQL bug


 @mysql_select_db(be); -- this failed
 do echo mysql_error(); to see what went wrong



 Nuno Lopes wrote:

 I done a echo of Mysql_error and it returned:
 'Nenhum banco de dados foi selecionado'
 
 (I have the mysql server in portuguese, but the translation is something
 like 'no db was selected')
 
 
 - Original Message -
 From: David Freeman [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Sunday, January 05, 2003 10:29 PM
 Subject: RE: [PHP] Re: PHP and MySQL bug
 
 
 
 
   @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this
   query doesn't work
 
 Personally, I'd call it bad programming practice to do a database update
 and not check to see if it worked or not.  In this case, how are you
 determining that the query did not work?  Are you manually checking the
 database?  You don't have anything in your code to check the status of
 this query.
 
 Perhaps this might get you somewhere:
 
 $qid = @mysql_query(UPDATE d SET h = '$h' WHERE id = '$id');
 
 if (isset($qid)  mysql_affected_rows() == 1)
 {
   echo query executed;
 } else {
   echo query failed:  . mysql_error();
 }
 
 At least this way you might get some indication of where the problem is.
 
 CYA, Dave



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




Re: [PHP] Re: PHP and MySQL bug

2003-01-08 Thread Nuno Lopes
Doesn't you have any simpler answer??


Maybe installing the new version of mysql server - I have version 3.23.49 -
should do the trick



- Original Message -
From: Larry Brown [EMAIL PROTECTED]
To: Nuno Lopes [EMAIL PROTECTED]; MySQL List [EMAIL PROTECTED]
Sent: Tuesday, January 07, 2003 4:12 PM
Subject: RE: [PHP] Re: PHP and MySQL bug


 Since nobody is jumping in to say it is some simple configuration/setting
 personally my next step would be to shut down all services on the box that
 aren't absolutely necessary and stop everything in the registry under run
 and stop anything in the start folder of the start menu and run the same
 tests.  If no positive results I would uninstall php completely and clean
 any reference in the registry of it and then install with everything still
 shut down.  Retest, if no progress do the same with mysql.  These are
 radical and time-consuming methods, but it seems as though it is broken.
If
 you absolutely need this fixed fast you might resort to paying the
 developers to give you a solution, although it may end up being what I
just
 listed, or it could be some simple fix that we aren't aware of.

 Larry S. Brown
 Dimension Networks, Inc.
 (727) 723-8388

 -Original Message-
 From: Nuno Lopes [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, January 07, 2003 4:31 AM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP] Re: PHP and MySQL bug

 I have the latest version of PHP (4.3.0) as module in apache 2.0.43 and
 mysql 3.23.49.
 Everything is working fine, except this.
 With pconnect the error is the same!


 - Original Message -
 From: Larry Brown [EMAIL PROTECTED]
 To: MySQL List [EMAIL PROTECTED]
 Sent: Monday, January 06, 2003 6:28 PM
 Subject: RE: [PHP] Re: PHP and MySQL bug


  This definitely sounds like a buggy installation or there may be some
  problem with the communication between the web server and the mysqld.
Is
  the db on a different machine?  Try using mysql_pconnect instead of
 connect
  just to see what result you get.  I have read some unfavorable
statements
  about using pconnect with a large number of hits so if it works you
should
  read the comments about it on php.net.  Do a search for mysql_pconnect.
 
  Larry S. Brown
  Dimension Networks, Inc.
  (727) 723-8388
 
  -Original Message-
  From: Nuno Lopes [mailto:[EMAIL PROTECTED]]
  Sent: Monday, January 06, 2003 1:09 PM
  To: MySQL List; [EMAIL PROTECTED]
  Subject: [PHP] Re: PHP and MySQL bug
 
  The problem is if I close the connection and reopen it the query is
done,
  but if I remain with the same connection has the previous query, mysql
  returns an error.
 
 
  - Original Message -
  From: Larry Brown [EMAIL PROTECTED]
  To: MySQL List [EMAIL PROTECTED]
  Sent: Sunday, January 05, 2003 4:16 PM
  Subject: Re:PHP and MySQL bug
 
 
   Try replacing the following line...
  
   @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query
 doesn't
   work
  
   With...
  
   $query = UPDATE d SET h='$h' WERE id='$id';
   $queryr = mysql_query($query) or die(The sql statement does not
  execute);
  
   if(mysql_affected_rows() !== 1)
   {
  die(The sql statement is successfully run however either h did not
   change or there is an internal error.  Try executing the sql from the
   command line to make sure it otherwise works.);
   }
  
   and see which is coming back.
  
  
   Larry S. Brown
   Dimension Networks, Inc.
   (727) 723-8388




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




Re: [PHP] Re: PHP and MySQL bug

2003-01-07 Thread Nuno Lopes
I have the latest version of PHP (4.3.0) as module in apache 2.0.43 and
mysql 3.23.49.
Everything is working fine, except this.
With pconnect the error is the same!


- Original Message -
From: Larry Brown [EMAIL PROTECTED]
To: MySQL List [EMAIL PROTECTED]
Sent: Monday, January 06, 2003 6:28 PM
Subject: RE: [PHP] Re: PHP and MySQL bug


 This definitely sounds like a buggy installation or there may be some
 problem with the communication between the web server and the mysqld.  Is
 the db on a different machine?  Try using mysql_pconnect instead of
connect
 just to see what result you get.  I have read some unfavorable statements
 about using pconnect with a large number of hits so if it works you should
 read the comments about it on php.net.  Do a search for mysql_pconnect.

 Larry S. Brown
 Dimension Networks, Inc.
 (727) 723-8388

 -Original Message-
 From: Nuno Lopes [mailto:[EMAIL PROTECTED]]
 Sent: Monday, January 06, 2003 1:09 PM
 To: MySQL List; [EMAIL PROTECTED]
 Subject: [PHP] Re: PHP and MySQL bug

 The problem is if I close the connection and reopen it the query is done,
 but if I remain with the same connection has the previous query, mysql
 returns an error.


 - Original Message -
 From: Larry Brown [EMAIL PROTECTED]
 To: MySQL List [EMAIL PROTECTED]
 Sent: Sunday, January 05, 2003 4:16 PM
 Subject: Re:PHP and MySQL bug


  Try replacing the following line...
 
  @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query
doesn't
  work
 
  With...
 
  $query = UPDATE d SET h='$h' WERE id='$id';
  $queryr = mysql_query($query) or die(The sql statement does not
 execute);
 
  if(mysql_affected_rows() !== 1)
  {
 die(The sql statement is successfully run however either h did not
  change or there is an internal error.  Try executing the sql from the
  command line to make sure it otherwise works.);
  }
 
  and see which is coming back.
 
 
  Larry S. Brown
  Dimension Networks, Inc.
  (727) 723-8388



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




Re: [PHP] Re: PHP and MySQL bug

2003-01-07 Thread Marek Kilimajer
@mysql_select_db(be); -- this failed
do echo mysql_error(); to see what went wrong



Nuno Lopes wrote:


I done a echo of Mysql_error and it returned:
'Nenhum banco de dados foi selecionado'

(I have the mysql server in portuguese, but the translation is something
like 'no db was selected')


- Original Message -
From: David Freeman [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, January 05, 2003 10:29 PM
Subject: RE: [PHP] Re: PHP and MySQL bug


 

 @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this
 query doesn't work

Personally, I'd call it bad programming practice to do a database update
and not check to see if it worked or not.  In this case, how are you
determining that the query did not work?  Are you manually checking the
database?  You don't have anything in your code to check the status of
this query.

Perhaps this might get you somewhere:

$qid = @mysql_query(UPDATE d SET h = '$h' WHERE id = '$id');

if (isset($qid)  mysql_affected_rows() == 1)
{
 echo query executed;
} else {
 echo query failed:  . mysql_error();
}

At least this way you might get some indication of where the problem is.

CYA, Dave
   




 



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




Re: [PHP] Re: PHP and MySQL bug

2003-01-07 Thread Nuno Lopes
I'm using Windows 2000.


- Original Message -
From: Cleber [EMAIL PROTECTED]
To: Nuno Lopes [EMAIL PROTECTED]
Sent: Tuesday, January 07, 2003 10:23 AM
Subject: Re: [PHP] Re: PHP and MySQL bug


 Try add to /etc/hosts the name and ip of DB is located


 - Original Message -
 From: Nuno Lopes [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Tuesday, January 07, 2003 7:31 AM
 Subject: Re: [PHP] Re: PHP and MySQL bug


  I have the latest version of PHP (4.3.0) as module in apache 2.0.43 and
  mysql 3.23.49.
  Everything is working fine, except this.
  With pconnect the error is the same!
 
 
  - Original Message -
  From: Larry Brown [EMAIL PROTECTED]
  To: MySQL List [EMAIL PROTECTED]
  Sent: Monday, January 06, 2003 6:28 PM
  Subject: RE: [PHP] Re: PHP and MySQL bug
 
 
   This definitely sounds like a buggy installation or there may be some
   problem with the communication between the web server and the mysqld.
 Is
   the db on a different machine?  Try using mysql_pconnect instead of
  connect
   just to see what result you get.  I have read some unfavorable
 statements
   about using pconnect with a large number of hits so if it works you
 should
   read the comments about it on php.net.  Do a search for
mysql_pconnect.
  
   Larry S. Brown
   Dimension Networks, Inc.
   (727) 723-8388
  
   -Original Message-
   From: Nuno Lopes [mailto:[EMAIL PROTECTED]]
   Sent: Monday, January 06, 2003 1:09 PM
   To: MySQL List; [EMAIL PROTECTED]
   Subject: [PHP] Re: PHP and MySQL bug
  
   The problem is if I close the connection and reopen it the query is
 done,
   but if I remain with the same connection has the previous query, mysql
   returns an error.
  
  
   - Original Message -
   From: Larry Brown [EMAIL PROTECTED]
   To: MySQL List [EMAIL PROTECTED]
   Sent: Sunday, January 05, 2003 4:16 PM
   Subject: Re:PHP and MySQL bug
  
  
Try replacing the following line...
   
@MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query
  doesn't
work
   
With...
   
$query = UPDATE d SET h='$h' WERE id='$id';
$queryr = mysql_query($query) or die(The sql statement does not
   execute);
   
if(mysql_affected_rows() !== 1)
{
   die(The sql statement is successfully run however either h did
not
change or there is an internal error.  Try executing the sql from
the
command line to make sure it otherwise works.);
}
   
and see which is coming back.
   
   
Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388



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




Re: [PHP] Re: PHP and MySQL bug

2003-01-06 Thread Nuno Lopes
I done a echo of Mysql_error and it returned:
'Nenhum banco de dados foi selecionado'

(I have the mysql server in portuguese, but the translation is something
like 'no db was selected')


- Original Message -
From: David Freeman [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, January 05, 2003 10:29 PM
Subject: RE: [PHP] Re: PHP and MySQL bug



   @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this
   query doesn't work

 Personally, I'd call it bad programming practice to do a database update
 and not check to see if it worked or not.  In this case, how are you
 determining that the query did not work?  Are you manually checking the
 database?  You don't have anything in your code to check the status of
 this query.

 Perhaps this might get you somewhere:

 $qid = @mysql_query(UPDATE d SET h = '$h' WHERE id = '$id');

 if (isset($qid)  mysql_affected_rows() == 1)
 {
   echo query executed;
 } else {
   echo query failed:  . mysql_error();
 }

 At least this way you might get some indication of where the problem is.

 CYA, Dave



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




[PHP] Re: PHP and MySQL bug

2003-01-06 Thread Nuno Lopes
The problem is if I close the connection and reopen it the query is done,
but if I remain with the same connection has the previous query, mysql
returns an error.


- Original Message -
From: Larry Brown [EMAIL PROTECTED]
To: MySQL List [EMAIL PROTECTED]
Sent: Sunday, January 05, 2003 4:16 PM
Subject: Re:PHP and MySQL bug


 Try replacing the following line...

 @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't
 work

 With...

 $query = UPDATE d SET h='$h' WERE id='$id';
 $queryr = mysql_query($query) or die(The sql statement does not
execute);

 if(mysql_affected_rows() !== 1)
 {
die(The sql statement is successfully run however either h did not
 change or there is an internal error.  Try executing the sql from the
 command line to make sure it otherwise works.);
 }

 and see which is coming back.


 Larry S. Brown
 Dimension Networks, Inc.
 (727) 723-8388




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




[PHP] Re: PHP and MySQL bug

2003-01-06 Thread Jennifer Goodie
It would be helpful if you posted that error.  You can get it by changing
the die to

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

Without knowing the error, you problem will be harder for everyone to debug.


-Original Message-
From: Nuno Lopes [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 06, 2003 10:09 AM
To: MySQL List; [EMAIL PROTECTED]
Subject: Re: PHP and MySQL bug

The problem is if I close the connection and reopen it the query is done,
but if I remain with the same connection has the previous query, mysql
returns an error.


- Original Message -
From: Larry Brown [EMAIL PROTECTED]
To: MySQL List [EMAIL PROTECTED]
Sent: Sunday, January 05, 2003 4:16 PM
Subject: Re:PHP and MySQL bug


 Try replacing the following line...

 @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't
 work

 With...

 $query = UPDATE d SET h='$h' WERE id='$id';
 $queryr = mysql_query($query) or die(The sql statement does not
execute);

 if(mysql_affected_rows() !== 1)
 {
die(The sql statement is successfully run however either h did not
 change or there is an internal error.  Try executing the sql from the
 command line to make sure it otherwise works.);
 }

 and see which is coming back.


 Larry S. Brown
 Dimension Networks, Inc.
 (727) 723-8388




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


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




[PHP] Re: PHP and MySQL bug

2003-01-05 Thread Nuno Lopes
Here is the source code:

?
@MYSQL_CONNECT(localhost, nlopes, testing) or die(Erro 1);
@mysql_select_db(be);
$r=MYSQL_QUERY(SELECT n,u,m,h FROM d WHERE id='$id');
if (mysql_num_rows($r)==0) {
die (Erro);
} else {
$re=mysql_fetch_array($r, MYSQL_NUM);
$nome=$re[0];
$url=$re[1];
$mirrors=$re[2];
$h=$re[3];
$h++;
@MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't
work
echo h2Seleccione a localização para o download:/h2pa
href=\$url\Localização Principal/a/p;
if ($mirrors) {
echo pnbsp;/ph2Mirrors/h2p;
$m=explode(»,$mirrors);
foreach ($m as $v) {
$m2=explode(!,$v);
echo a href=\$m2[1]\$m2[0]/abr;
}
echo /ppNota: Deve escolher o mirror mais próximo da sua localização,
para acelerar o dowload. No caso de um mirror estar indisponível, utilize
outro./p;
}
}
@MYSQL_CLOSE();
?/body/html



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




RE: [PHP] Re: PHP and MySQL bug

2003-01-05 Thread David Freeman

  @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this
  query doesn't work

Personally, I'd call it bad programming practice to do a database update
and not check to see if it worked or not.  In this case, how are you
determining that the query did not work?  Are you manually checking the
database?  You don't have anything in your code to check the status of
this query.

Perhaps this might get you somewhere:

$qid = @mysql_query(UPDATE d SET h = '$h' WHERE id = '$id');

if (isset($qid)  mysql_affected_rows() == 1)
{
  echo query executed;
} else {
  echo query failed:  . mysql_error();
}

At least this way you might get some indication of where the problem is.

CYA, Dave




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




[PHP] Re: PHP and MySQL bug

2003-01-04 Thread OrangeHairedBoy
You really should be using a $link variable...it's good habit:

$link = mysql_connect(...);
mysql_select_db( mydb , $link);
$query = mysql_query( select... , $link );
$result = mysql_fetch_array($query);

Lewis

Nuno Lopes [EMAIL PROTECTED] wrote in message
003a01c2b3de$95004650$0100a8c0@pc07653">news:003a01c2b3de$95004650$0100a8c0@pc07653...
 Dear Sirs,

 I'm using PHP and MySQL to make my programs. But I think I discovered a
bug
 in PHP or in MySQL (I don't know!).

 In one of my files I have the following:

 MYSQL_CONNECT(localhost, **user**, **pass**);
 mysql_select_db(be);
 $r=MYSQL_QUERY(SELECT n,u,m,h FROM d WHERE id='$id');

 /* Some code including mysql_num_rows and mysql_fetch_array($r,
 MYSQL_NUM)
 And the another query:
 */

 MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id');

 /* i don't know why but this doesn't work! But if I close the connection
and
 open another te query is done:*/

 MYSQL_CLOSE();
 MYSQL_CONNECT(localhost, **user**, **pass**);
 mysql_select_db(be);
 MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id');

 ---
 I don't know why is this? Because I'm used to do more than a query per
 connection and this never happened!
 I'm using Win 2k, Apache 2.0.43, MySQL 3.23.49-nt and PHP 4.3.


 I hope you solve this,
 Nuno Lopes





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




Re: [PHP] Re: PHP and MySQL bug

2003-01-04 Thread Michael J. Pawlowsky

Personally I say get yourself a good simple dbconnect class and make life easy.
Also if you ever change users, database name etc, you onlu have one place to replace 
it in your code.

I wrote mine based on http://www.vtwebwizard.com/tutorials/mysql/

Take a look at it.  Nice and simple.


Mike



*** REPLY SEPARATOR  ***

On 04/01/2003 at 1:09 PM OrangeHairedBoy wrote:

You really should be using a $link variable...it's good habit:

$link = mysql_connect(...);
mysql_select_db( mydb , $link);
$query = mysql_query( select... , $link );
$result = mysql_fetch_array($query);




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




Re: [PHP] Re: PHP and MySQL bug

2003-01-04 Thread Michael J. Pawlowsky

Personally I think the problem lies somewhere between the chair and the keyboard

(Sorry, couldn't resist)  :-)



*** REPLY SEPARATOR  ***

On 04/01/2003 at 4:58 PM Stefan Hinz, iConnect (Berlin) wrote:

It doesn't work because of the /* Some code including ... */ part ;-)





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




[PHP] Re: PHP and MySQL bug

2003-01-04 Thread Stefan Hinz, iConnect \(Berlin\)
Nuno,

 $r=MYSQL_QUERY(SELECT n,u,m,h FROM d WHERE id='$id');

 /* Some code including mysql_num_rows and mysql_fetch_array($r,
 MYSQL_NUM)
 And the another query:
 */

 MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id');

 /* i don't know why but this doesn't work!*/

It doesn't work because of the /* Some code including ... */ part ;-)

First thing, I would check if $h and $id really are what you expect them
to be, like:

$sql = UPDATE d SET h='$h' WHERE id='$id';
echo $sql;
MYSQL_QUERY($sql);

If this part is okay, then the problem lies within this myterious /*
Some code */.

Regards,
--
  Stefan Hinz [EMAIL PROTECTED]
  Geschäftsführer / CEO iConnect GmbH http://iConnect.de
  Heesestr. 6, 12169 Berlin (Germany)
  Tel: +49 30 7970948-0  Fax: +49 30 7970948-3

- Original Message -
From: Nuno Lopes [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Saturday, January 04, 2003 11:46 AM
Subject: PHP and MySQL bug


 Dear Sirs,

 I'm using PHP and MySQL to make my programs. But I think I discovered
a bug
 in PHP or in MySQL (I don't know!).

 In one of my files I have the following:

 MYSQL_CONNECT(localhost, **user**, **pass**);
 mysql_select_db(be);
 $r=MYSQL_QUERY(SELECT n,u,m,h FROM d WHERE id='$id');

 /* Some code including mysql_num_rows and mysql_fetch_array($r,
 MYSQL_NUM)
 And the another query:
 */

 MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id');

 /* i don't know why but this doesn't work! But if I close the
connection and
 open another te query is done:*/

 MYSQL_CLOSE();
 MYSQL_CONNECT(localhost, **user**, **pass**);
 mysql_select_db(be);
 MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id');

 ---
 I don't know why is this? Because I'm used to do more than a query per
 connection and this never happened!
 I'm using Win 2k, Apache 2.0.43, MySQL 3.23.49-nt and PHP 4.3.


 I hope you solve this,
 Nuno Lopes



 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



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




[PHP] RE: [PHP-DB] MySQL Insert Select statement

2002-10-19 Thread John W. Holmes
That's how you do it. Hopefully you've figured it out already. 

 

---John Holmes.

 

-Original Message-
From: dwalker [mailto:dwalker;healthyproductsplus.com] 
Sent: Saturday, October 19, 2002 7:51 PM
To: professional php; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL Insert Select statement

 

While reading the MySQL manual for INSERT SELECT, I was not able to
determine how to include all 5 fields of one table into another table
(containing 100 fields) into SPECIFIC data fields.  Do I need to
explicitly list all the fields within the table of 5 fields?  If so,
would the statement be:

 

INSERT INTO Products
(ProductName,Size,SuggestedRetailPrice,ProductCategory,ManufacturerName)

SELECT(kalproduct.Product, kalproduct.size, kalproduct.SRP,
kalproduct.Cat, kalproduct.manname)

FROM kalproduct 

;

 

 

 

Thanking you in advance.

 

P.S.  I'd give it a try, but I'm trying to move 500 partial records into
a table containing at least 2000 records -- didn't want to start from
scratch.

 

 

 

 

 

 

 

 

 

 

This email message and all attachments transmitted herewith are trade
secret and/or confidential information intended only for the
 viewing and use of addressee.  If the reader of this message
 is not the intended recipient, you are hereby notified that 
any review, use, communication, dissemination, distribution 
or copying of this communication is prohibited.  If you have 
received this communication is error, please notify the sender 
immediately by telephone or electronic mail, and delete this 
message and all copies and backups thereof.  

 

Thank you for your cooperation.




[PHP] Re: [PHP-DB] MySQL Insert Select statement

2002-10-19 Thread dwalker
For some reason the Insert Select statement returned an ERROR and I had to
resort to

INSERT INTO Products
(ProductName,Size,SuggestedRetailPrice,ProductCategory,ManufacturerName)

SELECT *

FROM kalproduct ;

Is there a noticeable reason why:

INSERT INTO Products
(ProductName,Size,SuggestedRetailPrice,ProductCategory,ManufacturerName)

SELECT(kalproduct.Product, kalproduct.size, kalproduct.SRP,
kalproduct.Cat, kalproduct.manname)

FROM kalproduct ;

would have returned an error message??  I don't want to have to create
multiple tables for the purpose of inserting into others.

-Original Message-
From: John W. Holmes [EMAIL PROTECTED]
To: 'dwalker' [EMAIL PROTECTED]; 'professional php'
[EMAIL PROTECTED]; [EMAIL PROTECTED] [EMAIL PROTECTED];
[EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Saturday, October 19, 2002 7:24 PM
Subject: RE: [PHP-DB] MySQL Insert Select statement


That's how you do it. Hopefully you've figured it out already.



---John Holmes.



-Original Message-
From: dwalker [mailto:dwalker;healthyproductsplus.com]
Sent: Saturday, October 19, 2002 7:51 PM
To: professional php; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL Insert Select statement



While reading the MySQL manual for INSERT SELECT, I was not able to
determine how to include all 5 fields of one table into another table
(containing 100 fields) into SPECIFIC data fields.  Do I need to
explicitly list all the fields within the table of 5 fields?  If so,
would the statement be:



INSERT INTO Products
(ProductName,Size,SuggestedRetailPrice,ProductCategory,ManufacturerName)

SELECT(kalproduct.Product, kalproduct.size, kalproduct.SRP,
kalproduct.Cat, kalproduct.manname)

FROM kalproduct

;







Thanking you in advance.



P.S.  I'd give it a try, but I'm trying to move 500 partial records into
a table containing at least 2000 records -- didn't want to start from
scratch.





















This email message and all attachments transmitted herewith are trade
secret and/or confidential information intended only for the
 viewing and use of addressee.  If the reader of this message
 is not the intended recipient, you are hereby notified that
any review, use, communication, dissemination, distribution
or copying of this communication is prohibited.  If you have
received this communication is error, please notify the sender
immediately by telephone or electronic mail, and delete this
message and all copies and backups thereof.



Thank you for your cooperation.




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


[PHP] Re: [PHP-DB] MySQL Insert Select statement

2002-10-19 Thread Jeffrey_N_Dyke

what was the error?



   
  
dwalker  
  
dwalker@healthyproduct   To: [EMAIL PROTECTED], 
'professional php'   
splus.com [EMAIL PROTECTED], 
[EMAIL PROTECTED],   
   [EMAIL PROTECTED] 
  
10/19/2002 08:32 PM   cc:  
  
Please respond to Subject: Re: [PHP-DB] MySQL 
Insert Select statement
dwalker  
  
   
  
   
  




For some reason the Insert Select statement returned an ERROR and I had to
resort to

INSERT INTO Products
(ProductName,Size,SuggestedRetailPrice,ProductCategory,ManufacturerName)

SELECT *

FROM kalproduct ;

Is there a noticeable reason why:

INSERT INTO Products
(ProductName,Size,SuggestedRetailPrice,ProductCategory,ManufacturerName)

SELECT(kalproduct.Product, kalproduct.size, kalproduct.SRP,
kalproduct.Cat, kalproduct.manname)

FROM kalproduct ;

would have returned an error message??  I don't want to have to create
multiple tables for the purpose of inserting into others.

-Original Message-
From: John W. Holmes [EMAIL PROTECTED]
To: 'dwalker' [EMAIL PROTECTED]; 'professional php'
[EMAIL PROTECTED]; [EMAIL PROTECTED] [EMAIL PROTECTED];
[EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Saturday, October 19, 2002 7:24 PM
Subject: RE: [PHP-DB] MySQL Insert Select statement


That's how you do it. Hopefully you've figured it out already.



---John Holmes.



-Original Message-
From: dwalker [mailto:dwalker;healthyproductsplus.com]
Sent: Saturday, October 19, 2002 7:51 PM
To: professional php; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL Insert Select statement



While reading the MySQL manual for INSERT SELECT, I was not able to
determine how to include all 5 fields of one table into another table
(containing 100 fields) into SPECIFIC data fields.  Do I need to
explicitly list all the fields within the table of 5 fields?  If so,
would the statement be:



INSERT INTO Products
(ProductName,Size,SuggestedRetailPrice,ProductCategory,ManufacturerName)

SELECT(kalproduct.Product, kalproduct.size, kalproduct.SRP,
kalproduct.Cat, kalproduct.manname)

FROM kalproduct

;







Thanking you in advance.



P.S.  I'd give it a try, but I'm trying to move 500 partial records into
a table containing at least 2000 records -- didn't want to start from
scratch.





















This email message and all attachments transmitted herewith are trade
secret and/or confidential information intended only for the
 viewing and use of addressee.  If the reader of this message
 is not the intended recipient, you are hereby notified that
any review, use, communication, dissemination, distribution
or copying of this communication is prohibited.  If you have
received this communication is error, please notify the sender
immediately by telephone or electronic mail, and delete this
message and all copies and backups thereof.



Thank you for your cooperation.




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




[PHP] Re: PHP and MySQL

2002-08-02 Thread Monty

Indexes

Putting strings in single quotes instead of double (WHERE id = 'something')

Normalized database design.

- Monty

 From: [EMAIL PROTECTED] (Erich Kolb)
 Organization: RB Receivables Management, Inc.
 Reply-To: Erich Kolb [EMAIL PROTECTED]
 Newsgroups: php.general
 Date: Fri, 2 Aug 2002 15:13:24 -0500
 To: [EMAIL PROTECTED]
 Subject: PHP and MySQL
 
 Is there any way to speed up MySQL queries?
 
 


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




[PHP] Re: PHP and mySQL

2002-05-14 Thread David Robley

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] says...
 I am getting a parse error on line 75. I am trying to say:
 
 if there is a booktitle and a quantity chosen, then go to that booktitle and
 adjust the quantity in the database.
 
 Thanks!
 Renee
 
 
 ?php
  $user = adminer;
  $pass = hoosiers;
  $db = Book Store1;
  $local = jolinux;
  $link = mysql_connect( $local, $user, $pass   );
  if (! $link )
die ( Couldn't open the database );
  mysql_select_db( $db, $link )
  or die ( Couldn't open the $db: .mysql_error() );
 
  if ($submit){
  if( $booktitle, quantity ){
 $sql = UPDATE Book2 SET stock ='$stock-quantity' WHERE booktitle=$booktitle
 AND quantity=quantity;
  }
 // $result = mysql_query($mysql);
  }else if(!$submit){
   echo Your order has not been placed.p;
  }
  ?
 /BODY
 /HTML

There don't seem to be 75 lines there? But I think you _might_ be missing 
a closing }

I suspect you will then encounter problems with your SQL: you might want 
to add  mysql_error() after your update call, and ensure that the variable 
you are using as your sql query is the variable you have assigned the sql 
query to :-)

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: PHP and mySQL

2002-05-14 Thread Hugh Bothwell


City Colleges Of Chicago - Mannheim [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 if there is a booktitle and a quantity chosen, then go to that booktitle
and
 adjust the quantity in the database.


?php
$link = mysql_pconnect($local, $user, $pass)
or die(Error connecting: .mysql_error());
mysql_select_db($db, $link)
or die(Error opening database $db: .mysql_error());

if ($submit) {
if ($bookID !=  and $quantity  0) {
$query =
UPDATE Book2
. SET stock=(stock-.(int)$quantity.)
. WHERE bookID=.(int)$bookID
. AND stock =.(int)$quantity;
$result = mysql_query($query, $link);

if (mysql_affected_rows($link) == 1)
echo pYour order has been placed./p;
else
echo pThere was an error in placing the order./p;
}
}
else {
echo pYour order has not been placed./p;
}
?


NOTE:
1.  We work with a unique book-id, not a book title;
this is (a) faster for the database and (b) eliminates
problems dealing with several books of the same
name (ie multiple editions, hard-cover/soft-cover/trade,
etc).
2.  We add quantity-checking to the query - before an
order is placed, we ensure there are sufficient books
on hand.  Because this is done as a single operation,
we don't have to worry about transaction-safety.
3.  When composing the query, all values are cast to int,
foiling would-be hack attempts.



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




[PHP] Re: PHP and mySQL

2002-05-13 Thread Matthew Ward

I presume that quantity is the number of books that the person has
ordered, and therefore it needs to be a variable (ie with a $ infront of it)
and its also best to do the calculation outside of the SQL statement just to
be sure it works, eg:

if ($submit){
   if(isset($booktitle)  isset($quantity)){
  $retrievestock = mysql_query(SELECT stock FROM Book2 WHERE booktitle
= '$booktitle');
  while($getstock = mysql_fetch_array($retrievestock)) {
 $stockamount = $getstock[stock];
  }

  $newamount = $stockamount - $quantity;

  $sql = mysql_query(UPDATE Book2 SET stock = '$newamount' WHERE
booktitle= '$booktitle');
  if(! $sql) { print(Could not update stock amount.);
} elseif(! $submit) {
   print(Your order has not been placed.p);
}


City Colleges Of Chicago - Mannheim [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I am a student working on a practicum problem. I have a mySQL database
that
 contains the books, their title, and how many are in stock.  When a person
 orders one of the books, I want the stock to be adjusted by how many,
 quantity, that they chose when the submit button is clicked.  The scripts
 are written in PHP.
 Here is part of my code:
 PThe book you are ordering:

 ?
 echo  $booktitle ;
  ?

 PAdditional Message:br
  textarea name=message cols=30 rows=3/textarea
 /p
 INPUT type=submit value=Send your order.
 input type=hidden name=booktitle value=? print $booktitle; ?
 /FORM

 ?php
  $user = adminer;
  $pass = hoosiers;
  $db = Book Store1;
  $local = jolinux;
  $link = mysql_connect( $local, $user, $pass   );
  if (! $link )
die ( Couldn't open the database );
  mysql_select_db( $db, $link )
  or die ( Couldn't open the $db: .mysql_error() );

  if ($submit){
  if( $booktitle, 'quantity' ){
 $sql = UPDATE Book2 SET stock ='$stock-quantity' WHERE
booktitle=$booktitle
 AND quantity=quantity;
  }
 // $result = mysql_query($mysql);
  }else if(!$submit){
   echo Your order has not been placed.p;
  }
  ?
 /BODY
 /HTML





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




RE: [PHP] Re: PHP and mySQL

2002-05-13 Thread John Holmes

Why can't you use one query?

UPDATE Book2 SET stock = stock - $quantity WHERE stock = $quantity AND
booktitle = '$booktitle'

---John Holmes...

 -Original Message-
 From: Matthew Ward [mailto:[EMAIL PROTECTED]]
 Sent: Monday, May 13, 2002 11:52 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: PHP and mySQL
 
 I presume that quantity is the number of books that the person has
 ordered, and therefore it needs to be a variable (ie with a $ infront
of
 it)
 and its also best to do the calculation outside of the SQL statement
just
 to
 be sure it works, eg:
 
 if ($submit){
if(isset($booktitle)  isset($quantity)){
   $retrievestock = mysql_query(SELECT stock FROM Book2 WHERE
 booktitle
 = '$booktitle');
   while($getstock = mysql_fetch_array($retrievestock)) {
  $stockamount = $getstock[stock];
   }
 
   $newamount = $stockamount - $quantity;
 
   $sql = mysql_query(UPDATE Book2 SET stock = '$newamount' WHERE
 booktitle= '$booktitle');
   if(! $sql) { print(Could not update stock amount.);
 } elseif(! $submit) {
print(Your order has not been placed.p);
 }
 
 
 City Colleges Of Chicago - Mannheim [EMAIL PROTECTED] wrote in
 message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  I am a student working on a practicum problem. I have a mySQL
database
 that
  contains the books, their title, and how many are in stock.  When a
 person
  orders one of the books, I want the stock to be adjusted by how
many,
  quantity, that they chose when the submit button is clicked.  The
 scripts
  are written in PHP.
  Here is part of my code:
  PThe book you are ordering:
 
  ?
  echo  $booktitle ;
   ?
 
  PAdditional Message:br
   textarea name=message cols=30 rows=3/textarea
  /p
  INPUT type=submit value=Send your order.
  input type=hidden name=booktitle value=? print $booktitle; ?
  /FORM
 
  ?php
   $user = adminer;
   $pass = hoosiers;
   $db = Book Store1;
   $local = jolinux;
   $link = mysql_connect( $local, $user, $pass   );
   if (! $link )
 die ( Couldn't open the database );
   mysql_select_db( $db, $link )
   or die ( Couldn't open the $db: .mysql_error() );
 
   if ($submit){
   if( $booktitle, 'quantity' ){
  $sql = UPDATE Book2 SET stock ='$stock-quantity' WHERE
 booktitle=$booktitle
  AND quantity=quantity;
   }
  // $result = mysql_query($mysql);
   }else if(!$submit){
echo Your order has not been placed.p;
   }
   ?
  /BODY
  /HTML
 
 
 
 
 
 --
 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] Re: PHP with MySQL

2002-05-03 Thread .ben

Just out of interest, what's the standard/best/triedtested method for
handling errors in relation to connecting to DB's?  i.e. how to check that
the connection was a success, and if not then display why.

any pointers appreciated.

 .b

 -Original Message-
 From: Mike Eheler [mailto:[EMAIL PROTECTED]]
 Sent: 03 May 2002 02:28
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: PHP with MySQL


 Typically it's done like:

 $db = mysql_connect('localhost','username','password');

 The MySQL database detects what host you're connecting from, and appends
 that to your username. I'm not sure if it's possible to specify an
 alternate host.

 So if both PHP and MySQL are on the same machine, and you connect to the
 MySQL server as 'username', MySQL will see you as 'username@localhost'.

 Mike


 Paras Mukadam wrote:
  Hi Gurus,
  one MySQL - PHP query : while granting permissions to particular user in
  MySQL, the administrator has to give username@machine_address
 !! Then how
  can we connect to MySQL through PHP only by passing username
 as one of the
  arguments to mysql_connect() ?
 
  Thanks.
  Paras.


 --
 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] Re: PHP with MySQL

2002-05-03 Thread .ben

John, presumably I can leave the error reporting on - but pipe it into a
file if i wanted, rather than displaying on screen, and then redirect the
user to another page?

Not asking for code sample here, just whether I can do it or not :)

/me goes to look up mysql_error()

Cheers,

 .b

 -Original Message-
 From: Jon Haworth [mailto:[EMAIL PROTECTED]]
 Sent: 03 May 2002 11:34
 To: '[EMAIL PROTECTED]'; PHP
 Subject: RE: [PHP] Re: PHP with MySQL


 Hi .ben,

  Just out of interest, what's the standard/best/tried
  tested method for handling errors in relation to
  connecting to DB's?  i.e. how to check that the
  connection was a success, and if not then display why.

 Something like...

 $dbh = mysql_connect (foo, bar, baz)
   or die (mysql_error ());

 has always worked well for me. When it comes to queries I
 generally tack the
 SQL on the end of the error, like this:

 $q = mysql_query ($sql, $dbh)
   or die (mysql_error (). brb. $sql. /b);

 Obviously it's a good idea to turn this error reporting off on a
 production
 site, otherwise you risk exposing details of your database structure.

 HTH
 Jon


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




RE: [PHP] Re: PHP with MySQL

2002-05-03 Thread Jon Haworth

Hi Ben,

 John, presumably I can leave the error reporting on - 
 but pipe it into a file if i wanted, rather than 
 displaying on screen, and then redirect the user to 
 another page?

Of course you can - I generally have my pages send me email when they throw
an error, but that's because I'm really lazy and I can't be bothered to go
and check log files all the time g

It's just not a stunning idea to display an error messages that give away
out any information you could hold back - one of the starting points for an
attacker is to try and mess up your query strings, and if you're merrily
telling them exactly what the problem is, you're helping them out :-)

Cheers
Jon

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




RE: [PHP] Re: PHP with MySQL

2002-05-03 Thread .ben

Oh, i agree entirely.

Ok, i'll look into the logging/mailing solution - something i've been doing
in ASP for years but am new to in PHP.

Cheers,

 .b

 -Original Message-
 From: Jon Haworth [mailto:[EMAIL PROTECTED]]
 Sent: 03 May 2002 11:57
 To: '[EMAIL PROTECTED]'; PHP
 Subject: RE: [PHP] Re: PHP with MySQL


 Hi Ben,

  John, presumably I can leave the error reporting on -
  but pipe it into a file if i wanted, rather than
  displaying on screen, and then redirect the user to
  another page?

 Of course you can - I generally have my pages send me email when
 they throw
 an error, but that's because I'm really lazy and I can't be bothered to go
 and check log files all the time g

 It's just not a stunning idea to display an error messages that give away
 out any information you could hold back - one of the starting
 points for an
 attacker is to try and mess up your query strings, and if you're merrily
 telling them exactly what the problem is, you're helping them out :-)

 Cheers
 Jon


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




RE: [PHP] Re: PHP with MySQL

2002-05-03 Thread John Holmes

There's a whole section in the manual on it. There is a log_error() or
errorlog() function that'll write your errors to a file of your
choosing. 

---John Holmes...

 -Original Message-
 From: .ben [mailto:[EMAIL PROTECTED]]
 Sent: Friday, May 03, 2002 4:04 AM
 To: PHP
 Subject: RE: [PHP] Re: PHP with MySQL
 
 Oh, i agree entirely.
 
 Ok, i'll look into the logging/mailing solution - something i've been
 doing
 in ASP for years but am new to in PHP.
 
 Cheers,
 
  .b
 
  -Original Message-
  From: Jon Haworth [mailto:[EMAIL PROTECTED]]
  Sent: 03 May 2002 11:57
  To: '[EMAIL PROTECTED]'; PHP
  Subject: RE: [PHP] Re: PHP with MySQL
 
 
  Hi Ben,
 
   John, presumably I can leave the error reporting on -
   but pipe it into a file if i wanted, rather than
   displaying on screen, and then redirect the user to
   another page?
 
  Of course you can - I generally have my pages send me email when
  they throw
  an error, but that's because I'm really lazy and I can't be bothered
to
 go
  and check log files all the time g
 
  It's just not a stunning idea to display an error messages that give
 away
  out any information you could hold back - one of the starting
  points for an
  attacker is to try and mess up your query strings, and if you're
merrily
  telling them exactly what the problem is, you're helping them out
:-)
 
  Cheers
  Jon
 
 
 --
 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] Re: PHP with MySQL

2002-05-03 Thread .ben

Thanks John.

 -Original Message-
 From: John Holmes [mailto:[EMAIL PROTECTED]]
 Sent: 03 May 2002 16:29
 To: [EMAIL PROTECTED]; 'PHP'
 Subject: RE: [PHP] Re: PHP with MySQL
 
 
 There's a whole section in the manual on it. There is a log_error() or
 errorlog() function that'll write your errors to a file of your
 choosing. 
 
 ---John Holmes...
 
  -Original Message-
  From: .ben [mailto:[EMAIL PROTECTED]]
  Sent: Friday, May 03, 2002 4:04 AM
  To: PHP
  Subject: RE: [PHP] Re: PHP with MySQL
  
  Oh, i agree entirely.
  
  Ok, i'll look into the logging/mailing solution - something i've been
  doing
  in ASP for years but am new to in PHP.
  
  Cheers,
  
   .b
  
   -Original Message-
   From: Jon Haworth [mailto:[EMAIL PROTECTED]]
   Sent: 03 May 2002 11:57
   To: '[EMAIL PROTECTED]'; PHP
   Subject: RE: [PHP] Re: PHP with MySQL
  
  
   Hi Ben,
  
John, presumably I can leave the error reporting on -
but pipe it into a file if i wanted, rather than
displaying on screen, and then redirect the user to
another page?
  
   Of course you can - I generally have my pages send me email when
   they throw
   an error, but that's because I'm really lazy and I can't be bothered
 to
  go
   and check log files all the time g
  
   It's just not a stunning idea to display an error messages that give
  away
   out any information you could hold back - one of the starting
   points for an
   attacker is to try and mess up your query strings, and if you're
 merrily
   telling them exactly what the problem is, you're helping them out
 :-)
  
   Cheers
   Jon
  
  
  --
  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




[PHP] Re: PHP with MySQL

2002-05-02 Thread Mike Eheler

Typically it's done like:

$db = mysql_connect('localhost','username','password');

The MySQL database detects what host you're connecting from, and appends 
that to your username. I'm not sure if it's possible to specify an 
alternate host.

So if both PHP and MySQL are on the same machine, and you connect to the 
MySQL server as 'username', MySQL will see you as 'username@localhost'.

Mike


Paras Mukadam wrote:
 Hi Gurus,
 one MySQL - PHP query : while granting permissions to particular user in
 MySQL, the administrator has to give username@machine_address !! Then how
 can we connect to MySQL through PHP only by passing username as one of the
 arguments to mysql_connect() ?
 
 Thanks.
 Paras.


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




[PHP] Re: [PHP-DB] MySQL and apostrophes, interesting problem. 42082

2002-03-10 Thread Robert Weeks

See the manual at php.net:

addslashes()
stripslashes()

I've found it easier to just turn on magic-quotes in the php.ini file

This is all covered at php.net

Robert
- Original Message - 
From: Nick Patsaros [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Sunday, March 10, 2002 11:23 AM
Subject: [PHP-DB] MySQL and apostrophes, interesting problem. 42082


 I'm working with a simple form which submits field
 data to a MySQL database.  This is for the purpose of
 generating a dynamic news page for my site. 
 Interestingly enough I've found that any time I try to
 submit data that contains an apostrophe ' it gives
 me an error and will not send the data (any of it) to
 the database. 
 
 How can I change my database query, or escape out
 apostrophes?  I'm looking for the easiest fix out
 there of course.  Below is my current DB query. I
 realize I'm using apostrophes for my variables... is
 this acceptable syntax and/or is there a replacement?
 
 $query = INSERT into $table values ('0', '$year',
 '$month', '$day', '$hour', '$minutes', '$seconds',
 '$article_name', '$content', '$admin_name');
 
 
 __
 Do You Yahoo!?
 Try FREE Yahoo! Mail - the world's greatest free email!
 http://mail.yahoo.com/
 
 -- 
 PHP Database 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




[PHP] Re: PHP and mySQL

2002-03-05 Thread David Robley

In article 180f01c1c403$2ac62820$[EMAIL PROTECTED], 
[EMAIL PROTECTED] says...
 I have a little problem when trying to count the number of results returned
 in a mysql query. I was using mysql_num_rows() to do it with no problems,
 but this isn't as quick as using mySQL's COUNT(*), or so I have been told so
 I swtiched. Here's a snipit of the code...
 
 $sqlinfo = SELECT username, COUNT(username) as count FROM usertable WHERE
 username='me' GROUP BY username;
 $sqlresult = mysql_query($sqlinfo)
   or die(mysql_error());
 
 $count = mysql_result($sqlresult,0,count);
 
 if ($count = 0) {
   FAILED
 } else {
   while ($row = mysql_fetch_array($sqlresult)) {
 $username = $row['username'];
   }
 }
 
 The count value is set correctly but:  when the while() loop is
 executed...no values are set (there are a lot more, but I shortened it for
 spaces sake). So, $username is null. If I remove the $count line, it
 worksany suggestions?
 
 Max

Assuming that your username is unique, I would expect that you would only 
get one row returned from that query? In which case much of your SQL is 
redundant.

Anyhow, your $count line reads the first row of the result, then sets the 
pointer to the next row in the result set - if this is empty (ie only one 
row retrieved) then you will get a null result for your while loop as 
there are no more results to display. Try using mysql_data_seek to return 
the pointer to row 0 before your while loop.


-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




RE: [PHP] Re: PHP and mySQL

2002-03-05 Thread Dan Vande More

Max,
PHP.net says:

Calls to mysql_result() should not be mixed with calls to other functions
that deal with the result set. 

I would use mysql_fetch_array which they say is MUCH faster, example of how
you could use it:

?php
mysql_connect($host, $user, $password);
mysql_select_db(database);
$sqlinfo = SELECT username, COUNT(username) as count FROM usertable WHERE 
username='me' GROUP BY username;

$number_of_rows=mysql_num_rows($sqlinfo)
if($number_of_rows != '0')
{
while ($row = mysql_fetch_array($sqlinfo)) 
{
 echo count: .$row[count].br\n;
 echo username: .$row[username].br\n;
}
}
mysql_free_result($result);
?


-Original Message-
From: David Robley [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, March 05, 2002 8:29 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: PHP and mySQL

In article 180f01c1c403$2ac62820$[EMAIL PROTECTED], 
[EMAIL PROTECTED] says...
 I have a little problem when trying to count the number of results
returned
 in a mysql query. I was using mysql_num_rows() to do it with no problems,
 but this isn't as quick as using mySQL's COUNT(*), or so I have been told
so
 I swtiched. Here's a snipit of the code...
 
 $sqlinfo = SELECT username, COUNT(username) as count FROM usertable WHERE
 username='me' GROUP BY username;
 $sqlresult = mysql_query($sqlinfo)
   or die(mysql_error());
 
 $count = mysql_result($sqlresult,0,count);
 
 if ($count = 0) {
   FAILED
 } else {
   while ($row = mysql_fetch_array($sqlresult)) {
 $username = $row['username'];
   }
 }
 
 The count value is set correctly but:  when the while() loop is
 executed...no values are set (there are a lot more, but I shortened it for
 spaces sake). So, $username is null. If I remove the $count line, it
 worksany suggestions?
 
 Max

Assuming that your username is unique, I would expect that you would only 
get one row returned from that query? In which case much of your SQL is 
redundant.

Anyhow, your $count line reads the first row of the result, then sets the 
pointer to the next row in the result set - if this is empty (ie only one 
row retrieved) then you will get a null result for your while loop as 
there are no more results to display. Try using mysql_data_seek to return 
the pointer to row 0 before your while loop.


-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: PHP and mySQL

2002-01-17 Thread Gary

that is nix command. On window you need to start MySQL one of two ways.
http://www.mysql.com/doc/W/i/Windows.html

HTH
Gary

Morten Nielsen wrote:

 Hi,
 
 I try to use mySQL through PHP, but I can't get it to work.
 Both PHP and mySQL is installed on my computer (win2k). The PHP manual says
 I should run php.exe --with-mysql. But I can't figure out what that means.
 I am using a graphical development environment for PHP, where I have told
 where my php.exe file is located, but when I add the --with-mysql nothing
 happens.
 
 Please help
 
 Thanks,
 Morten
 
 
 


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




[PHP] Re: PHP 4.0.6 Mysql 4.0

2001-10-19 Thread Yasuo Ohgaki

Jeroen Geusebroek wrote:

 Hi there,
  
 Does the current stable PHP (4.06) support the use of the newly released
 Mysql 4?

No. Not even with CVS version AFAIK.

--
Yasuo Ohgaki


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




[PHP] Re: PHP and MySQL

2001-09-10 Thread Stefan de Wal

check your connection string and if it something like mysql_pconnect change
it in mysql_connect

Stefan de Wal

Pieter Philippaerts [EMAIL PROTECTED] schreef in bericht
([EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Unfortunately, I can't access these settings. It's not our computer that
 hosts
 our website.

 Regards,
 Pieter Philippaerts

 Richard Lynch [EMAIL PROTECTED] wrote in message
 01e501c138ce$f3008300$6401a8c0@Lynchux100">news:01e501c138ce$f3008300$6401a8c0@Lynchux100...
  Options:
  Increase the settings in MySQL that limit how many databases can be open
 at
  once.
  Decrease the number of Apache children running.
 
  Basically, as long as you have more Apache children than MySQL
connections
  available, you can get this message.
 
  Actually, have a few spare MySQL connections, so you can telnet/SSH in
and
  use the monitor as well, and cron jobs using MySQL can run.
 
  --
  WARNING [EMAIL PROTECTED] address is an endangered species -- Use
  [EMAIL PROTECTED]
  Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
  Volunteer a little time: http://chatmusic.com/volunteer.htm
  - Original Message -
  From: Pieter Philippaerts [EMAIL PROTECTED]
  Newsgroups: php.general
  To: [EMAIL PROTECTED]
  Sent: Friday, September 07, 2001 11:30 PM
  Subject: PHP and MySQL
 
 
   Hello,
   we're using our MySQL database quite extensively from our PHP scripts,
   but sometimes everything stops working and it says Too many
 connections.
   Is there a problem with MySQL support from within PHP? Doesn't it
close
   its connections with the database when the script stops executing?
   Is there anything I can do to resolve this problem?
  
   Regards,
   Pieter Philippaerts
  
  
 





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




[PHP] Re: PHP and MySQL

2001-09-10 Thread Pieter Philippaerts

We have never used mysql_pconnect.

Regards,
Pieter Philippaerts

Stefan De Wal [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 check your connection string and if it something like mysql_pconnect
change
 it in mysql_connect

 Stefan de Wal



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




[PHP] Re: PHP and MySQL

2001-09-08 Thread Richard Lynch

Options:
Increase the settings in MySQL that limit how many databases can be open at
once.
Decrease the number of Apache children running.

Basically, as long as you have more Apache children than MySQL connections
available, you can get this message.

Actually, have a few spare MySQL connections, so you can telnet/SSH in and
use the monitor as well, and cron jobs using MySQL can run.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Pieter Philippaerts [EMAIL PROTECTED]
Newsgroups: php.general
To: [EMAIL PROTECTED]
Sent: Friday, September 07, 2001 11:30 PM
Subject: PHP and MySQL


 Hello,
 we're using our MySQL database quite extensively from our PHP scripts,
 but sometimes everything stops working and it says Too many connections.
 Is there a problem with MySQL support from within PHP? Doesn't it close
 its connections with the database when the script stops executing?
 Is there anything I can do to resolve this problem?

 Regards,
 Pieter Philippaerts




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




[PHP] Re: PHP and MySQL

2001-09-08 Thread Pieter Philippaerts

Unfortunately, I can't access these settings. It's not our computer that
hosts
our website.

Regards,
Pieter Philippaerts

Richard Lynch [EMAIL PROTECTED] wrote in message
01e501c138ce$f3008300$6401a8c0@Lynchux100">news:01e501c138ce$f3008300$6401a8c0@Lynchux100...
 Options:
 Increase the settings in MySQL that limit how many databases can be open
at
 once.
 Decrease the number of Apache children running.

 Basically, as long as you have more Apache children than MySQL connections
 available, you can get this message.

 Actually, have a few spare MySQL connections, so you can telnet/SSH in and
 use the monitor as well, and cron jobs using MySQL can run.

 --
 WARNING [EMAIL PROTECTED] address is an endangered species -- Use
 [EMAIL PROTECTED]
 Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
 Volunteer a little time: http://chatmusic.com/volunteer.htm
 - Original Message -
 From: Pieter Philippaerts [EMAIL PROTECTED]
 Newsgroups: php.general
 To: [EMAIL PROTECTED]
 Sent: Friday, September 07, 2001 11:30 PM
 Subject: PHP and MySQL


  Hello,
  we're using our MySQL database quite extensively from our PHP scripts,
  but sometimes everything stops working and it says Too many
connections.
  Is there a problem with MySQL support from within PHP? Doesn't it close
  its connections with the database when the script stops executing?
  Is there anything I can do to resolve this problem?
 
  Regards,
  Pieter Philippaerts
 
 




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




[PHP] Re: PHP and Mysql

2001-09-05 Thread Ron Wills

Aloysius wrote:

 my mysql database just won't work .. i think i have configured it correctly cause i 
can see  a page but the codes are messed up ..
 i can confirm that the servers supports php . both php and php3 extension because 
i've tried uploading simple codes and it appears correctly ...


You might want to recheck your server. The php is definitaly not being parced, I 
should not be able to see any of the php code within the HTML. A
simple test would be to create a file like test.php with a single line
? phpinfo() ?. This should display everything about your php interpreter, if php is 
not running only that line will be displayed in your browser.
I hopes this helps locate your problem


 can anyone help ? thanks

 the link is
 http://www.arkman.f2s.com/database/index.php

 aloysius

--
Ron Wills
DMS Control Programmer
[EMAIL PROTECTED]




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




[PHP] Re: PHP 2 MySQL over the network

2001-08-24 Thread Richard Lynch

pconnect will be your biggest win, almost for sure.

After that, I'm guessing that you'll just be making very minor speed-ups...

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Boaz Yahav [EMAIL PROTECTED]
Newsgroups: php.general
To: PHP General (E-mail) [EMAIL PROTECTED]
Sent: Friday, August 24, 2001 4:22 AM
Subject: PHP 2 MySQL over the network


Hi

Till recently, out MySQL DB and our Apache/PHP/Solaris were on the same
machine. We moved to front end / back end configuration and all of the
queries are now done over the network (Switch). I was wondering if
anyone has any experience in optimizing such a configuration from the
System / MySQL / PHP side?

Issues like packet sizes, connect vs. pconect etc...


Sincerely

  berber




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




[PHP] Re: php w/ mysql support compiled in -- can't connect to mysql

2001-07-14 Thread u007

hi,

I would suggest u do not put path to mysql with php configure...simply,
--with-mysql will do..

hope iit works,

thank you

regards,
James

Kurt Lieber wrote:

 OK, there's been another thread floating around about getting:

 Fatal error: Call to undefined function: mysql_pconnect()

 Turns out, I'm getting this same error message for both mysql_pconnect
 as well as plain mysql_connect.  I'm using the PHP debian package found
 in potato. (4.0.3pl1)  phpInfo() shows me the configure command which
 includes:

 '--with-mysql=shared,/usr'

 So, I'm assuming that I really have mysql support compiled in.  mysql
 lives in /usr/bin/mysql (and is also the debian potato package)

 I'm used to windows -- this is the first time I've tried to set up
 php/mysql on linux, so I'm hoping I'm just overlooking something
 obvious. Anyone have any ideas?

 Thanks.

 --kurt


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




[PHP] RE: [PHP-DB] MySQL fulltext indices and phrase search

2001-05-02 Thread Dennis von Ferenczy

try something like splitting the keywords using the php-command split(...)
using a space as a separator
and then search for a string matching all the words using
SELECT from table WHERE string LIKE %foo% AND string LIKE %bar%;


 -Original Message-
 From: Jens Kisters [mailto:[EMAIL PROTECTED]]
 Sent: Mittwoch, 2. Mai 2001 20:13
 To: PHP-DB Mailingliste; [EMAIL PROTECTED]
 Subject: [PHP-DB] MySQL fulltext indices and phrase search


 Hi there, is there a possibility to use MySQL's MATCH ... AGAINST to
 look for a string like foo bar ?

 if i MATCH keyname AGAINST ('foo bar') i get resuts that match foo or
 bar, but not both of them separated by a space.

 My guess is that the organization of the index doesn't allow this kind
 of search as it's based on single words , but maybe one of you has a
 better idea than
 to select the rows that contain both and hit those with LIKE '%foo bar%'

 --
 Grüße aus dem schönen Kleve
 Jens Kisters

 rosomm et partner
 Agentur für neue Medien GmbH
 Dienstleistungszentrum am
 Weißen Tor - Eingang B
 Gocher Landstrasse 2
 47551 Kleve / Bedburg-Hau

 Telefon: 02821 - 97856-20
 Telefax: 02821 - 97856-77
 [EMAIL PROTECTED]
 http://www.rosomm-partner.de



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



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