Re: [PHP-DB] PHP & Case Sensitivity

2002-11-03 Thread Jason Wong
On Monday 04 November 2002 07:25, Graeme McLaren wrote:
> Hey all, I've had a bizarre experience.  When I uploaded a php script it
> worked fine and when I was looking through my code I found that it
> shouldn't have worked because two variables had been used instead of
> one.  What I'm meaning is, I used $Year and $year where I was just
> supposed to use $Year, the case insensitivity didn't seem to make a
> blind bit of difference.  I've corrected it now and the script runs as
> it did previously.
>
> Did PHP just correct this at run time?  Anyone know why this worked?

PHP is case-sensitive for variables. There are two possibilities:

1) Your code is buggy
2) PHP is buggy

I suspect it's the former :) but if you think it's the latter then post your 
code here.

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


/*
One big pile is better than two little piles.
-- Arlo Guthrie
*/


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




Re: [PHP-DB] Getting affected rows before executing query?

2002-11-03 Thread Jason Wong
On Monday 04 November 2002 10:47, Leif K-Brooks wrote:
> I keep forgetting where clauses.  It's my dumbest mistake, and I always
> make it.  I just lost the password of everyone on my site trying to
> change my own - not good.  Anyway, I'm trying to edit PhpMyAdmin to warn
> if there's more than a certain number of affected rows for a query.  Is
> there a way to tell number of affected rows before executing the query?

AFAIK there isn't. What you can do are:

1) Get into the habit of writing WHERE clauses.
2) Write SELECT queries instead, once you're sure you've got it right change 
it to a DELETE query.
3) Backup your database/tables before doing anything drastic.

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


/*
Art is a jealous mistress.
-- Ralph Waldo Emerson
*/


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




Re: [PHP-DB] Check If Table Exists

2002-11-03 Thread Tony72284

   RTFM?



Re: [PHP-DB] error messages to variables

2002-11-03 Thread Jason Wong
On Monday 04 November 2002 12:10, Bob Lockie wrote:
> "You can suppress the error message on failure by prepending a @
>  to
> the function name.".
> How can you get the error string into a local variable?

Look at the "track_errors" setting in php.ini.

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


/*
I can't stand squealers; hit that guy.
-- Albert Anastasia
*/


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




Re: [PHP-DB] Connecting to DB on separate server?

2002-11-03 Thread Jason Wong
On Monday 04 November 2002 12:35, Bob Lockie wrote:
> Cassy M Rowe wrote:
> > I have a php page on server #1 trying to access a database on server
> > #2.  What do I put in the following blanks:
> >
> > $hostname: ___ (have tried IP, http, localhost, nothing works)

IP address or the FQDN (obviously it has to be resovable to an IP address).

> > $username: blah
> > $password: blah
> > $database: _

Just the name of the database.

