Re: [PHP-DB] Big speed problem with MySQL

2002-02-18 Thread Arthur CARANTA

Ok I found what was the main source of slowlyness in my application : awful
coding I made, which make several thousands of useless big queries !!! So I
am optimizing my system.

Nevertheless, I am new to DB cogin, so could you tell me more on Indexes ?
What do they do ? Do they really incease speed on great tables ? How do I
set or create them ?

Thanks for your answers ...


Miles Thompson [EMAIL PROTECTED] a écrit dans le message de
news: [EMAIL PROTECTED]
 How are you fetching the data?
 Do you have indexes on the key fields used in queries?
 Are you doing the work in SQL or sorting /rearranging a lot of arrays?

 There are many possibilities for slowness, but you have to tell us what
 you're doing.

 Regards - Miles Thompson

 At 11:53 AM 2/15/2002 +0100, Arthur CARANTA wrote:
 Hi everyone.
 
 I have a big problem with my billing software.
 
 I have coded it using PHP and MySQL as the database.
 
 Everything seems ok, but when I do accesses to my DB, it is very slow !
 
 For example, I am able to download the csv file for a specified account
 (that is not the problem).
 If I download a dumb file generated by random text by PHP, the transfer
rate
 (on my LAN) is fast 50Kb/s (for example). But if this file is generated
by
 PHP from data collected in MySQL (which base is on the same PC than PHP
 webserver) then the transfer rate is less than 3.5Kb/s!!!
 I don't know what to do ... The consequence of that is that the PHP
programs
 are stopped because of script timeout.
 
 Anyone has an idea to save me ?
 
 Arthur
 [EMAIL PROTECTED]
 
 
 
 --
 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] finding ID's

2002-02-18 Thread DL Neil