> > $link=mysql_connect($hostname, $user, $pass) or die("Failure to
> > communicate with database");
> >
> > $close=mysql_select_db($database, $link);
> >
> >
> >
> > All I get is the "Failure to communicate."  message.
> >
> > Server #1: ellerweb.eller.arizona.edu
> > Server #2: datamonster.sbs.arizona.edu
> > $database is cassy, but do I need to add anything to that?

The obvious question is: does server #2 ALLOW remote connections from server 
#1? If so does it work if you connect using the mysql command line?

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


/*
It's not so hard to lift yourself by your bootstraps once you're off the 
ground.
-- Daniel B. Luten
*/


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




Re: [PHP-DB] Check If Table Exists

2002-11-03 Thread Jason Wong
On Monday 04 November 2002 13:52, [EMAIL PROTECTED] wrote:
>How do I check to see if a table exists?

RTFM of whatever database you're using.

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


/*
mathematician, n.:
Some one who believes imaginary things appear right before your _i's.
*/


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




[PHP-DB] Check If Table Exists

2002-11-03 Thread Tony72284

   How do I check to see if a table exists?



[PHP-DB] Re: Generating readio buttons

2002-11-03 Thread David Jackson
OK, this works but there has to be a pretty way?

David

- Works -


Operation Sticky Bun
Operation Sticky Bun 

';
$header = mysql_query ("SELECT * FROM chart
   ORDER BY acct ");
if ($row = mysql_fetch_array($header)) {
do {
   print '';
   print $row["descript"];print '';
   } while($row = mysql_fetch_array($header));

} else {print "Sorry, no records were found!";}

print '';
?>







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




Re: [PHP-DB] Connecting to DB on separate server?

2002-11-03 Thread Bob Lockie
Cassy M Rowe wrote:


I have a php page on server #1 trying to access a database on server 
#2.  What do I put in the following blanks:

$hostname: ___ (have tried IP, http, localhost, nothing works)
$username: blah
$password: blah
$database: _

$link=mysql_connect($hostname, $user, $pass) or die("Failure to 
communicate with database");

$close=mysql_select_db($database, $link);



All I get is the "Failure to communicate."  message.

Server #1: ellerweb.eller.arizona.edu
Server #2: datamonster.sbs.arizona.edu
$database is cassy, but do I need to add anything to that?

I've tried asking two people who are really good at this and they have 
no answers.

THANK YOU IN ADVANCE!

Cassy Rowe

Maybe you have to specify the port of the database on the remote machine.
Maybe the MySQL daemon is not running?

--


From Mozilla and GNU/Linux




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




[PHP-DB] Connecting to DB on separate server?

2002-11-03 Thread Cassy M Rowe
I have a php page on server #1 trying to access a database on server 
#2.  What do I put in the following blanks:

$hostname: ___ (have tried IP, http, localhost, nothing works)
$username: blah
$password: blah
$database: _

$link=mysql_connect($hostname, $user, $pass) or die("Failure to 
communicate with database");

$close=mysql_select_db($database, $link);



All I get is the "Failure to communicate."  message.

Server #1: ellerweb.eller.arizona.edu
Server #2: datamonster.sbs.arizona.edu
$database is cassy, but do I need to add anything to that?

I've tried asking two people who are really good at this and they have 
no answers.

THANK YOU IN ADVANCE!

Cassy Rowe


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



[PHP-DB] error messages to variables

2002-11-03 Thread Bob Lockie
"You can suppress the error message on failure by prepending a @ 
 to 
the function name.".
How can you get the error string into a local variable?



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



[PHP-DB] Getting affected rows before executing query?

2002-11-03 Thread Leif K-Brooks
I keep forgetting where clauses.  It's my dumbest mistake, and I always 
make it.  I just lost the password of everyone on my site trying to 
change my own - not good.  Anyway, I'm trying to edit PhpMyAdmin to warn 
if there's more than a certain number of affected rows for a query.  Is 
there a way to tell number of affected rows before executing the query?

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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



RE: [PHP-DB] LIKE statement or IN statement?

2002-11-03 Thread John W. Holmes
> ok so you would have to use :
> --select count(distinct itemid) from business where name like 'word1'
or
> name like 'word2' or name like 'word3';
> no other go.

If you're not going to use wildcards, then you can use IN. The whole
idea of using LIKE is that you can use _ and % as wildcards when
searching.

---John Holmes...



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




Re: [PHP-DB] boolean instead of array

2002-11-03 Thread John Coder
On Sun, 2002-11-03 at 15:01, Jason Wong wrote:
> On Sunday 03 November 2002 20:58, John Coder wrote:
> > > Try adding some error checking into your code (see manual examples) and
> > > using mysql_error() to find out what's going.
> >
> > What error checking to insert into this code I'm clueless. I found out
> 
> Again, have a look at the examples in the manual (the MySQL functions 
> section). The example which starts the chapter shows quite explicitly how you 
> should
> 
>   (i) establish a connection to the mysql server
>  (ii) select a database to query
> (iii) perform a query
>  (iv) display the results of the query
> 
> And for good measure you should alter the die() statements to incorporate a 
> mysql generated error message:
> 
>  die("" . mysql_error());
 This all I have done and it generates no errors since it returns a
value althogh a boolean type as opposed to Array. Out of 4 different
queries this one is the one that returns a boolean. when I said I have
no idea how to generate an error message I meant how to generate a error
message concerning wrong type of return not no return. 
Sorry if I wasn't clear enough before.

John Coder
 PS everything goes at it should without this query. it's actually shoes
the same with or without the query. but this query is just to generate a
list of names for a graph. the graph itself is generated but the names
aren't





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




RE: [PHP-DB] LIKE statement or IN statement?

2002-11-03 Thread Amit_Wadhwa
ok so you would have to use :
--select count(distinct itemid) from business where name like 'word1' or
name like 'word2' or name like 'word3';
no other go.




..
You can't use wildcards with IN, only with LIKE or regular expressions.

---John Holmes...

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:Amit_Wadhwa@;Dell.com]
> Sent: Sunday, November 03, 2002 5:31 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] LIKE statement or IN statement?
> 
> if you want to search for multiple words, u have to use multiple like
> operators:
> select count(distinct itemid) from business where name like 'word1' or
> name like 'word2' or name like 'word3';
> 
>  or the IN statement with wildcards:
> select count(distinct itemid) from business where name IN
> ('%word1%','%word2%','%word3%');  <-- im not too sure of this, would
the
> experts please shed some more light on this one if its correct?
> 
> Amit
> 
> On 4 Nov 2002, Chris Barnes wrote:
> 
> > Hi,
> > I've got a dilly of a problem. I'm probably doing something wrong
but
> I
> > don't know what. I'm trying to use the LIKE statement in a query
where
> > more than one word is used in with LIKE..e.g.
> >
> > select count(distinct itemid) from business where name or
description
> > like 'word1 word2 word3%'
> >
> > The problem I'm having is probably obvious to you but I don't know
why
> > this returns no matches but if i specify only 1 word in the LIKE
> > statement then it returns a match.
> >
> > Am i not able to specify more than 1 word with LIKE or am I just
doing
> > it wrong?
> >
> > It has been designed to take input from a web form by the variable
> > $search_string and then the query string is constructed from that
e.g.
> >
> > $query = "select count(distinct itemid) from business where name or
> > description like'" . $search_string . "'";
> >
> >
> > Any help or suggestions greatly appreciated.
> >
> 
>

> ---
> Peter BeckmanSystems Engineer, Fairfax Cable Access
> Corporation
> [EMAIL PROTECTED]
> http://www.purplecow.com/
>

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





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




Re: [PHP-DB] Generating readio buttons

2002-11-03 Thread David Jackson
Peter Beckman wrote:

Here's your problem:

"acct[]" doesn't equal anything.

$acct[4] might.

So:

echo "";


Peter -- Thanks again for you help.
I wonder if it's not a quoting issue on my part?
How would I use the $row["column_name"], in the above statement? Since
it not a $_POST[] filed?


Thanks in  advance,
David


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




Re: [PHP-DB] LIKE statement or IN statement?

2002-11-03 Thread David Jackson
Chris Barnes wrote:

Yeah I really need to search for multiple words. Can anyone confirm if
the IN statement will work for me in this situation?

Chris --
Why not just try it you self and let's us know.
Also check to MySQL doc at http://mysql.org

David





On Mon, 2002-11-04 at 09:31, [EMAIL PROTECTED] wrote:


if you want to search for multiple words, u have to use multiple like
operators:
select count(distinct itemid) from business where name like 'word1' or
name like 'word2' or name like 'word3';

or the IN statement with wildcards:
select count(distinct itemid) from business where name IN
('%word1%','%word2%','%word3%');  <-- im not too sure of this, would the
experts please shed some more light on this one if its correct?

Amit

On 4 Nov 2002, Chris Barnes wrote:



Hi,
I've got a dilly of a problem. I'm probably doing something wrong but


I


don't know what. I'm trying to use the LIKE statement in a query where
more than one word is used in with LIKE..e.g.

select count(distinct itemid) from business where name or description
like 'word1 word2 word3%'

The problem I'm having is probably obvious to you but I don't know why
this returns no matches but if i specify only 1 word in the LIKE
statement then it returns a match.

Am i not able to specify more than 1 word with LIKE or am I just doing
it wrong?

It has been designed to take input from a web form by the variable
$search_string and then the query string is constructed from that e.g.

$query = "select count(distinct itemid) from business where name or
description like'" . $search_string . "'";


Any help or suggestions greatly appreciated.




---
Peter BeckmanSystems Engineer, Fairfax Cable Access
Corporation
[EMAIL PROTECTED]
http://www.purplecow.com/

---


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



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








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




RE: [PHP-DB] LIKE statement or IN statement?

2002-11-03 Thread John W. Holmes
You can't use wildcards with IN, only with LIKE or regular expressions.

---John Holmes...

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:Amit_Wadhwa@;Dell.com]
> Sent: Sunday, November 03, 2002 5:31 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] LIKE statement or IN statement?
> 
> if you want to search for multiple words, u have to use multiple like
> operators:
> select count(distinct itemid) from business where name like 'word1' or
> name like 'word2' or name like 'word3';
> 
>  or the IN statement with wildcards:
> select count(distinct itemid) from business where name IN
> ('%word1%','%word2%','%word3%');  <-- im not too sure of this, would
the
> experts please shed some more light on this one if its correct?
> 
> Amit
> 
> On 4 Nov 2002, Chris Barnes wrote:
> 
> > Hi,
> > I've got a dilly of a problem. I'm probably doing something wrong
but
> I
> > don't know what. I'm trying to use the LIKE statement in a query
where
> > more than one word is used in with LIKE..e.g.
> >
> > select count(distinct itemid) from business where name or
description
> > like 'word1 word2 word3%'
> >
> > The problem I'm having is probably obvious to you but I don't know
why
> > this returns no matches but if i specify only 1 word in the LIKE
> > statement then it returns a match.
> >
> > Am i not able to specify more than 1 word with LIKE or am I just
doing
> > it wrong?
> >
> > It has been designed to take input from a web form by the variable
> > $search_string and then the query string is constructed from that
e.g.
> >
> > $query = "select count(distinct itemid) from business where name or
> > description like'" . $search_string . "'";
> >
> >
> > Any help or suggestions greatly appreciated.
> >
> 
>

> ---
> Peter BeckmanSystems Engineer, Fairfax Cable Access
> Corporation
> [EMAIL PROTECTED]
> http://www.purplecow.com/
>

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




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




RE: [PHP-DB] LIKE statement or IN statement?

2002-11-03 Thread Chris Barnes
Yeah I really need to search for multiple words. Can anyone confirm if
the IN statement will work for me in this situation?

On Mon, 2002-11-04 at 09:31, [EMAIL PROTECTED] wrote:
> if you want to search for multiple words, u have to use multiple like
> operators:
> select count(distinct itemid) from business where name like 'word1' or
> name like 'word2' or name like 'word3';
> 
>  or the IN statement with wildcards:
> select count(distinct itemid) from business where name IN
> ('%word1%','%word2%','%word3%');  <-- im not too sure of this, would the
> experts please shed some more light on this one if its correct?
> 
> Amit
> 
> On 4 Nov 2002, Chris Barnes wrote:
> 
> > Hi,
> > I've got a dilly of a problem. I'm probably doing something wrong but
> I
> > don't know what. I'm trying to use the LIKE statement in a query where
> > more than one word is used in with LIKE..e.g.
> >
> > select count(distinct itemid) from business where name or description
> > like 'word1 word2 word3%'
> >
> > The problem I'm having is probably obvious to you but I don't know why
> > this returns no matches but if i specify only 1 word in the LIKE
> > statement then it returns a match.
> >
> > Am i not able to specify more than 1 word with LIKE or am I just doing
> > it wrong?
> >
> > It has been designed to take input from a web form by the variable
> > $search_string and then the query string is constructed from that e.g.
> >
> > $query = "select count(distinct itemid) from business where name or
> > description like'" . $search_string . "'";
> >
> >
> > Any help or suggestions greatly appreciated.
> >
> 
> 
> ---
> Peter BeckmanSystems Engineer, Fairfax Cable Access
> Corporation
> [EMAIL PROTECTED]
> http://www.purplecow.com/
> 
> ---
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 