Ok Jonathan,
[I've put the answer back on the list - there are others who can help, and may well 
get back to you faster than
I]

 Ok I get the auto_increment stuff... Just one more question. Let's say I
 want to show 25 rows per page. I want the script to generate links to
 the next page, and so on. How do I make it show from the highest ID to
 25 rows down? There is no auto_decrement Here's an example:

 ID

 1
 4
 5
 8
 10
 11
 12
 15
 17
 18


 I want to show the 5 newest rows (have the highest ID's).


AUTO_INCREMENT (and your 'AUTO_DECREMENT) only has relevance when a row is being added 
to the table. When a
SELECT is performed, the value is returned, fixed, and numeric, just as if it were any 
other integer and/or one
that you had loaded as a literal value.

It does not have any effect on SELECTs. Thus if you SELECT * FROM tblNm, you will not 
necessarily retrieve the
rows in ascending sequence of the id field! Did you already realise this? To retrieve 
the data 'in order' you
will need to add an extra clause:

SELECT * FROM tblNm ORDER BY id;


That said, perhaps you have two questions here:

- sequence the results of a SELECT in inverse order to the AUTO_INCREMENT/id field 
value by using the ORDER BY
id DESC. [RTFM: 3.3.4.4  Sorting Rows] BTW Chapter 3 of the manual is a useful 
tutorial/user guide that covers
many of these topics/offers a functional introduction.

- how can a long resultset be split up and displayed on several web pages using a 
PREV/NEXT page link facility?
This answer revolves around the LIMIT clause [RTFM: 6.4.1  SELECT Syntax]

SELECT select_expression,...
  [LIMIT [offset,] rows]

The first page is populated with a query saying LIMIT 0, 25, and the next LIMIT 25, 50 
(or that 24 and 49?)
BTW I was working off your earlier quote of 25 cf the later of 5

This combination of HTML, PHP, and MySQL is not discussed in the MySQL manual, but 
there are a number of
tutorial articles available on the various PHP support sites. If you need to get 
started/make contacts, visit
the MySQL and/or PHP home pages and follow their links, or Google-it. There are also 
some prepared
classes/scripts available for the downloading which will save you the coding time 
(unless you want to learn for
yourself). You will also find this in any book covering PHP and MySQL - a most 
worthwhile investment if you're
going to 'walk amongst us' for a while!

Regards,
=dn



  (comments interposed, below)
 
  Try using something like
  $getlist = mysql_query(SELECT id FROM yourdb,$dbconnectetc);
  $numrows = mysql_num_rows($getlist);
  echo $numrows\n;
 
  This will give you the number of records in your db.
  If you use autoincrement for the id field your will not have to
  worry about your ++.
 
  If you delete any records numrows will always be correct.
 
  =this is correct, but COUNT(*) is optimised/more efficient (RTFM:
  6.3.7  Functions for Use with GROUP BY
  Clauses)
 
  
  First off, sorry for the newbie question... :(.
 
  I want to be able to query the database and find the record with the
  highest ID value. Example... each row ideally has an incremented
  integer
  ID (1, 2, 3, 4...) but I am running into problems when I try and delete
  a row (let's say row 2). My PHP currently selects all of the rows and
  formulates the ID off of that... This I found out is bad because when I
  delete row 2 the query says there are 3 rows so my PHP will try to make
  the ID = 4. I just need the code to find the highest ID so I can ++ it.
  Sorry again for the easy question!
 
  =no need to apologise, we all have to start somewhere.
 
  =It is an FAQ. By asking it you indicate that you don't (yet)
  understand the philosophy of the AUTO_INCREMENT
  facility. It is there to provide an ID for new rows of data, not to be
  a 'count' of the rows. If you consider
  that this ID may be used as a key into this table's data from another
  table (foreign key), then you will realise
  that changing ID values to reflect intermediate deletions is less than
  logical. (RTFM: 3.5.9  Using
  AUTO_INCREMENT, although it doesn't seem to get into this point - the
  annotated comments are worth a read
  though). I've just a had a quick look to see where the manual discusses
  the 'philosophy' and have come up
  empty - perhaps someone else can steer you right, if you need more.
 
  =It is worth reading through PHP's large collection of built-in MySQL_
  functions. There are specific functions
  that will return various 'numbers of rows' to the script to suit
  various situations.



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




[PHP-DB] I cant get the logic for this...

2002-02-18 Thread Dave Carrera

Hi all,

I want to display return results from my query (which works fine)
In I tidy way on screen.

So my result returns say seven results, I have a table, and I want to
show
3 results per row of the table... I.e.:

Table
TR
TD = result1 /TD  TD result2 /TD TD = result3 /TD
/TD
/TR
TR
TD = result4 /TD  TD result5 /TD TD = result6 /TD
/TD
/TR
TR
TD = result7 /TD  TD resultempty /TD TD = resultempty /TD
/TD
/TR
/table

The last two td in row 3 are empty because result found 7 results.

This cant be fixed so echo statements wont work as the result could
Be 3 or 10 or 56 or whatever.

As Always your help and or guidance in this matter is appreciated.

Dave Carrera
Php / MySql Development
Web Design
Site Marketing
http://www.davecarrera.com
 



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




Re: [PHP-DB] Problem connecting to db on Linux

2002-02-18 Thread David Sullivan

Hey,

I didn't have to do any special configuring. All I did was setup the root 
password, login via the mysql console client and create my databases, then 
use mysql_connect() and mysql_select_db() like you said. What have you done 
other than just installing it?

--
- Dave

On February 18, 2002 04:27 am, you wrote:
 Hi all,

 I've been working with PHP/MySQL on Win NT and Win 2000 for a few weeks.
 I've now set up a Linux machine (Mandrake 8.1 on Dell laptop) and have
 moved my files across.

 I use an include file which logs on to the MySQL server and then connects
 to the database. It performs the login ok but not the select db part.

 I tried creating a db using a php script and then selecting it and got the
 same problem.

 I'm new on Linux so it might be something in the configuration which needs
 working on.

 Any suggestions?

 George in Edinburgh

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




Re: [PHP-DB] Session confusion :-(

2002-02-18 Thread Adam Royle

I presume that the session is not updating because PHP does not 
automatically overwrite session variables.

You should use something like this:

$category = $HTTP_GET_VARS[category];
session_register(category);

Session register can be called more than once, and has no effect on 
current session variables with the same name.

See if that works, and if it doesn't have a look at this...
http://www.php.net/manual/en/language.variables.predefined.php

Adam


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




[PHP-DB] R: [PHP-DB] I cant get the logic for this...

2002-02-18 Thread Riccardi Moreno


You could use this script:
?php
$columns = 3;
$count = 0;
while ($query_data = $yoursearch){
  $count++;
  if ($count  $columns)
  {
echo td$query_data[]/td;
  }
  else if ($count == $columns)
  { 
$count = 0;
echo trtd$query_data[]/td;
  }
  for ($i=$count;$i=$columns;$i++){
   echo tdnbsp;/td;
  }
  echo /tr; 
}
?
I think it works.
Bye,
Moreno

-Messaggio originale-
Da: Dave Carrera [mailto:[EMAIL PROTECTED]]
Inviato: lunedi 18 febbraio 2002 13.07
A: php List
Oggetto: [PHP-DB] I cant get the logic for this...


Hi all,

I want to display return results from my query (which works fine)
In I tidy way on screen.

So my result returns say seven results, I have a table, and I want to
show
3 results per row of the table... I.e.:

Table
TR
TD = result1 /TD  TD result2 /TD TD = result3 /TD
/TD
/TR
TR
TD = result4 /TD  TD result5 /TD TD = result6 /TD
/TD
/TR
TR
TD = result7 /TD  TD resultempty /TD TD = resultempty /TD
/TD
/TR
/table

The last two td in row 3 are empty because result found 7 results.

This cant be fixed so echo statements wont work as the result could
Be 3 or 10 or 56 or whatever.

As Always your help and or guidance in this matter is appreciated.

Dave Carrera
Php / MySql Development
Web Design
Site Marketing
http://www.davecarrera.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] Problem connecting to db on Linux

2002-02-18 Thread Greg Donald

 I've been working with PHP/MySQL on Win NT and Win 2000 for a few weeks.
 I've now set up a Linux machine (Mandrake 8.1 on Dell laptop) and have
moved
 my files across.

 I use an include file which logs on to the MySQL server and then connects
to
 the database. It performs the login ok but not the select db part.

 I tried creating a db using a php script and then selecting it and got the
 same problem.

 I'm new on Linux so it might be something in the configuration which needs
 working on.

 Any suggestions?

Well, if you had posted some code, someone might have seen the error...  :(

Anyway, here is how i do it:

if($db = mysql_pconnect($dbhost, $dbuser, $dbpasswd)){
mysql_select_db($dbname, $db);
} else {
echo mysql_error();
exit;
}


Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/



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




Re: [PHP-DB] I cant get the logic for this...

2002-02-18 Thread Greg Donald


 I want to display return results from my query (which works fine)
 In I tidy way on screen.

 So my result returns say seven results, I have a table, and I want to
 show
 3 results per row of the table... I.e.:

 Table
 TR
 TD = result1 /TD  TD result2 /TD TD = result3 /TD
 /TD
 /TR
 TR
 TD = result4 /TD  TD result5 /TD TD = result6 /TD
 /TD
 /TR
 TR
 TD = result7 /TD  TD resultempty /TD TD = resultempty /TD
 /TD
 /TR
 /table

 The last two td in row 3 are empty because result found 7 results.

 This cant be fixed so echo statements wont work as the result could
 Be 3 or 10 or 56 or whatever.

 As Always your help and or guidance in this matter is appreciated.

You need a incrementer variable so you can tell when you have 3 td cells
built, so you know when to end the current tr and start a new one.

Then, you need to test that variable again when you run out of
mysql_num_rows(), and fill the 1 or 2 needed td cells with nbsp;

Also, you might wanna look around for some table building classes if your
data is always gonna be really abstract.


Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/



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




Re: [PHP-DB] Problem connecting to db on Linux

2002-02-18 Thread George Pitcher

Greg, et al,

This is the contents of the include file:

?php

$link = mysql_connect ('localhost', 'root', '*') or die (Could not
select db);

mysql_select_db ('Heronsql') or die (Could not connect);

?

I have also tried it with the following:

?php

$link = mysql_connect ('localhost', 'root', '*');

echo mysql_errno().: .mysql_error().BR;

mysql_select_db ('Heronsql');

echo mysql_errno().: .mysql_error().BR;

?

Te results for this were:
0:0
0:0

I have reinstalled my Mandrake (MySQL/PHP4.0.6/Apache) and I am about to
retest so I'll report back soon.

George
- Original Message -
From: Greg Donald [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, February 18, 2002 2:08 PM
Subject: Re: [PHP-DB] Problem connecting to db on Linux


  I've been working with PHP/MySQL on Win NT and Win 2000 for a few weeks.
  I've now set up a Linux machine (Mandrake 8.1 on Dell laptop) and have
 moved
  my files across.
 
  I use an include file which logs on to the MySQL server and then
connects
 to
  the database. It performs the login ok but not the select db part.
 
  I tried creating a db using a php script and then selecting it and got
the
  same problem.
 
  I'm new on Linux so it might be something in the configuration which
needs
  working on.
 
  Any suggestions?

 Well, if you had posted some code, someone might have seen the error...
:(

 Anyway, here is how i do it:

 if($db = mysql_pconnect($dbhost, $dbuser, $dbpasswd)){
 mysql_select_db($dbname, $db);
 } else {
 echo mysql_error();
 exit;
 }

 
 Greg Donald - http://destiney.com/
 http://phprated.com/ | http://phplinks.org/ | http://phptopsites.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] I cant get the logic for this...

2002-02-18 Thread Cami

Hi Dave,
I wrote the following script which does exaclty that.

Cami

?
mysql_connect ($hname, $usrname, $password) OR DIE (unable to connect);

$selectstmnt = your sql statement;

$result = mysql_db_query ($dbname, $selectstmnt);
$numrows = mysql_num_rows($result);
 $i=3;
echo table cellpadding=0 border=0 callspacing=0;

if ($result) {
while ($list = mysql_fetch_array ($result))
 {

if($i==3)   { $i=0;
echo tr; }

echo td width=\126\ height=\23\ valign=\middle\
align=\center\.$list[yourvariablename]./td;


 $i++;
if($i==3)   {
echo /tr; }
  } // end while fetch_array
if ($numrows%3==2){echo tdnbsp;/td/tr;}
if ($numrows%3==1){echo tdnbsp;/tdtdnbsp;/td/tr;}

   } //end if numrows0
echo /table;
?

-Original Message-
From: Greg Donald [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 18, 2002 2:14 PM
To: Dave Carrera; php List
Subject: Re: [PHP-DB] I cant get the logic for this...



 I want to display return results from my query (which works fine)
 In I tidy way on screen.

 So my result returns say seven results, I have a table, and I want to
 show
 3 results per row of the table... I.e.:

 Table
 TR
 TD = result1 /TD  TD result2 /TD TD = result3 /TD
 /TD
 /TR
 TR
 TD = result4 /TD  TD result5 /TD TD = result6 /TD
 /TD
 /TR
 TR
 TD = result7 /TD  TD resultempty /TD TD = resultempty /TD
 /TD
 /TR
 /table

 The last two td in row 3 are empty because result found 7 results.

 This cant be fixed so echo statements wont work as the result could
 Be 3 or 10 or 56 or whatever.

 As Always your help and or guidance in this matter is appreciated.

You need a incrementer variable so you can tell when you have 3 td cells
built, so you know when to end the current tr and start a new one.

Then, you need to test that variable again when you run out of
mysql_num_rows(), and fill the 1 or 2 needed td cells with nbsp;

Also, you might wanna look around for some table building classes if your
data is always gonna be really abstract.


Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.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-DB] R: [PHP-DB] Problem connecting to db on Linux

2002-02-18 Thread Michele Azzolari

Hi to all
I'm a new one
To connect to mysql server I use

?php
$dbhost = localhost;
$dbuname = dbuser;
$dbpass = dbpassw;
$dbname = dbname;
$conn = mysql_connect($dbhost, $dbuname, $dbpass)
or die(Errore!);
$my_db = mysql_select_db($dbname)
or die(Errore!);
?

Miki


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




RE: [PHP-DB] Problem connecting to db on Linux

2002-02-18 Thread Rick Emery

Have you spelled the name of the database correctly, including case
sensitivity?

What error message are you getting to indicate failure?

-Original Message-
From: George Pitcher [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 18, 2002 8:21 AM
To: Greg Donald; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Problem connecting to db on Linux


Greg, et al,

This is the contents of the include file:

?php

$link = mysql_connect ('localhost', 'root', '*') or die (Could not
select db);

mysql_select_db ('Heronsql') or die (Could not connect);

?

I have also tried it with the following:

?php

$link = mysql_connect ('localhost', 'root', '*');

echo mysql_errno().: .mysql_error().BR;

mysql_select_db ('Heronsql');

echo mysql_errno().: .mysql_error().BR;

?

Te results for this were:
0:0
0:0

I have reinstalled my Mandrake (MySQL/PHP4.0.6/Apache) and I am about to
retest so I'll report back soon.

George
- Original Message -
From: Greg Donald [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, February 18, 2002 2:08 PM
Subject: Re: [PHP-DB] Problem connecting to db on Linux


  I've been working with PHP/MySQL on Win NT and Win 2000 for a few weeks.
  I've now set up a Linux machine (Mandrake 8.1 on Dell laptop) and have
 moved
  my files across.
 
  I use an include file which logs on to the MySQL server and then
connects
 to
  the database. It performs the login ok but not the select db part.
 
  I tried creating a db using a php script and then selecting it and got
the
  same problem.
 
  I'm new on Linux so it might be something in the configuration which
needs
  working on.
 
  Any suggestions?

 Well, if you had posted some code, someone might have seen the error...
:(

 Anyway, here is how i do it:

 if($db = mysql_pconnect($dbhost, $dbuser, $dbpasswd)){
 mysql_select_db($dbname, $db);
 } else {
 echo mysql_error();
 exit;
 }

 
 Greg Donald - http://destiney.com/
 http://phprated.com/ | http://phplinks.org/ | http://phptopsites.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] Problem connecting to db on Linux

2002-02-18 Thread George Pitcher

Rick,

I snipped the code from my windoze system. I did have to change the case of
the dbname to reflect the Linux version (all lc).

The error message I got (not displayed on screen but visible on 'view
source') was 'Could not connect' which, to me means that it got past the
login to server and stalled on the select db part?

George
- Original Message -
From: Rick Emery [EMAIL PROTECTED]
To: 'George Pitcher' [EMAIL PROTECTED]; Greg Donald
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, February 18, 2002 2:31 PM
Subject: RE: [PHP-DB] Problem connecting to db on Linux


 Have you spelled the name of the database correctly, including case
 sensitivity?

 What error message are you getting to indicate failure?

 -Original Message-
 From: George Pitcher [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 18, 2002 8:21 AM
 To: Greg Donald; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Problem connecting to db on Linux


 Greg, et al,

 This is the contents of the include file:

 ?php

 $link = mysql_connect ('localhost', 'root', '*') or die (Could not
 select db);

 mysql_select_db ('Heronsql') or die (Could not connect);

 ?

 I have also tried it with the following:

 ?php

 $link = mysql_connect ('localhost', 'root', '*');

 echo mysql_errno().: .mysql_error().BR;

 mysql_select_db ('Heronsql');

 echo mysql_errno().: .mysql_error().BR;

 ?

 Te results for this were:
 0:0
 0:0

 I have reinstalled my Mandrake (MySQL/PHP4.0.6/Apache) and I am about to
 retest so I'll report back soon.

 George
 - Original Message -
 From: Greg Donald [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, February 18, 2002 2:08 PM
 Subject: Re: [PHP-DB] Problem connecting to db on Linux


   I've been working with PHP/MySQL on Win NT and Win 2000 for a few
weeks.
   I've now set up a Linux machine (Mandrake 8.1 on Dell laptop) and have
  moved
   my files across.
  
   I use an include file which logs on to the MySQL server and then
 connects
  to
   the database. It performs the login ok but not the select db part.
  
   I tried creating a db using a php script and then selecting it and got
 the
   same problem.
  
   I'm new on Linux so it might be something in the configuration which
 needs
   working on.
  
   Any suggestions?
 
  Well, if you had posted some code, someone might have seen the error...
 :(
 
  Anyway, here is how i do it:
 
  if($db = mysql_pconnect($dbhost, $dbuser, $dbpasswd)){
  mysql_select_db($dbname, $db);
  } else {
  echo mysql_error();
  exit;
  }
 
  
  Greg Donald - http://destiney.com/
  http://phprated.com/ | http://phplinks.org/ | http://phptopsites.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


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




[PHP-DB] RE: I cant get the logic for this...

2002-02-18 Thread Dave Carrera

Firstly thanks to everyone who have supplied various way to implement
the issue I was having.

Unfortunately I cant seem to get any one of them to function correctly

I have included my code to see if someone can help adjusting it.

I think I am going wrong in where I am putting the count var.

You may notice I am using the var $v1list. this is so I can display the
output in suitable place on screen.

The code I have included makes my 7 selected items go straight across
the page(obviously) hence the need to
Block it of with some kind of count function.

Thank you for any help or advice

Dave C
CODE HERE--
if(ISSET($category)){

 $viewsql = select * from $tbn2 where catid = \$category\ ;
 $viewres = @mysql_query($viewsql, $con) or die (Cant get details.
Please report this to the website administrator);
 $num_rows = mysql_num_rows($viewres);
 while( $v1rows = mysql_fetch_array($viewres) ){ 
 $name2 = $v1rows[name];
 $id2 = $v1rows[catid];
 $simg = $v1rows[smallimg];
 $v1list .=td$name2/bra href
=\./viewdetails.php?pcategory=$id2pname=$name2\img src=$simg
border=0/a/td;

}
}

Dave Carrera
Php / MySql Development
Web Design
Site Marketing
http://www.davecarrera.com
 



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




RE: [PHP-DB] Problem connecting to db on Linux

2002-02-18 Thread Rick Emery

Do you have your error messages crossed?  I ask, because I would think your
cannot select message would go with your mysql_select_db() and your
cannot connect would go with your mysql_connect()

-Original Message-
From: George Pitcher [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 18, 2002 8:48 AM
To: Rick Emery; Greg Donald; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Problem connecting to db on Linux


Rick,

I snipped the code from my windoze system. I did have to change the case of
the dbname to reflect the Linux version (all lc).

The error message I got (not displayed on screen but visible on 'view
source') was 'Could not connect' which, to me means that it got past the
login to server and stalled on the select db part?

George
- Original Message -
From: Rick Emery [EMAIL PROTECTED]
To: 'George Pitcher' [EMAIL PROTECTED]; Greg Donald
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, February 18, 2002 2:31 PM
Subject: RE: [PHP-DB] Problem connecting to db on Linux


 Have you spelled the name of the database correctly, including case
 sensitivity?

 What error message are you getting to indicate failure?

 -Original Message-
 From: George Pitcher [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 18, 2002 8:21 AM
 To: Greg Donald; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Problem connecting to db on Linux


 Greg, et al,

 This is the contents of the include file:

 ?php

 $link = mysql_connect ('localhost', 'root', '*') or die (Could not
 select db);

 mysql_select_db ('Heronsql') or die (Could not connect);

 ?

 I have also tried it with the following:

 ?php

 $link = mysql_connect ('localhost', 'root', '*');

 echo mysql_errno().: .mysql_error().BR;

 mysql_select_db ('Heronsql');

 echo mysql_errno().: .mysql_error().BR;

 ?

 Te results for this were:
 0:0
 0:0

 I have reinstalled my Mandrake (MySQL/PHP4.0.6/Apache) and I am about to
 retest so I'll report back soon.

 George
 - Original Message -
 From: Greg Donald [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, February 18, 2002 2:08 PM
 Subject: Re: [PHP-DB] Problem connecting to db on Linux


   I've been working with PHP/MySQL on Win NT and Win 2000 for a few
weeks.
   I've now set up a Linux machine (Mandrake 8.1 on Dell laptop) and have
  moved
   my files across.
  
   I use an include file which logs on to the MySQL server and then
 connects
  to
   the database. It performs the login ok but not the select db part.
  
   I tried creating a db using a php script and then selecting it and got
 the
   same problem.
  
   I'm new on Linux so it might be something in the configuration which
 needs
   working on.
  
   Any suggestions?
 
  Well, if you had posted some code, someone might have seen the error...
 :(
 
  Anyway, here is how i do it:
 
  if($db = mysql_pconnect($dbhost, $dbuser, $dbpasswd)){
  mysql_select_db($dbname, $db);
  } else {
  echo mysql_error();
  exit;
  }
 
  
  Greg Donald - http://destiney.com/
  http://phprated.com/ | http://phplinks.org/ | http://phptopsites.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

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




Re: [PHP-DB] Session confusion :-(

2002-02-18 Thread Yasuo Ohgaki

Read current manual page.
If you still have problem, let me know what's the problem.

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

-- 
Yasuo Ohgaki


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




Re: [PHP-DB] Problem connecting to db on Linux

2002-02-18 Thread George Pitcher

Greg, et al,

Now the re-installation is complete, I am getting past the original error --
only to hit another.

My query is as follows (echoed to web page):

SELECT DISTINCT Nickname, HEI_ID FROM customers WHERE Nickname  '' ORDER
BY Nickname

I have checked case against db an it is correct. Am I missing something else
which is obvious?

George

- Original Message -
From: Rick Emery [EMAIL PROTECTED]
To: 'George Pitcher' [EMAIL PROTECTED]; Rick Emery [EMAIL PROTECTED];
Greg Donald [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, February 18, 2002 3:19 PM
Subject: RE: [PHP-DB] Problem connecting to db on Linux


 Do you have your error messages crossed?  I ask, because I would think
your
 cannot select message would go with your mysql_select_db() and your
 cannot connect would go with your mysql_connect()

 -Original Message-
 From: George Pitcher [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 18, 2002 8:48 AM
 To: Rick Emery; Greg Donald; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Problem connecting to db on Linux


 Rick,

 I snipped the code from my windoze system. I did have to change the case
of
 the dbname to reflect the Linux version (all lc).

 The error message I got (not displayed on screen but visible on 'view
 source') was 'Could not connect' which, to me means that it got past the
 login to server and stalled on the select db part?

 George
 - Original Message -
 From: Rick Emery [EMAIL PROTECTED]
 To: 'George Pitcher' [EMAIL PROTECTED]; Greg Donald
 [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Monday, February 18, 2002 2:31 PM
 Subject: RE: [PHP-DB] Problem connecting to db on Linux


  Have you spelled the name of the database correctly, including case
  sensitivity?
 
  What error message are you getting to indicate failure?
 
  -Original Message-
  From: George Pitcher [mailto:[EMAIL PROTECTED]]
  Sent: Monday, February 18, 2002 8:21 AM
  To: Greg Donald; [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] Problem connecting to db on Linux
 
 
  Greg, et al,
 
  This is the contents of the include file:
 
  ?php
 
  $link = mysql_connect ('localhost', 'root', '*') or die (Could not
  select db);
 
  mysql_select_db ('Heronsql') or die (Could not connect);
 
  ?
 
  I have also tried it with the following:
 
  ?php
 
  $link = mysql_connect ('localhost', 'root', '*');
 
  echo mysql_errno().: .mysql_error().BR;
 
  mysql_select_db ('Heronsql');
 
  echo mysql_errno().: .mysql_error().BR;
 
  ?
 
  Te results for this were:
  0:0
  0:0
 
  I have reinstalled my Mandrake (MySQL/PHP4.0.6/Apache) and I am about to
  retest so I'll report back soon.
 
  George
  - Original Message -
  From: Greg Donald [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Monday, February 18, 2002 2:08 PM
  Subject: Re: [PHP-DB] Problem connecting to db on Linux
 
 
I've been working with PHP/MySQL on Win NT and Win 2000 for a few
 weeks.
I've now set up a Linux machine (Mandrake 8.1 on Dell laptop) and
have
   moved
my files across.
   
I use an include file which logs on to the MySQL server and then
  connects
   to
the database. It performs the login ok but not the select db part.
   
I tried creating a db using a php script and then selecting it and
got
  the
same problem.
   
I'm new on Linux so it might be something in the configuration which
  needs
working on.
   
Any suggestions?
  
   Well, if you had posted some code, someone might have seen the
error...
  :(
  
   Anyway, here is how i do it:
  
   if($db = mysql_pconnect($dbhost, $dbuser, $dbpasswd)){
   mysql_select_db($dbname, $db);
   } else {
   echo mysql_error();
   exit;
   }
  
 
 
   Greg Donald - http://destiney.com/
   http://phprated.com/ | http://phplinks.org/ | http://phptopsites.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

 --
 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] Problem connecting to db on Linux

2002-02-18 Thread Rick Emery

what is the error message you get?
do you print otu mysql_error() ?

-Original Message-
From: George Pitcher [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 18, 2002 9:42 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Problem connecting to db on Linux


Greg, et al,

Now the re-installation is complete, I am getting past the original error --
only to hit another.

My query is as follows (echoed to web page):

SELECT DISTINCT Nickname, HEI_ID FROM customers WHERE Nickname  '' ORDER
BY Nickname

I have checked case against db an it is correct. Am I missing something else
which is obvious?

George

- Original Message -
From: Rick Emery [EMAIL PROTECTED]
To: 'George Pitcher' [EMAIL PROTECTED]; Rick Emery [EMAIL PROTECTED];
Greg Donald [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, February 18, 2002 3:19 PM
Subject: RE: [PHP-DB] Problem connecting to db on Linux


 Do you have your error messages crossed?  I ask, because I would think
your
 cannot select message would go with your mysql_select_db() and your
 cannot connect would go with your mysql_connect()

 -Original Message-
 From: George Pitcher [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 18, 2002 8:48 AM
 To: Rick Emery; Greg Donald; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Problem connecting to db on Linux


 Rick,

 I snipped the code from my windoze system. I did have to change the case
of
 the dbname to reflect the Linux version (all lc).

 The error message I got (not displayed on screen but visible on 'view
 source') was 'Could not connect' which, to me means that it got past the
 login to server and stalled on the select db part?

 George
 - Original Message -
 From: Rick Emery [EMAIL PROTECTED]
 To: 'George Pitcher' [EMAIL PROTECTED]; Greg Donald
 [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Monday, February 18, 2002 2:31 PM
 Subject: RE: [PHP-DB] Problem connecting to db on Linux


  Have you spelled the name of the database correctly, including case
  sensitivity?
 
  What error message are you getting to indicate failure?
 
  -Original Message-
  From: George Pitcher [mailto:[EMAIL PROTECTED]]
  Sent: Monday, February 18, 2002 8:21 AM
  To: Greg Donald; [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] Problem connecting to db on Linux
 
 
  Greg, et al,
 
  This is the contents of the include file:
 
  ?php
 
  $link = mysql_connect ('localhost', 'root', '*') or die (Could not
  select db);
 
  mysql_select_db ('Heronsql') or die (Could not connect);
 
  ?
 
  I have also tried it with the following:
 
  ?php
 
  $link = mysql_connect ('localhost', 'root', '*');
 
  echo mysql_errno().: .mysql_error().BR;
 
  mysql_select_db ('Heronsql');
 
  echo mysql_errno().: .mysql_error().BR;
 
  ?
 
  Te results for this were:
  0:0
  0:0
 
  I have reinstalled my Mandrake (MySQL/PHP4.0.6/Apache) and I am about to
  retest so I'll report back soon.
 
  George
  - Original Message -
  From: Greg Donald [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Monday, February 18, 2002 2:08 PM
  Subject: Re: [PHP-DB] Problem connecting to db on Linux
 
 
I've been working with PHP/MySQL on Win NT and Win 2000 for a few
 weeks.
I've now set up a Linux machine (Mandrake 8.1 on Dell laptop) and
have
   moved
my files across.
   
I use an include file which logs on to the MySQL server and then
  connects
   to
the database. It performs the login ok but not the select db part.
   
I tried creating a db using a php script and then selecting it and
got
  the
same problem.
   
I'm new on Linux so it might be something in the configuration which
  needs
working on.
   
Any suggestions?
  
   Well, if you had posted some code, someone might have seen the
error...
  :(
  
   Anyway, here is how i do it:
  
   if($db = mysql_pconnect($dbhost, $dbuser, $dbpasswd)){
   mysql_select_db($dbname, $db);
   } else {
   echo mysql_error();
   exit;
   }
  
 
 
   Greg Donald - http://destiney.com/
   http://phprated.com/ | http://phplinks.org/ | http://phptopsites.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

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


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

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




[PHP-DB] R: [PHP-DB] RE: I cant get the logic for this...

2002-02-18 Thread Riccardi Moreno

try to change with this:
if(ISSET($category)){
 $columns = 3;
 $count = 0;
 $viewsql = select * from $tbn2 where catid = \$category\ ;
 $viewres = @mysql_query($viewsql, $con) or die (Cant get details.
Please report this to the website administrator);
 $num_rows = mysql_num_rows($viewres);
 while( $v1rows = mysql_fetch_array($viewres) ){ 
 $name2 = $v1rows[name];
 $id2 = $v1rows[catid];
 $simg = $v1rows[smallimg];
 if ($count == $columns)
 {
  $count = 0;
  $v1list .=trtd$name2/bra href
  =\./viewdetails.php?pcategory=$id2pname=$name2\img src=$simg
  border=0/a/td;
 }
 else if ($count  $columns)
 {
  $count++;
  $v1list .=td$name2/bra href
  =\./viewdetails.php?pcategory=$id2pname=$name2\img src=$simg
  border=0/a/td;
 }
}
 //close row
 for ($i=$count;$i=$columns;$i++)
 {
  $v1list .=tdnbsp/td;
 }
 $v1list .= /tr;
}
Bye Moreno
-Messaggio originale-
Da: Dave Carrera [mailto:[EMAIL PROTECTED]]
Inviato: lunedi 18 febbraio 2002 15.51
A: php List
Oggetto: [PHP-DB] RE: I cant get the logic for this...


Firstly thanks to everyone who have supplied various way to implement
the issue I was having.

Unfortunately I cant seem to get any one of them to function correctly

I have included my code to see if someone can help adjusting it.

I think I am going wrong in where I am putting the count var.

You may notice I am using the var $v1list. this is so I can display the
output in suitable place on screen.

The code I have included makes my 7 selected items go straight across
the page(obviously) hence the need to
Block it of with some kind of count function.

Thank you for any help or advice

Dave C
CODE HERE--
if(ISSET($category)){

 $viewsql = select * from $tbn2 where catid = \$category\ ;
 $viewres = @mysql_query($viewsql, $con) or die (Cant get details.
Please report this to the website administrator);
 $num_rows = mysql_num_rows($viewres);
 while( $v1rows = mysql_fetch_array($viewres) ){ 
 $name2 = $v1rows[name];
 $id2 = $v1rows[catid];
 $simg = $v1rows[smallimg];
 $v1list .=td$name2/bra href
=\./viewdetails.php?pcategory=$id2pname=$name2\img src=$simg
border=0/a/td;

}
}

Dave Carrera
Php / MySql Development
Web Design
Site Marketing
http://www.davecarrera.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] Problem connecting to db on Linux

2002-02-18 Thread George Pitcher

Rick,

Sorry, here it is:
Warning: Supplied argument is not a valid MySQL result resource in
/var/www/html/HERONweb/home.php on line 32

I have 'echo mysql_errno();' just after the query is called but no number is
being displayed.

George
- Original Message -
From: Rick Emery [EMAIL PROTECTED]
To: 'George Pitcher' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, February 18, 2002 3:46 PM
Subject: RE: [PHP-DB] Problem connecting to db on Linux


 what is the error message you get?
 do you print otu mysql_error() ?

 -Original Message-
 From: George Pitcher [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 18, 2002 9:42 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Problem connecting to db on Linux


 Greg, et al,

 Now the re-installation is complete, I am getting past the original
error --
 only to hit another.

 My query is as follows (echoed to web page):

 SELECT DISTINCT Nickname, HEI_ID FROM customers WHERE Nickname  '' ORDER
 BY Nickname

 I have checked case against db an it is correct. Am I missing something
else
 which is obvious?

 George

 - Original Message -
 From: Rick Emery [EMAIL PROTECTED]
 To: 'George Pitcher' [EMAIL PROTECTED]; Rick Emery
[EMAIL PROTECTED];
 Greg Donald [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Monday, February 18, 2002 3:19 PM
 Subject: RE: [PHP-DB] Problem connecting to db on Linux


  Do you have your error messages crossed?  I ask, because I would think
 your
  cannot select message would go with your mysql_select_db() and your
  cannot connect would go with your mysql_connect()
 
  -Original Message-
  From: George Pitcher [mailto:[EMAIL PROTECTED]]
  Sent: Monday, February 18, 2002 8:48 AM
  To: Rick Emery; Greg Donald; [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] Problem connecting to db on Linux
 
 
  Rick,
 
  I snipped the code from my windoze system. I did have to change the case
 of
  the dbname to reflect the Linux version (all lc).
 
  The error message I got (not displayed on screen but visible on 'view
  source') was 'Could not connect' which, to me means that it got past the
  login to server and stalled on the select db part?
 
  George
  - Original Message -
  From: Rick Emery [EMAIL PROTECTED]
  To: 'George Pitcher' [EMAIL PROTECTED]; Greg Donald
  [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Sent: Monday, February 18, 2002 2:31 PM
  Subject: RE: [PHP-DB] Problem connecting to db on Linux
 
 
   Have you spelled the name of the database correctly, including case
   sensitivity?
  
   What error message are you getting to indicate failure?
  
   -Original Message-
   From: George Pitcher [mailto:[EMAIL PROTECTED]]
   Sent: Monday, February 18, 2002 8:21 AM
   To: Greg Donald; [EMAIL PROTECTED]
   Subject: Re: [PHP-DB] Problem connecting to db on Linux
  
  
   Greg, et al,
  
   This is the contents of the include file:
  
   ?php
  
   $link = mysql_connect ('localhost', 'root', '*') or die (Could
not
   select db);
  
   mysql_select_db ('Heronsql') or die (Could not connect);
  
   ?
  
   I have also tried it with the following:
  
   ?php
  
   $link = mysql_connect ('localhost', 'root', '*');
  
   echo mysql_errno().: .mysql_error().BR;
  
   mysql_select_db ('Heronsql');
  
   echo mysql_errno().: .mysql_error().BR;
  
   ?
  
   Te results for this were:
   0:0
   0:0
  
   I have reinstalled my Mandrake (MySQL/PHP4.0.6/Apache) and I am about
to
   retest so I'll report back soon.
  
   George
   - Original Message -
   From: Greg Donald [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Monday, February 18, 2002 2:08 PM
   Subject: Re: [PHP-DB] Problem connecting to db on Linux
  
  
 I've been working with PHP/MySQL on Win NT and Win 2000 for a few
  weeks.
 I've now set up a Linux machine (Mandrake 8.1 on Dell laptop) and
 have
moved
 my files across.

 I use an include file which logs on to the MySQL server and then
   connects
to
 the database. It performs the login ok but not the select db part.

 I tried creating a db using a php script and then selecting it and
 got
   the
 same problem.

 I'm new on Linux so it might be something in the configuration
which
   needs
 working on.

 Any suggestions?
   
Well, if you had posted some code, someone might have seen the
 error...
   :(
   
Anyway, here is how i do it:
   
if($db = mysql_pconnect($dbhost, $dbuser, $dbpasswd)){
mysql_select_db($dbname, $db);
} else {
echo mysql_error();
exit;
}
   
  
  
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ |
http://phptopsites.com/
  
  
   
   
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
  
  
   --
   PHP Database Mailing List 

RE: [PHP-DB] Problem connecting to db on Linux

2002-02-18 Thread Rick Emery

so, you probably have something like, right?  If not, change your code to:

$query = SELECT DISTINCT Nickname, HEI_ID FROM customers WHERE Nickname 
ORDER BY Nickname;
$result = mysql_query($query) or die(error: .mysql_error());

show us your code.

I ask, because you appear to have an extra  in fron of ORDER BY

-Original Message-
From: George Pitcher [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 18, 2002 9:53 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Problem connecting to db on Linux


Rick,

Sorry, here it is:
Warning: Supplied argument is not a valid MySQL result resource in
/var/www/html/HERONweb/home.php on line 32

I have 'echo mysql_errno();' just after the query is called but no number is
being displayed.

George
- Original Message -
From: Rick Emery [EMAIL PROTECTED]
To: 'George Pitcher' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, February 18, 2002 3:46 PM
Subject: RE: [PHP-DB] Problem connecting to db on Linux


 what is the error message you get?
 do you print otu mysql_error() ?

 -Original Message-
 From: George Pitcher [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 18, 2002 9:42 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Problem connecting to db on Linux


 Greg, et al,

 Now the re-installation is complete, I am getting past the original
error --
 only to hit another.

 My query is as follows (echoed to web page):

 SELECT DISTINCT Nickname, HEI_ID FROM customers WHERE Nickname  '' ORDER
 BY Nickname

 I have checked case against db an it is correct. Am I missing something
else
 which is obvious?

 George

 - Original Message -
 From: Rick Emery [EMAIL PROTECTED]
 To: 'George Pitcher' [EMAIL PROTECTED]; Rick Emery
[EMAIL PROTECTED];
 Greg Donald [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Monday, February 18, 2002 3:19 PM
 Subject: RE: [PHP-DB] Problem connecting to db on Linux


  Do you have your error messages crossed?  I ask, because I would think
 your
  cannot select message would go with your mysql_select_db() and your
  cannot connect would go with your mysql_connect()
 
  -Original Message-
  From: George Pitcher [mailto:[EMAIL PROTECTED]]
  Sent: Monday, February 18, 2002 8:48 AM
  To: Rick Emery; Greg Donald; [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] Problem connecting to db on Linux
 
 
  Rick,
 
  I snipped the code from my windoze system. I did have to change the case
 of
  the dbname to reflect the Linux version (all lc).
 
  The error message I got (not displayed on screen but visible on 'view
  source') was 'Could not connect' which, to me means that it got past the
  login to server and stalled on the select db part?
 
  George
  - Original Message -
  From: Rick Emery [EMAIL PROTECTED]
  To: 'George Pitcher' [EMAIL PROTECTED]; Greg Donald
  [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Sent: Monday, February 18, 2002 2:31 PM
  Subject: RE: [PHP-DB] Problem connecting to db on Linux
 
 
   Have you spelled the name of the database correctly, including case
   sensitivity?
  
   What error message are you getting to indicate failure?
  
   -Original Message-
   From: George Pitcher [mailto:[EMAIL PROTECTED]]
   Sent: Monday, February 18, 2002 8:21 AM
   To: Greg Donald; [EMAIL PROTECTED]
   Subject: Re: [PHP-DB] Problem connecting to db on Linux
  
  
   Greg, et al,
  
   This is the contents of the include file:
  
   ?php
  
   $link = mysql_connect ('localhost', 'root', '*') or die (Could
not
   select db);
  
   mysql_select_db ('Heronsql') or die (Could not connect);
  
   ?
  
   I have also tried it with the following:
  
   ?php
  
   $link = mysql_connect ('localhost', 'root', '*');
  
   echo mysql_errno().: .mysql_error().BR;
  
   mysql_select_db ('Heronsql');
  
   echo mysql_errno().: .mysql_error().BR;
  
   ?
  
   Te results for this were:
   0:0
   0:0
  
   I have reinstalled my Mandrake (MySQL/PHP4.0.6/Apache) and I am about
to
   retest so I'll report back soon.
  
   George
   - Original Message -
   From: Greg Donald [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Monday, February 18, 2002 2:08 PM
   Subject: Re: [PHP-DB] Problem connecting to db on Linux
  
  
 I've been working with PHP/MySQL on Win NT and Win 2000 for a few
  weeks.
 I've now set up a Linux machine (Mandrake 8.1 on Dell laptop) and
 have
moved
 my files across.

 I use an include file which logs on to the MySQL server and then
   connects
to
 the database. It performs the login ok but not the select db part.

 I tried creating a db using a php script and then selecting it and
 got
   the
 same problem.

 I'm new on Linux so it might be something in the configuration
which
   needs
 working on.

 Any suggestions?
   
Well, if you had posted some code, someone might have seen the
 error...
   :(
   
Anyway, here is how i do it:
   
if($db = mysql_pconnect($dbhost, $dbuser, $dbpasswd)){

[PHP-DB] cron job

2002-02-18 Thread Jennifer Downey

Ok I have the cron job figured out. The only thing I would like help with is
how to update all users in a table.

This just updates a spacific user:
$db[points]=(UPDATE wt_users set points = points + 1000 WHERE
uid={$session[uid]});
$result=mysql_query($db[points]);

How would I use this to update all users.

Any help would be appreciated.

Thanks
Jen



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




Re: [PHP-DB] cron job

2002-02-18 Thread Joshua Hoover

Hi Jen,

Remove the WHERE clause (in your code: WHERE uid={$session[uid]}) in
your query and that will update all rows in the table.

Hope that helps,

Joshua Hoover

 Ok I have the cron job figured out. The only thing I would like help with is
 how to update all users in a table.
 
 This just updates a spacific user:
 $db[points]=(UPDATE wt_users set points = points + 1000 WHERE
 uid={$session[uid]});
 $result=mysql_query($db[points]);
 
 How would I use this to update all users.
 
 Any help would be appreciated.
 
 Thanks
 Jen
 
 


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




[PHP-DB] Dynamic Table Columns

2002-02-18 Thread Rankin, Randy

I have a form (criteria.php) that includes two drop down lists from which a
user can select a start period and an end period from a MySQL table. This
form posts to a form called order_summary.php on which I am using the
$start_period and $end_period variables from the criteria.php form to pull
data from another MySQL table which will produce a summary of sales for
those periods as illustrated by the following example: 

 $start_period $end_period$total
- 
 Order Type | APR-00| MAY-00| Total |
- 
 Widget 1   | $100  | $200  | $300  | 
 Widget 2   | $300  | $200  | $500  | 
. 
. 
. 

OK. Fine and good. I have this working. My problem is this: 

How can I create a table which will dynamically adjust the number of columns
based on the users request. That is, if the user requests APR-00 through
MAY-00, the table will be built as illustrated above.  If the user requests
JAN-01 through JUN-00, the table will be built as illustrated below: 

 $start_period  through
$end_period

-- 
 Order Type | JAN-01| FEB-01| MAR-01| APR-01|
MAY-01  | JUN-01|Total  |

-- 
 Widget 1   | $100  | $200  | $300  | $300  | $300  | $300  | $300  |
 Widget 2   | $300  | $200  | $500  | $300  | $300  | $300  | $300  |
. 
. 
. 

I have posted order_summary.php below. 

Any thoughts? 

Thanks, 

Randy Rankin

  order_summary.php
**

?
session_register($dbname);
?

?
require(./includes/salesdb.inc);

$query_first_last_period = select period_id, period_name
from periods
where period_id between $start_period_id and $end_period_id
GROUP BY period_id
HAVING period_id = $start_period_id OR period_id = $end_period_id
ORDER BY period_id;

$result_first_last_period = mysql_query($query_first_last_period);

$row = mysql_fetch_row($result_first_last_period);

for( $i= 0; $icount($row);$i++ )
{
if( $i == 0 )
$start_period_name = $row[$i];
elseif( $i == (count($row)-1) )
$end_period_name = $row[$i];
}

echo font face=Tahoma size=2 color=#333999;
echo Salesperson: b$dbname/bbr;
echo Report Period: b$start_period_name through $end_period_name/b;
echo /fontP;

echo table border=0 cellpadding=2 cellspacing=2;
echo tr bgcolor=#99font face=Tahoma size=2 color=#ff;
echo th align=left bordercolor=#808080font color=#FF face=Tahoma
size=2bCategory/b/font/th;

//   Start Get the Order Summary Data ***

$sql_order_summary = SELECT order_type, SUM(extended_dollars)
from salesdata
where salesperson = '$dbname'
and period_id between '$start_period_id' and '$end_period_id' 
group by order_type;
$result_order_summary = mysql_query($sql_order_summary) or die (I can't get
the sales data!);

//   Stop Get the Order Summary Data ***

//   Start Get the Period Names for the Table Header
***

$sql_period_name = Select period_name
from periods
where period_id between '$start_period_id' and '$end_period_id'
order by period_id;
$result_period_name = mysql_query($sql_period_name) or die (I can't get the
period name!);

//   End Get the Period Names for the Table Header
***

//   Build and Print the Table Headers ***

$num_periods = mysql_numrows($result_period_name);

if ($num_periods == 0) 

{
echo font color=#ffbThere were no records found for
the periods selected./b/font;
}

else 
while ($row = mysql_fetch_array($result_period_name))
{

$period_name = $row[period_name];

echo th align=left bordercolor=#808080font
color=#FF face=Tahoma size=2
b$period_name/b/th
/font;
}

echo th align=left bordercolor=#808080font
color=#FF face=Tahoma size=2bTotal Sales/b/font/th;
echo /tr;



//   End Build and Print the Table Headers
***

//   Start Calculate and Format Total Sales
***

$get_itemtot = SELECT SUM(extended_dollars) 
FROM salesdata 
WHERE salesperson = '$dbname'
and period_id between '$start_period_id' and '$end_period_id' ;
$itemtot_result 

Re: [PHP-DB] Semi-newbie - postgres polygon/points and PHP?

2002-02-18 Thread Andrés Felipe Hernández

sorry the late reply,

could you consider having each set of coordinates in 2 different fields?

select r.x, r.y from room r

andrés

- Original Message -
From: Roger Southwick [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, February 16, 2002 12:18 AM
Subject: [PHP-DB] Semi-newbie - postgres polygon/points and PHP?


 Ok, a kinda newbie question.  I set up a Postgres DB with a table that had
a
 Point and a Polygon in it (to hold XY and shape settings for munging a
jpeg
 image in php).

 I could not easily figure out how to extract the data into a reasonably
easy
 to use format in PHP.  The best I could do  seemed like it was extracted
 into a string, and then I had to parse that.
 While this works, it seems like a BIG hack to me, and the docs have been
 less then forthcoming.
 I've also tried the usual google search of php postgres polygon to see
if
 I could get an idea.

 For example, I stored the Point as:(432, 120)
 And I got (432, 120) as a string, and had to parse it:

 ...
   $Q = SELECT * FROM room WHERE id=$id;

   if(!($Result = pg_exec($Connection, $Q)))
   {
 print(Query failed $Q);
 print(pg_errormessage($Connection));
 print(BR\n);
 exit;
   }

   $myroom = pg_fetch_array($Result, $i);
   $xy = $myroom[xy];
   $xyar = split([\(,\)], $xy);
   $x = $xyar[1];
   $y = $xyar[2];
   ...


 Any ideas?



 --
 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] Dynamic Table Columns

2002-02-18 Thread DL Neil

Randy,

Suggest pulling the data out of the resultset using a numberically-indexed array. Then 
o/p each TD.../TD
inside a loop - you know how many times to loop, because that is set by the number of 
rows (plus Total column).

BTW if you use aliases on those SUM() columns - it will make life a lot easier when 
you are using associative
arrays to post-process the data.

Regards,
=dn


 I have a form (criteria.php) that includes two drop down lists from which a
 user can select a start period and an end period from a MySQL table. This
 form posts to a form called order_summary.php on which I am using the
 $start_period and $end_period variables from the criteria.php form to pull
 data from another MySQL table which will produce a summary of sales for
 those periods as illustrated by the following example:

  $start_period $end_period   $total
 -
  Order Type | APR-00 | MAY-00 | Total |
 -
  Widget 1 | $100 | $200 | $300 |
  Widget 2 | $300 | $200 | $500 |
 .
 .
 .

 OK. Fine and good. I have this working. My problem is this:

 How can I create a table which will dynamically adjust the number of columns
 based on the users request. That is, if the user requests APR-00 through
 MAY-00, the table will be built as illustrated above.  If the user requests
 JAN-01 through JUN-00, the table will be built as illustrated below:

  $start_period through
 $end_period
 
 --
  Order Type | JAN-01 | FEB-01 | MAR-01 | APR-01 |
 MAY-01 | JUN-01 |Total |
 
 --
  Widget 1 | $100 | $200 | $300 | $300 | $300 | $300 | $300 |
  Widget 2 | $300 | $200 | $500 | $300 | $300 | $300 | $300 |
 .
 .
 .

 I have posted order_summary.php below.

 Any thoughts?

 Thanks,

 Randy Rankin

   order_summary.php
 **

 ?
 session_register($dbname);
 ?

 ?
 require(./includes/salesdb.inc);

 $query_first_last_period = select period_id, period_name
 from periods
 where period_id between $start_period_id and $end_period_id
 GROUP BY period_id
 HAVING period_id = $start_period_id OR period_id = $end_period_id
 ORDER BY period_id;

 $result_first_last_period = mysql_query($query_first_last_period);

 $row = mysql_fetch_row($result_first_last_period);

 for( $i= 0; $icount($row);$i++ )
 {
 if( $i == 0 )
 $start_period_name = $row[$i];
 elseif( $i == (count($row)-1) )
 $end_period_name = $row[$i];
 }

 echo font face=Tahoma size=2 color=#333999;
 echo Salesperson: b$dbname/bbr;
 echo Report Period: b$start_period_name through $end_period_name/b;
 echo /fontP;

 echo table border=0 cellpadding=2 cellspacing=2;
 echo tr bgcolor=#99font face=Tahoma size=2 color=#ff;
 echo th align=left bordercolor=#808080font color=#FF face=Tahoma
 size=2bCategory/b/font/th;

 //   Start Get the Order Summary Data ***

 $sql_order_summary = SELECT order_type, SUM(extended_dollars)
 from salesdata
 where salesperson = '$dbname'
 and period_id between '$start_period_id' and '$end_period_id'
 group by order_type;
 $result_order_summary = mysql_query($sql_order_summary) or die (I can't get
 the sales data!);

 //   Stop Get the Order Summary Data ***

 //   Start Get the Period Names for the Table Header
 ***

 $sql_period_name = Select period_name
 from periods
 where period_id between '$start_period_id' and '$end_period_id'
 order by period_id;
 $result_period_name = mysql_query($sql_period_name) or die (I can't get the
 period name!);

 //   End Get the Period Names for the Table Header
 ***

 //   Build and Print the Table Headers ***

 $num_periods = mysql_numrows($result_period_name);

 if ($num_periods == 0)

 {
echo font color=#ffbThere were no records found for
 the periods selected./b/font;
 }

 else
 while ($row = mysql_fetch_array($result_period_name))
 {

 $period_name = $row[period_name];

 echo th align=left bordercolor=#808080font
 color=#FF face=Tahoma size=2
 b$period_name/b/th
 /font;
 }

 echo th align=left bordercolor=#808080font
 color=#FF face=Tahoma size=2bTotal Sales/b/font/th;
 echo /tr;



 //   End Build and Print the Table Headers
 ***

 //   Start Calculate and Format Total Sales
 ***

 $get_itemtot = SELECT SUM(extended_dollars)
 FROM salesdata
 WHERE salesperson = '$dbname'
 and period_id between '$start_period_id' and '$end_period_id' ;
 $itemtot_result = mysql_query($get_itemtot) or die (I can't do the math!);
 $itemtot = 

[PHP-DB] sql query

2002-02-18 Thread CrossWalkCentral

I am having a minor problem doing a simple sql query. 

Error performing service query : You have an error in your SQL syntax near '' at line 1

Here is a snip of the code: Please let me know what you think.

if ($submit):

$status=0;

// REQUEST INFO FOR SERVICES
$results = mysql_query(
SELECT * FROM supportsyscat WHERE display=$custcatergory);
if (!$results) {   
echo(PError performing service query :  .
mysql_error() . /P);
exit();
}

// Display the text
while ( $rows = mysql_fetch_array($results) ) {
$dservice=$rows[display];
$eservice=$rows[address];
}


$sql = UPDATE supportsys SET  .
   pdes='$custpdes',  .
   sdes='$adminsdes',  .
   status='$status'  .
   WHERE ticket=$ticketnum;

if (mysql_query($sql)) {
Echo(centerPh4Ticket #$ticketnum has been updated./h4/P/center);
Echo(Thank you $custfname $custlname);
Echo(pProblem: $custpdes/P);


if ($statusclose ==true) {
$status=Closed;
} else {
$status =Open;
}




RE: [PHP-DB] sql query

2002-02-18 Thread Beau Lebens

try replacing

WHERE display=$custcatergory);

with

WHERE display='$custcatergory');

and also tru echoing the value of that SQL statement (assign it to a var
first) to make sure you are getting the right thing.

HTH

/b

// -Original Message-
// From: CrossWalkCentral [mailto:[EMAIL PROTECTED]]
// Sent: Tuesday, 19 February 2002 9:31 AM
// To: [EMAIL PROTECTED]
// Subject: [PHP-DB] sql query
// 
// 
// I am having a minor problem doing a simple sql query. 
// 
// Error performing service query : You have an error in your 
// SQL syntax near '' at line 1
// 
// Here is a snip of the code: Please let me know what you think.
// 
// if ($submit):
// 
// $status=0;
// 
// // REQUEST INFO FOR SERVICES
// $results = mysql_query(
// SELECT * FROM supportsyscat WHERE display=$custcatergory);
// if (!$results) {   
// echo(PError performing service query :  .
// mysql_error() . /P);
// exit();
// }
// 
// // Display the text
// while ( $rows = mysql_fetch_array($results) ) {
// $dservice=$rows[display];
// $eservice=$rows[address];
// }
// 
// 
// $sql = UPDATE supportsys SET  .
//pdes='$custpdes',  .
//sdes='$adminsdes',  .
//status='$status'  .
//WHERE ticket=$ticketnum;
// 
// if (mysql_query($sql)) {
// Echo(centerPh4Ticket #$ticketnum has been 
// updated./h4/P/center);
// Echo(Thank you $custfname $custlname);
// Echo(pProblem: $custpdes/P);
// 
// 
// if ($statusclose ==true) {
// $status=Closed;
// } else {
// $status =Open;
// }
// 
// 

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




Re: [PHP-DB] sql query

2002-02-18 Thread CrossWalkCentral

Thanks I will try that.

Beau Lebens [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 try replacing

 WHERE display=$custcatergory);

 with

 WHERE display='$custcatergory');

 and also tru echoing the value of that SQL statement (assign it to a var
 first) to make sure you are getting the right thing.

 HTH

 /b

 // -Original Message-
 // From: CrossWalkCentral [mailto:[EMAIL PROTECTED]]
 // Sent: Tuesday, 19 February 2002 9:31 AM
 // To: [EMAIL PROTECTED]
 // Subject: [PHP-DB] sql query
 //
 //
 // I am having a minor problem doing a simple sql query.
 //
 // Error performing service query : You have an error in your
 // SQL syntax near '' at line 1
 //
 // Here is a snip of the code: Please let me know what you think.
 //
 // if ($submit):
 //
 // $status=0;
 //
 // // REQUEST INFO FOR SERVICES
 // $results = mysql_query(
 // SELECT * FROM supportsyscat WHERE display=$custcatergory);
 // if (!$results) {
 // echo(PError performing service query :  .
 // mysql_error() . /P);
 // exit();
 // }
 //
 // // Display the text
 // while ( $rows = mysql_fetch_array($results) ) {
 // $dservice=$rows[display];
 // $eservice=$rows[address];
 // }
 //
 //
 // $sql = UPDATE supportsys SET  .
 //pdes='$custpdes',  .
 //sdes='$adminsdes',  .
 //status='$status'  .
 //WHERE ticket=$ticketnum;
 //
 // if (mysql_query($sql)) {
 // Echo(centerPh4Ticket #$ticketnum has been
 // updated./h4/P/center);
 // Echo(Thank you $custfname $custlname);
 // Echo(pProblem: $custpdes/P);
 //
 //
 // if ($statusclose ==true) {
 // $status=Closed;
 // } else {
 // $status =Open;
 // }
 //
 //



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




[PHP-DB] Sample Warehouse Management System Codes?

2002-02-18 Thread Alvin Ang

Hi ppl,

Sorry to bother you ppl again, I was just wondering would anybody happen to
have simple codes for a Warehouse Management System? I need it as a
reference to do my Final Year Project for my University.

Thanks!

Alvin


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




Re: [PHP-DB] Sample Warehouse Management System Codes?

2002-02-18 Thread Bogdan Stancescu

I'm constantly amazed how people can post such e-mails without first 
checking freshmeat - it really takes longer to write the e-mail, you 
know? This is what I came up with - out of sheer curiosity - in less 
than a minute, by clicking on freshmeat, typing warehouse and clicking 
on the project name: http://freshmeat.net/projects/sisvent/

HTH

Bogdan

Alvin Ang wrote:

Hi ppl,

Sorry to bother you ppl again, I was just wondering would anybody happen to
have simple codes for a Warehouse Management System? I need it as a
reference to do my Final Year Project for my University.

Thanks!

Alvin






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




RE: [PHP-DB] Sample Warehouse Management System Codes?

2002-02-18 Thread Alvin Ang

Thanks a million!!

I din know abt freshmeat.net, very new to programming, infact it's the first
time that i am doing a program.

Alvin

P.S: But more references would very much be appreciated!! :P

-Original Message-
From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 19, 2002 12:51 PM
To: Alvin Ang
Cc: PHP
Subject: Re: [PHP-DB] Sample Warehouse Management System Codes?


I'm constantly amazed how people can post such e-mails without first
checking freshmeat - it really takes longer to write the e-mail, you
know? This is what I came up with - out of sheer curiosity - in less
than a minute, by clicking on freshmeat, typing warehouse and clicking
on the project name: http://freshmeat.net/projects/sisvent/

HTH

Bogdan

Alvin Ang wrote:

Hi ppl,

Sorry to bother you ppl again, I was just wondering would anybody happen to
have simple codes for a Warehouse Management System? I need it as a
reference to do my Final Year Project for my University.

Thanks!

Alvin






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




[PHP-DB] How to make logout from database server (ORACLE for example) when user closes its session

2002-02-18 Thread Vlad A. Chernikhoff

Hi all
Is it possible to track such situations when http user closes connection to
HTTP server to close opened persistent connections to the database? This
connections is still active all the time (if using php not as CGI but as
module for Apache) and when user trying to login next time PHP uses
previously opened (by OCIPLogin for example) persistent connection (the same
connection resource) - but this connection may be broken from the server
side if its idle time is too long. So I found only way to restart my Apache
+ modphp from time to time. :(

Thanks, Vlad





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