signature.asc
Description: This is a digitally signed message part


[PHP-DB] PHP & Case Sensitivity

2002-11-03 Thread Graeme McLaren
Hey all, I've had a bizarre experience.  When I uploaded a php script it
worked fine and when I was looking through my code I found that it
shouldn't have worked because two variables had been used instead of
one.  What I'm meaning is, I used $Year and $year where I was just
supposed to use $Year, the case insensitivity didn't seem to make a
blind bit of difference.  I've corrected it now and the script runs as
it did previously.

Did PHP just correct this at run time?  Anyone know why this worked?


Cheers,

Graeme :)

P.S.  Seabird:  I had a quick look at your site, it seems to work fine
but I didn't look at it in any great depth.  But so far so good !




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




RE: [PHP-DB] LIKE statement or IN statement?

2002-11-03 Thread Amit_Wadhwa
if you want to search for multiple words, u have to use multiple like
operators:
select count(distinct itemid) from business where name like 'word1' or
name like 'word2' or name like 'word3';

 or the IN statement with wildcards:
select count(distinct itemid) from business where name IN
('%word1%','%word2%','%word3%');  <-- im not too sure of this, would the
experts please shed some more light on this one if its correct?

Amit

On 4 Nov 2002, Chris Barnes wrote:

> Hi,
> I've got a dilly of a problem. I'm probably doing something wrong but
I
> don't know what. I'm trying to use the LIKE statement in a query where
> more than one word is used in with LIKE..e.g.
>
> select count(distinct itemid) from business where name or description
> like 'word1 word2 word3%'
>
> The problem I'm having is probably obvious to you but I don't know why
> this returns no matches but if i specify only 1 word in the LIKE
> statement then it returns a match.
>
> Am i not able to specify more than 1 word with LIKE or am I just doing
> it wrong?
>
> It has been designed to take input from a web form by the variable
> $search_string and then the query string is constructed from that e.g.
>
> $query = "select count(distinct itemid) from business where name or
> description like'" . $search_string . "'";
>
>
> Any help or suggestions greatly appreciated.
>


---
Peter BeckmanSystems Engineer, Fairfax Cable Access
Corporation
[EMAIL PROTECTED]
http://www.purplecow.com/

---


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



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




Re: [PHP-DB] Generating readio buttons

2002-11-03 Thread Peter Beckman
Here's your problem:

"acct[]" doesn't equal anything.

$acct[4] might.

So:

echo "";

might give you want you want.

The name='acct[]' is used for PHP form processing, putting the correct
value in the variable.  For example, $acct[Yes] might be set if you used
this input and it was checked:



Peter

On Sun, 3 Nov 2002, David Jackson wrote:

> Peter Beckman wrote:
>
> Peter,
> Thanks for your prompt reply.
>
> > Gonna need some additional information, such as:
> >
> >  1. The first three rows your query returns
> >  2. The expected output
> >  3. The actual problem and/or error.
>
> What I'm trying todo is build a radio box form
> for the selection of ledger accounts for a account app.
> ( http://mustardandrelish.com/ledger)
>
> Query returns (from HTML table):
> 
> 
> 
>
> Expected results might be:
>
> 
> 
> 
>
> And then "gl_acct" will be passed to the G/L entry screen
> (sticky forms?)
>
> TIA,
> David
>
>
> >
> > Peter
> >
> > On Sun, 3 Nov 2002, David Jackson wrote:
> >
> >
> >>Howdy --
> >>How do I dynamically generate the "value" for radio buttons off the DB
> >>(MySQL) backend? Here's some code that almost works
> >>
> >>TIA,
> >>David
> >>
> >>- Almost works 
> >> >>$header = mysql_query ("SELECT * FROM chart
> >>ORDER BY acct ");
> >>
> >>if ($row = mysql_fetch_array($header)) {
> >> do {
> >> print("");
> >>print ' >>value=acct[]">';
> >>print("");
> >>print $row["acct"];
> >> print "";
> >>print $row["cat"];
> >> print "";
> >>print $row["descript"];
> >>print("\n");
> >>} while($row = mysql_fetch_array($header));
> >>
> >> } else {print "Sorry, no records were found!";}
> >>
> >>
> >>?>
> >>
> >>
> >>--
> >>PHP Database Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >
> >
> > ---
> > Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
> > [EMAIL PROTECTED] http://www.purplecow.com/
> > ---
> >
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---


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




Re: [PHP-DB] mysql_connect problem rh7.3

2002-11-03 Thread Wouter
Thanks!

I was able to get native mysql support by adding

	extension=mysql.so

to php.ini. So now mysql_connect() works


John Coder wrote:

While Micah is correct,  you do have mysql support on php but  as a dbs
not the built in php fuctions. Therefore you must use the dbx functions
instead.

John Coder
On Sat, 2002-11-02 at 14:35, Micah Stevens wrote:


It doesn't appear you have the PHP MySQL functions installed. When you run 
phpinfo() you should get something like:

mysql
MySQL Supportenabled
Active Persistent Links1
Active Links1
Client API version3.23.39
MYSQL_MODULE_TYPEbuiltin
MYSQL_SOCKET/var/lib/mysql/mysql.sock
MYSQL_INCLUDE
MYSQL_LIBS

The command I've always used for this during compile time is "--with-mysql" 
without any options. I'm not sure what "=shared, /tmp" does, but apparently 
it's not doing the trick.

-Micah


At 03:32 PM 11/2/2002 +0100, Wouter wrote:

Hello,

I've a rather complete php install on redhat 7.3, yet I cant't get php to 
connect to mysql. I get:

   Fatal error: Call to undefined function: mysql_connect() in
   ...

It seems that the necessary packages are installed:

[root@axon ~]# rpm -qa | grep php
php-4.1.2-7.3.4
php-mysql-4.1.2-7.3.4
asp2php-0.76.2-1
php-devel-4.1.2-7.3.4
php-ldap-4.1.2-7.3.4
php-imap-4.1.2-7.3.4
[root@axon ~]# rpm -qa | gi mysql
mysql-3.23.49-3
mysql-server-3.23.49-3
php-mysql-4.1.2-7.3.4
mysql-devel-3.23.49-3
mysqlclient9-3.23.22-6


I've attached the start of phpinfo() at the end...

Any ideas? Maybe php.ini needs some change, but I can't figure which one..

Thanks,
Wouter


PHP Version 4.1.2

System Linux stripples.devel.redhat.com 2.4.18-11smp #1 SMP Thu Aug 15 
06:41:59 EDT 2002 i686 unknown
Build Date Aug 21 2002
Configure Command  './configure' 'i386-redhat-linux' '--prefix=/usr' 
'--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' 
'--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' 
'--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' 
'--sharedstatedir=/usr/com' '--mandir=/usr/share/man' 
'--infodir=/usr/share/info' '--prefix=/usr' '--with-config-file-path=/etc' 
'--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' 
'--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db3' 
'--with-curl' '--with-dom=/usr' '--with-exec-dir=/usr/bin' 
'--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' 
'--enable-gd-native-ttf' '--with-ttf' '--with-gdbm' '--with-gettext' 
'--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' 
'--with-mm' '--with-openssl' '--with-png' '--with-pspell' 
'--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-zlib' 
'--with-layout=GNU' '--enable-bcmath' '--enable-debugger' '--enable-exif' 
'--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' 
'--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' 
'--enable-discard-path' '--enable-track-vars' '--enable-trans-sid' 
'--enable-yp' '--enable-wddx' '--without-oci8' '--with-imap=shared' 
'--with-imap-ssl' '--with-kerberos=/usr/kerberos' '--with-ldap=shared' 
'--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' 
'--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared' 
'--enable-memory-limit' '--enable-bcmath' '--enable-shmop' 
'--enable-versioning' '--enable-calendar' '--enable-dbx' '--enable-dio' 
'--enable-mbstring' '--enable-mbstr-enc-trans' '--with-apxs=/usr/sbin/apxs'






dbx
dbx support enabled
dbx version 1.0.0
supported databases MySQLODBCPostgreSQLMicrosoft SQL 
ServerFrontBase









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




Re: [PHP-DB] boolean instead of array

2002-11-03 Thread Jason Wong
On Sunday 03 November 2002 20:58, John Coder wrote:
> > Try adding some error checking into your code (see manual examples) and
> > using mysql_error() to find out what's going.
>
> What error checking to insert into this code I'm clueless. I found out

Again, have a look at the examples in the manual (the MySQL functions 
section). The example which starts the chapter shows quite explicitly how you 
should

  (i) establish a connection to the mysql server
 (ii) select a database to query
(iii) perform a query
 (iv) display the results of the query

And for good measure you should alter the die() statements to incorporate a 
mysql generated error message:

 die("" . mysql_error());

Once you get that example working, you can modify (one step at a time) to suit 
your needs.

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


/*
Spock: The odds of surviving another attack are 13562190123 to 1, Captain.
*/


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




Re: [PHP-DB] Generating readio buttons

2002-11-03 Thread David Jackson
Peter Beckman wrote:

Peter,
Thanks for your prompt reply.


Gonna need some additional information, such as:

 1. The first three rows your query returns
 2. The expected output
 3. The actual problem and/or error.


What I'm trying todo is build a radio box form
for the selection of ledger accounts for a account app.
( http://mustardandrelish.com/ledger)

Query returns (from HTML table):




Expected results might be:





And then "gl_acct" will be passed to the G/L entry screen
(sticky forms?)

TIA,
David




Peter

On Sun, 3 Nov 2002, David Jackson wrote:



Howdy --
How do I dynamically generate the "value" for radio buttons off the DB
(MySQL) backend? Here's some code that almost works

TIA,
David

- Almost works 
");
   print '';
   print("");
   print $row["acct"];
print "";
   print $row["cat"];
print "";
   print $row["descript"];
   print("\n");
   } while($row = mysql_fetch_array($header));

} else {print "Sorry, no records were found!";}


?>


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




---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---





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




[PHP-DB] Re: LIKE statement

2002-11-03 Thread David Jackson
Chris Barnes wrote:

Hi,
I've got a dilly of a problem. I'm probably doing something wrong but I
don't know what. I'm trying to use the LIKE statement in a query where
more than one word is used in with LIKE..e.g.

select count(distinct itemid) from business where name or description
like 'word1 word2 word3%'


Chris --
The answer depends on what database you using? MySQL has a IN operator, 
so you might try:
SELECT * from table
WHERE name IN ('value1','value2','value3)
OR
WHERE description IN ('value1','value2','value3)

Your might want to cross post to MySQL list.


HTH,
David


The problem I'm having is probably obvious to you but I don't know why
this returns no matches but if i specify only 1 word in the LIKE
statement then it returns a match.

Am i not able to specify more than 1 word with LIKE or am I just doing
it wrong?

It has been designed to take input from a web form by the variable
$search_string and then the query string is constructed from that e.g.

$query = "select count(distinct itemid) from business where name or
description like'" . $search_string . "'";


Any help or suggestions greatly appreciated.




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




Re: [PHP-DB] Generating readio buttons

2002-11-03 Thread Peter Beckman
Gonna need some additional information, such as:

 1. The first three rows your query returns
 2. The expected output
 3. The actual problem and/or error.

Peter

On Sun, 3 Nov 2002, David Jackson wrote:

> Howdy --
> How do I dynamically generate the "value" for radio buttons off the DB
> (MySQL) backend? Here's some code that almost works
>
> TIA,
> David
>
> - Almost works 
>  $header = mysql_query ("SELECT * FROM chart
> ORDER BY acct ");
>
> if ($row = mysql_fetch_array($header)) {
>  do {
>  print("");
> print ' value=acct[]">';
> print("");
> print $row["acct"];
>  print "";
> print $row["cat"];
>  print "";
> print $row["descript"];
> print("\n");
> } while($row = mysql_fetch_array($header));
>
>  } else {print "Sorry, no records were found!";}
>
>
> ?>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---


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




Re: [PHP-DB] LIKE statement

2002-11-03 Thread Peter Beckman
change your query to this:

select count(distinct itemid) from business where name like 'word1 word2
word3%' or description like 'word1 word2 word3%';

Peter

On 4 Nov 2002, Chris Barnes wrote:

> Hi,
> I've got a dilly of a problem. I'm probably doing something wrong but I
> don't know what. I'm trying to use the LIKE statement in a query where
> more than one word is used in with LIKE..e.g.
>
> select count(distinct itemid) from business where name or description
> like 'word1 word2 word3%'
>
> The problem I'm having is probably obvious to you but I don't know why
> this returns no matches but if i specify only 1 word in the LIKE
> statement then it returns a match.
>
> Am i not able to specify more than 1 word with LIKE or am I just doing
> it wrong?
>
> It has been designed to take input from a web form by the variable
> $search_string and then the query string is constructed from that e.g.
>
> $query = "select count(distinct itemid) from business where name or
> description like'" . $search_string . "'";
>
>
> Any help or suggestions greatly appreciated.
>

---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---


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




[PHP-DB] Generating readio buttons

2002-11-03 Thread David Jackson
Howdy --
How do I dynamically generate the "value" for radio buttons off the DB 
(MySQL) backend? Here's some code that almost works

TIA,
David

- Almost works 

$header = mysql_query ("SELECT * FROM chart
   ORDER BY acct ");

if ($row = mysql_fetch_array($header)) {
do {
print("");
   print '';
   print("");
   print $row["acct"];
print "";
   print $row["cat"];
print "";
   print $row["descript"];
   print("\n");
   } while($row = mysql_fetch_array($header));

} else {print "Sorry, no records were found!";}


?>


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



[PHP-DB] LIKE statement

2002-11-03 Thread Chris Barnes
Hi,
I've got a dilly of a problem. I'm probably doing something wrong but I
don't know what. I'm trying to use the LIKE statement in a query where
more than one word is used in with LIKE..e.g.

select count(distinct itemid) from business where name or description
like 'word1 word2 word3%'

The problem I'm having is probably obvious to you but I don't know why
this returns no matches but if i specify only 1 word in the LIKE
statement then it returns a match.

Am i not able to specify more than 1 word with LIKE or am I just doing
it wrong?

It has been designed to take input from a web form by the variable
$search_string and then the query string is constructed from that e.g.

$query = "select count(distinct itemid) from business where name or
description like'" . $search_string . "'";


Any help or suggestions greatly appreciated.



signature.asc
Description: This is a digitally signed message part


[PHP-DB] security check

2002-11-03 Thread Seabird
Hi everyone,

on my site I created a login which is supposed to be secure. I'm not
familiar with how to surpass signups, but was wondering if people can see if
they can get my page to view without signing up. The page that is supposed
to be secured is the about me index. (the rest is still open).

http://seabird.jmtech.ca

Please report any other issues aswell.
Jacco
--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching



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




RE: [PHP-DB] boolean instead of array

2002-11-03 Thread Josh Johnson
It's hard to tell which output is from which loop, you might be getting
confused (if anything, you might be confusing anyone that might help)...
the Boolean  was probabally due to a bad result, for whatever reason
(maybe your connect code was wrong? I'm not sure but I think you get a
valid resource id even when your connection fails or you don't get any
returs on your query), and the arrays were more than likely empty before
if they didn't contain your results, because mysql_fetch_row returned an
array of nulls (try looping through those arrays, and checking is_null
on the values).

I'll skip the lecture on naming conventions, especially the lengthy
section about other people reading your code.

Without seeing the rest of your script, or your talbe structure, you
might want to try a LEFT JOIN in your query, that will preserve values
that are null. You might also want to use mysql_fetch_array (or
mysql_fetch_object), which I've always used, and never had a problem
getting results from.

I'd be nice to at least see your table structure, then I or anybody else
here could give you a more precise answer. 

I'd suggest looking at the mysql manual entries for SUM, JOIN, LEFT
JOIN, and the php manual entries for mysql_fetch_row, mysql_fetch_array,
and mysql_query. 

Hope this is helpful!

-- Josh

-Original Message-
From: John Coder [mailto:jcoder@;insightbb.com] 
Sent: Saturday, November 02, 2002 9:23 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] boolean instead of array

I seem to somehow get an boolean instead of an array from a
mysql_fetch_row function and I have no idea how.
Here's the code;



$names=mysql_query("select name from dept join picdata where
dept.deptid=picdata.deptid limit 5");

print $names."";
//offending query


$resets=mysql_query("select sum(reset) from Tmp group by deptid order
by deptid limit 5");


while($c=mysql_fetch_row($names));
{
//$a[]=$c[0]; commented out for troubleshooting
$y=gettype($c);
print $y."";
}

while($e=mysql_fetch_row($resets))
 {
  $z=gettype($e);
  print $z."";
 //$b[]=$e[0]; commented out for troubleshooting
 }

Here's the output from a terminal:

select name from dept join picdata where picdata.deptid=dept.deptid
limit 5;
+-+
| name|
+-+
| BodyWatch   |
| BreakThroughGallery |
| TempGallery |
| KidZone |
| Lobby   |
+-+
5 rows in set (0.01 sec)

here's the output from the browser:

Resource id #3
boolean
array
array
array
array
array


Any suggestions as to what I'm doing wrong?

John Coder






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



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




Re: [PHP-DB] boolean instead of array

2002-11-03 Thread John Coder
On Sun, 2002-11-03 at 01:44, Jason Wong wrote:
> On Sunday 03 November 2002 10:23, John Coder wrote:
> > I seem to somehow get an boolean instead of an array from a
> > mysql_fetch_row function and I have no idea how.
> > Here's the code;
> 
> Try adding some error checking into your code (see manual examples) and using 
> mysql_error() to find out what's going.
> 

What error checking to insert into this code I'm clueless. I found out
why I wasn't getting an array by inserting gettype and finding out it's
a boolean type instead of array but past that checking out why It's
boolean type I have no idea how to begin.

John Coder



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