Re: [PHP-DB] Error connect to MySQL

2001-01-19 Thread Russ Michell

This could be one of several things.

The user you have (or havn't) set up doesn't have the right permissions 
to query your database. So set one up using 

mysql>GRANT ,SELECT,INSERT,UPDATE
mysql>ON 'database name'
mysql>TO username@host
mysql>IDENTIFIED BY PASSWORD 'your password'
mysql>FLUSH PRIVILEGES;

To try and elicit more help, I would suggest you start off every 
request for help by stating you platform, and versions of software that 
you are using.

Regards:

Russ

#---#

 "Believe nothing - consider everything"
    
  Russ Michell
  Anglia Polytechnic University Webteam
  www.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




[PHP-DB] Taking values from 'multiple select'

2001-01-19 Thread Russ Michell

Hello everyone:

I am using PHP4 on MySQL 3.22.32

I wish to take multiple values from an html multiple select form 
element, Where they will be compared to the content of a MySQL table 
field containing multiple entries.

For Example: One field named 'sport' contains: soccer, basketball, golf 
(separated by commas)

A user should be able view all table entries relevant to him if his 
[potentially] multiple entries match those in the DB table. (above)

Are there any specific php + SQL techiques for this? has anyone else 
come across a solution to this on their web-travels?

Cheers.

Russ

#---#

 "Believe nothing - consider everything"
        
  Russ Michell
  Anglia Polytechnic University Webteam
  www.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] installing php4 on windows and apache 1.3.*

2001-02-08 Thread Russ Michell

A don't mess with php/mySQL/apache individually!!

go to http://www.phpgeek.com/phptriad.php

phptriad is pretty much self explanatory - You get apache/MySQL/php4 
for WIndows. It's so easy to install even I managed it!

Good luck.

Russ

#---#

 "Believe nothing - consider everything"
        
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: RE: [PHP-DB] Can you recommend a development tool?

2001-02-09 Thread Russ Michell

When you say integral editor of DW, do you mean, the 'hit F10' editor?

I use EditPlus, (www.editplus.com) it is preconfigured to recognise and 
highlight php code as well as javascript etc and what have you..

Russ

#---#

 "Believe nothing - consider everything"
        
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




[PHP-DB] Can you recommend a development tool?

2001-02-09 Thread Russ Michell

Dreamweaver 4, now has the ability to display both the WYSIWYG GUI and 
the source-code in the same window, I like that as you can see what DW 
is doing as you place objects etc into the WYSIWYG section. 


I don't like the fact that they changed all the keyboard shorcuts around
F8 behaviours, F6 library etc - sadly no longer..


Russ

#---#

 "Believe nothing - consider everything"
    
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] Can you recommend a development tool?

2001-02-09 Thread Russ Michell

Last thing I'll say on the subject (It being off-topic and all ;-) )

Them there Keyboard shortcuts they messed with - they havn't replaced 
them with anything, I mean F4,5,6,7 do nothing, (might be wrong on one 
of those) but alt+shift+ctrl+pageUp+Del+&*(&^^%%$$ let's you see what 
the weather is like in Colombo! ie not very useful!!

Russ

#---#

 "Believe nothing - consider everything"
        
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




[PHP-DB] phpMyAdmin pswd hash

2001-02-14 Thread Russ Michell

Hi all:

My simple php authenticate script refuses to work, whenever I have a 
hash of the password stored in the database-table. (having used 
phpMyAdmin2.1.0 to do it)

It seems to work okay without it but then I'll have a plain text 
password stored in my DB, not a good plan you'll agree. Strange thing 
is at about the same time I noticed this, something seems to have 
gone awry with my Apache 1.3.14 web-server, (on RH 6.1), in that it 
will encode a .htpasswd file for me no-probs, but when it is placed in a
.htpasswd/.htacess duo it refuses to accept the password I just gave it!
(having tried several times)

Does phpMyAdmin rely on the same encoding mechanism for hashing 
passwords? I've nver had this trouble - before anyone asks wether my 
Apache http authentication has ever worked! (it has)

Any help will prevent my head becoming more sore than it is rapidly 
becoming!

cheers.

Russ

#---#

 "Believe nothing - consider everything"
        
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] mysql_query failure

2001-02-16 Thread Russ Michell

>$con = mysql_connect($DB_SERVER, $DB_USER, $DB_PASS)
>or die ("Cant connect");
>mysql_select_db($DB_NAME);

Try:

$con = mysql_connect($DB_SERVER, $DB_USER, $DB_PASS)
or die ("Cant connect");
mysql_select_db($DB_NAME, $con);

Also try and make your php functions like so: mysql_x() instead of: 
mysql_x () (loose the gap!)

Hope that helps somewhat! ;)

Russ

#---#

 "Believe nothing - consider everything"
    
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




[PHP-DB] composite keys

2001-02-19 Thread Russ Michell

Hi all:
I am using php4.0.3pl1 with MySQL 3.22.32 on Apache for RH Linux.

I have a table/relation of sports, where amongst other categories, are 
teams, where there can be many 'teamNames' & 'teamInfos' for one sport.

The problem here is that without the use of a composite key: 
'sportName' & 'TeamName', there can be no method of uniquely 
identifiying a row or tuple. A smuch of the info for each sport is 
repeated.

Does MySQL support the use of composite keys? I am using phpMyAdmin 
2.1.0 to adminster my MySQL system, and this only seems to accept a 
single primary key for a single table.

Any advice or other methods I could possibley employ, are most welcome.

Regards:
Russ

#---#

 "Believe nothing - consider everything"
        
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] Tutorial?

2001-03-02 Thread Russ Michell

Welcome new person!

Most people who ask this question generally get pointed in the 
direction of Julie C. Meloni's book "PHP Fast & Easy Web Development"

It goes from the ABSOLUTE basics through to explaining [MySQL] database 
connectivity and sql statements. I used it and highly reccommend it. I 
also has a good Appendix of MySQL/PHP functionality + onlineplaces to 
visit for extra help.

Julie's website is thickbook.com and look for the section for the book 
(above).

ISBN: 0-7615-3055-X
Price US$24.99
Can$ 37.95
GBP£18.99

Or just look for the above title on amazon.com

HTH :)

Russ

#---#

 "Believe nothing - consider everything"
        
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] How to display date?

2001-03-02 Thread Russ Michell

Osman, try the follwoing (Substitutign your own variables)

list($Year,$Month,$Day) = split('-',$date_team); //Remove the '-' from 
the MySQL sate format.
$stampeddate = mktime(12,0,0,$Month,$Day,$Year); //Create a UNIX style timestamp from 
the result
$date_team = date("d M Y",$stampeddate); //Use php date function and args' to print in 
more useable format

HTH :)

Russ

#---#

 "Believe nothing - consider everything"
        
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] Displaying Graphics dynamically

2001-03-12 Thread Russ Michell

Mike:

Depending on the number of images you wish to insert into the database, 
you might wish to opt for the path to the image to be stored not the 
image itself.

 

Then use some sort of loop (I use a for loop) to go through the table 
data (of paths-to-images) and display them dependent on whatever 
criteria it is you are using.

HTH :)

Russ

#---#

 "Believe nothing - consider everything"
    
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] Using selected fields

2001-03-12 Thread Russ Michell

Sure:

while($row = mysql_fetch_array($result)) {
 $usrLevel = $row['userlevel'];
 $member = $row['member'];
 $pswd = $row['pw'];
}
//end -while loop

Now $usrLevel, $member and $pw are available as variables taken from 
this array to use as you please in you php scripts!

Russ



Hi there,
Firstly a big thanks to those who pointed me in the direction of 
'PHP-fast and easy web development'. it was/is a great book, and I have 
learnt loads on the past week.

Anyhoo...

I have a php page and included the line:

$sql = "SELECT * FROM $table_name
 WHERE member = \"$member\" AND pw = \"$pw\"  ";

Now I have a third column called 'userlevel'.

I have a cookie that activates on successfully matching the member and 
pw fields from a form on the previous page. make sense?

How can I tell the page to use the userlevel colunm too?

Here is the relevent section to my code... can anyone point me in teh 
rigth direction please???



$sql = "SELECT * FROM $table_name
 WHERE member = \"$member\" AND pw = \"$pw\"  ";

$result = mysql_query($sql)
or die ("Can't execute query.");

$num = mysql_numrows($result);

if (($num != 0) && ($userlevel == 1)) {

$cookie_name = "auth";
$cookie_value = "ok";
$cookie_expire = "";
$cookie_domain ="";
setcookie($cookie_name, $cookie_value, $cookie_expire, "/", 
$cookie_domain, 0);

$display_block ="

Secret area:

 secret page a
 secret page b
 secret page c
 secret page d
 secret page e

";

} else {

 header("Location: http://www.mypage.com");
 exit;
}


#-------#

 "Believe nothing - consider everything"

  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] Ordering Articles

2001-03-12 Thread Russ Michell

Try:

"SELECT * FROM $table WHERE yourfield = '$somevar' ORDER BY 
someotherField";


HTH :)

Russ

#---#

 "Believe nothing - consider everything"
        
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] Apache Question

2001-03-12 Thread Russ Michell

Lisa:

1. Apache's httpd.conf file (THE configuration file) should be in: 
apache/conf/httpd.conf (ot httpd.conf.default)

2. Find the following line:
   #
   # DirectoryIndex: Name of the file or files to use as a pre-written 
   #HTML
   # directory index.  Separate multiple entries with spaces.
   #
   DirectoryIndex index.shtml

3. Simply add your desired file ending to this:
So I have:

#
# DirectoryIndex: Name of the file or files to use as a pre-written HTML
# directory index.  Separate multiple entries with spaces.
#
DirectoryIndex index.html
DirectoryIndex index.php
DirectoryIndex index.php3
DirectoryIndex index.phtml

HTH :)

Russ


#---#

 "Believe nothing - consider everything"
    
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] directrory browsing

2001-03-13 Thread Russ Michell

Ummm a bit more info on your part may be helpful for folk to help 
you

Like in what context your problem lies, using which system and what it 
has to do with Databases working with PHP


Russ

#---#

 "Believe nothing - consider everything"
    
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] Apache + PHP4

2001-03-14 Thread Russ Michell

Mario:

Ensure you have the following written similarly to this and UNCOMMENTED!



# AddType allows you to tweak mime.types without actually editing it, or to
# make certain files to be certain types.
#
# For example, the PHP3 module (not part of the Apache distribution)
# will typically use:
#

AddType application/x-httpd-php-source .phps
AddType application/x-tar .tgz
AddType application/x-httpd-php .php3 
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml



HTH :)

Russ

#---#

 "Believe nothing - consider everything"
    
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] Variable variables ! - help

2001-03-14 Thread Russ Michell

Hi there:

Not sure this'll work but it's some way towards it I would think:
(Note all occurances of the variable: '$display_this'


//Start off the display item outside the loop
$display_this = "";

if ($art_nr1 != '') {
$i++;
$display_this .= "




";

I've now got the following 
art_nr_1=12456
quant1="" or 1 or so

And now comes the bit which doesn't work !

for ($i=1; $i<50; $i++) :
$varid = "quant".$i ;
if ($$varid != "") {

//Continue 'building up the varuable:

$display_this .=
"
 ";
}
endfor;  


//Echo thwe variable to the page





#---#

 "Believe nothing - consider everything"

  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] Help w/ displaying return vals

2001-03-15 Thread Russ Michell

Ryan:

The followoing error message: 
>Warning: Supplied argument is not a valid MySQL result resource

means that a php function hasn't been supplied witht the correct number 
of arguments.  Try the following:

$link = mysql_connect("host","yourusername","yourpassword") or 
die("Died at connection.");
table_name = "yourtable";
mysql_select_db("dbname");
$sql = "SELECT * FROM yourtable";
$result = mysql_query ($result, connection);

$fields = mysql_num_fields($result);
$rows = mysql_num_rows($result);

$table = mysql_field_table($result, $i);

echo "Your '".$table."' table has ".$fields." fields and ".$rows." 
records "

- - EOP - -

//All I've done is to give mysql_query() two arguments
//Remover gaps between mysql functions anf their arguments (Which they 
//shouldn't have)

And given mysql_connect all 3 arguments it should have to make a 
successful connection to your database server. (Not sure wether you 
missed these out simply for clarity though)

Hope that all helps and makes sense!!

Cheers
Russ

#---#
        
 "Believe nothing - consider everything"

  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] syntax trouble

2001-03-16 Thread Russ Michell

As far as I can see:

>What does this mean?
>Parse error: parse error, expecting `','' or `';'' in
>/http/www/b/bidattorney.com/public_html/user/stest.phtml on line 13

This means probably on line 12 you forgot a semi-colon...
and so php goes on to parse the lines past where it expected a 
semi-colon and finds incorrect syntax. (Due to lack of said-semi colon)

Go check it out!

HTH :)

Russ

#---#

 "Believe nothing - consider everything"
        
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] A question - ($file_exists)

2001-03-27 Thread Russ Michell

Hi there: What about doing it like this:



#---#

 "Believe nothing - consider everything"
    
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] A question - ($file_exists)

2001-03-27 Thread Russ Michell

Can you not just make it less confusing and have the one variable to 
echo to the page?

As you saw from my example, a single variable can have multiple values 
if it is produced from a for-loop.

I'm sorry if this doesn't help - often a good night's sleep sorts it 
out - exactly what I'm off to do now

Russ


#---#

 "Believe nothing - consider everything"
        
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] fetch array problems.

2001-03-28 Thread Russ Michell

Felix:

Depending on what you're trying to do try either of these:

//Check to see if $color is in DB:

$connection = mysql_connect("localhost","user","pass") or die("Died at 
connection.");
$sql = "SELECT * FROM user_prefs WHERE u_id='$UserID'";
$result = mysql_db_query($sql, $connection) or die("Died at query.");
$color = mysql_num_rows($result);

//If query didn't die, check to see if there is a result for this query:
if($color != 0) {
echo "";
}
else{
echo "Some error message.";
}

//Print $color to page:

$connection = mysql_connect("localhost","user","pass") or die("Died at 
connection.");
$sql = "SELECT * FROM user_prefs WHERE u_id='$UserID'";
$result = mysql_db_query($sql, $connection) or die("Died at query.");
while($row = mysql_fetch_array($result)) {
$color = $row['color_1'];
echo "";
}

Try that little pup on for size...

Russ


#-------#

 "Believe nothing - consider everything"

  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] checkbox data

2001-03-28 Thread Russ Michell

olinux:

I have some checkboxes that are generated on the fly that represent a 
person signing up for an activity:


";

//On the page this form is submitted to I pick the results up thus:

while(list($key) = each($signup)) {

//Start off SQL query - inserting available values into $table

$query = mysql_query("INSERT INTO $table 
(activity,username,email,signedup4,theDate) VALUES 
('$id','$username','$ipemail','$key','$completeDate')");

$list = "";
$list .= "'";
$list .= "$key";
$list .= "'"; 
$list .= "";
$resultText = "Thanks $username! Your 
selection has been recorded succesfully!";
}
//end-while


HTWI (Hope That Was Informative) - New FLA (Four Letter Acronym)

Russ

#---#
        
 "Believe nothing - consider everything"

  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] auto_increment in mysql

2001-03-28 Thread Russ Michell

I may be semi-new to this MySQl lark but I'm sure auto_increment starts 
at 0.

Russ

#---#

 "Believe nothing - consider everything"
    
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] auto_increment in mysql

2001-03-28 Thread Russ Michell

I use MySQL 3.22.23 but I just had a hunt about on the web and I found 
a posting that confirmed your findings - I.E: auto_increment starts at 
1!!

I stand corrected!


Russ

#---#

 "Believe nothing - consider everything"
    
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] My first question: PHP won't update MySQL

2001-03-29 Thread Russ Michell

Timothy:

Your code uses the  out of place, try this and 
compare it to what you have:

Edit Story:";

$sql = "  SELECT * FROM story WHERE id='$id'  ";
result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
$id = $myrow['id'];
$title = $myrow['title'];
$body = $myrow['body'];


$myvar = "";
?>






If you only have a single result for $id the above code will be fine. 
If you know there may be more than one then you'll have to tuse a loop:

while($myrow = mysql_fetch_array($result)) {
$myrow = mysql_fetch_array($result);
$id = $myrow['id'];
$title = $myrow['title'];
$body = $myrow['body'];

$myvar = $myvar . "";
}




HTH ;-)  Russ



#---#

     "Believe nothing - consider everything"

  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] $vars to JS in a linked js page.

2001-03-29 Thread Russ Michell

Not too sure if this is what you want, if not - I'm sorry:

>$some_number = $mysql_num_rows()

sizeof()

This counts the number of elements in an array..(Just wipped that outta 
the open page in "PHP Fast and Easy"!)


Russ

#---#

 "Believe nothing - consider everything"
        
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com



#---#


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




Re: [PHP-DB] PHP an MySQL

2001-04-02 Thread Russ Michell

I have read and have reccommended several times: "PHP Fast and Easy Web 
Development" By Juli C Meloni.



ISBN: 0-7615-3055-X
Prima Tech publishing

#---#

 "Believe nothing - consider everything"
        
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] Delete all Data and keep the Table

2001-04-02 Thread Russ Michell

Using PhpMyAdmin click the 'empty' hyperlink. This will empty all the 
data from the table but not delete the table.

HTH :)

Russ

#---#

 "Believe nothing - consider everything"
        
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] Keeping Variables

2001-04-02 Thread Russ Michell

Chris:

in view.php:

Click here to see the value of cr

in anotherpage.php:

echo $cr; //outputs 'yes'


Or:



more form stuff etc etc yadda yadda yadda



?>

//Submitting the form will reload the page and if you detect for it, 
//the variable $arse should be available with the value of 'big' 

HTH ;-)

Russ

#---#

 "Believe nothing - consider everything"
        
  Russ Michell
  Anglia Polytechnic University Webteam
  http://www.apu.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] Passing parameters

2001-04-05 Thread Russ Michell

What I think is happening is that you have one form, but more than one 
submit button. HTML forms can only have one submit button. So the first 
one that it 'sees' is the 'save' submit button, this is why you have 
this result each time.

If you're doing as I am i.e: deleting and updating results, use  and not  and use a bit of 
Javascript: 

Good luck!

Russ

#---#

 "Believe nothing - consider everything"
    
  Russ Michell
  Anglia Polytechnic University Webteam
  www.apu.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




[PHP-DB] overrun??

2001-04-09 Thread Russ Michell

Hi all:

I use PHP4pl1 with MySQL 3.22.32

Whenever I go onto my php website, specifically onto a page with a DB 
connection requesting something from it, there is what can only be 
described as overrun. By this I mean the page displays in seconds but 
the hourglass icon continues to to rotate for a good 5 seconds longer.

This is nothing to do with loading graphics as there are non on the 
page as yet, so I  assume it something to do with my connection. Do I 
have to explicitly state a close connection to MySQL??

Cheers
Russ

#---#

 "Believe nothing - consider everything"
    
  Russ Michell
  Anglia Polytechnic University Webteam
  www.apu.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: RE: [PHP-DB] overrun??

2001-04-09 Thread Russ Michell

Cheers Ben.

However if I close a connection, how is it possible to reconnect if the 
connection needs to be reused, i.e if further DB data is requested? Is 
it just a matter if refreshing the page and it all resets??

Russ

#---#

 "Believe nothing - consider everything"
    
  Russ Michell
  Anglia Polytechnic University Webteam
  www.apu.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




[PHP-DB] overrun?

2001-04-09 Thread Russ Michell

Whoa there!!

It's no *BIG* deal! It all works fine I just wondered why the connecton 
seemed to linger a little longer than it should!
I'll go with Ben's idea and close off the connectons at the bottom of 
my script. As for using a new version of MySQL - what's the point? It 
works fine. I can insert, select and update - all fine. WHy on earth 
would I want to upgrade to a new version which would prob take me all 
day, maybe crash the server on which several important websites sit on, 
and is generally more hassle than it's worth.

If it aint broke - don't fix it.

Cheers for your ideas folks.

Russ

#---#

 "Believe nothing - consider everything"
        
  Russ Michell
  Anglia Polytechnic University Webteam
  www.apu.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] overrun??

2001-04-10 Thread Russ Michell

Hmmm that's a goodun that is. Do you reckon that a lack of  tags 
may be the cause of this? Only there's a heck of lot of dynamically 
generated HTML content there. Do you know of any HTML parsers that 
could go through my source (once generated to the browser) and indicate 
unclosed tags??

Cheers for that.
Russ

#---#

 "Believe nothing - consider everything"
   "Web Developers do it on-the-fly."
        
  Russ Michell
  Anglia Polytechnic University Webteam
  www.apu.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




[PHP-DB] SQL help

2001-04-10 Thread Russ Michell

Hi there folks, I have a small prob regarding SQL on MySQL 3.22.32 
using php4.0.3pl1 :

I want to select DISTINCT sports from one table WHERE a username and a 
password match a username and a password in another table - not sure 
how to construct my query.

In an ideal world it's gonna look something like this:

$sql = "SELECT DISTINCT sportID FROM $table_sport"; 
$sql .= "SELECT * FROM $table_users WHERE $table_users.usrName='$admin_username' 
AND $table_users.usrPswd=password('$admin_password')";

Just not sure how the query needs to be constructed...
Can anyone with even slightly advanced (over me) SQL knowledge help me 
out??

Many thanks!
Russ


#---#

 "Believe nothing - consider everything"
   "Web Developers do it on-the-fly."
    
  Russ Michell
  Anglia Polytechnic University Webteam
  www.apu.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] SQL help

2001-04-10 Thread Russ Michell

Sweet!!

Many thanks!

Russ

#---#

 "Believe nothing - consider everything"
   "Web Developers do it on-the-fly."
        
  Russ Michell
  Anglia Polytechnic University Webteam
  www.apu.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: RE: [PHP-DB] Robust OO Shopping Cart 4 sale -ohmygod

2001-04-10 Thread Russ Michell

Okay boys easy now - let's just get on with what we know best eh?? - 


developing.

Russ

#---#

 "Believe nothing - consider everything"
   "Web Developers do it on-the-fly."
        
  Russ Michell
  Anglia Polytechnic University Webteam
  www.apu.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




[PHP-DB] checkbox checking..

2001-04-10 Thread Russ Michell

G'day all:

Using php4.0.3pl1 I have a column in a MySQL table that is set to 
char(1) and is either empty or 'y' (if anyone knows of a better dual 
choice column type I'd be pleased to hear about it...however...)

In my update script I want a checkbox to be display as checked if 'y' 
is set in the afformentioned table. (The update script first SELECTS 
then displays the results in form fields in order to enable altering of 
their the contents (UPDATE/DELETE etc) All the other field types ( 
 and  ) are fine just 
the checkbox refuses to tell me the status of the column ('y' or empty)

This is the script snippet I thought may do it but doesn't:

while($chk_row = mysql_fetch_array($chk_result, $connection)) {
$ischkd = $chk_row['chk'];
if(!empty($ischkd)) {
$chkbox = "";
}
else{
$chkbox = "";
}
}
//end-while

echo "$chkbox
/*
Should echo as a checked-checkbox if 'y' exists in the table (the 'if')
Or an unchecked-checkbox (the 'else') if 'y' doesn't exist or the 
result is empty.
*/

I have also tried doing:

$num = mysql_num_rows($chk_result); 
if($num != 'y') {
$chkbox = "";
}
else{
$chkbox = "";
}

//But this don't work either!!??

Any suggestions are most welcome as the more coffee I consume the less 
rational my thought processes become!!

Cheers!

Russ


#---#

     "Believe nothing - consider everything"
   "Web Developers do it on-the-fly."

  Russ Michell
  Anglia Polytechnic University Webteam
  www.apu.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] checkbox checking..

2001-04-10 Thread Russ Michell

Thank Johannes!!

I'll give that a go!


Cheers - Russ

#---#

 "Believe nothing - consider everything"
   "Web Developers do it on-the-fly."
        
  Russ Michell
  Anglia Polytechnic University Webteam
  www.apu.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] Error messge regarding session variables

2001-04-17 Thread Russ Michell

Make sure you have nothing between your http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] hide passing value

2001-04-18 Thread Russ Michell

Do you mean like:


The script this value gets passed to will now have available the 
varible: pswd with a value of the password field..

???

HTH :-)

Russ

#---#

 "Believe nothing - consider everything"
   "Web Developers do it on-the-fly."
        
  Russ Michell
  Anglia Polytechnic University Webteam
  www.apu.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] hide passing value

2001-04-18 Thread Russ Michell

Ok fair play -

What about using sessions then:



simply place the code between the  at the top of each page 
you wish the password to be available on.

Hope that helps...

Russ


#---#

 "Believe nothing - consider everything"
   "Web Developers do it on-the-fly."
        
  Russ Michell
  Anglia Polytechnic University Webteam
  www.apu.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] Error Msg: Wrong data type when performing "extract()"

2001-04-19 Thread Russ Michell

Hmmm not sure -

You could try to strip out much of the sql by simply using:

$sqlstmt ="SELECT * FROM stock_in, equip, vendor";
$sqlstmt.="WHERE equip.id=equip_id and vendor.id=vendor_id and
equip.id='$id'";
$sqlstmt.="ORDER BY equip.id ASC";

# print $sqlstmt;
$result=mysql_query($sqlstmt);
# print $result;
$row=mysql_fetch_array($result)

That way if an error existed somewhere B4 then it'd go..

Sorry if that was next-to-useless.

Russ 

#---#

 "Believe nothing - consider everything"
   "Web Developers do it on-the-fly."
    
  Russ Michell
  Anglia Polytechnic University Webteam
  www.apu.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] Make history HOW?

2001-04-19 Thread Russ Michell

I have a similar PHP system on my site using sessions:

I have an admin session, where each step(1-5) is a different 
page(script) and as each page is progressed into a new session is 
registered with the users username, the activity currently being edited 
and the team within this activity they are editing.

This same method could be employed by you where the page title is 
registered as a session variable and echoed to the page. If the user 
goes back a page then check to see if the variable is set and if it is 
then unregister or destroy it, thus delivering an accurate method of 
the users progress throughout the site.

 
if(!empty($yourvar)) {
session_unregister('yourvar');
}

Hop this is of some use to you!
Regards:

Russ

#---#

 "Believe nothing - consider everything"
   "Web Developers do it on-the-fly."
        
  Russ Michell
  Anglia Polytechnic University Webteam
  www.apu.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] Designing a database

2001-04-19 Thread Russ Michell

Designing DB's is an entire domain of study in itself!

However the rules (guidelines rather) I stick by at present but am open 
to new ones as I need them,- are:

* Don't repeat data across tables (leads to 'data redundancy' = more 
complex to update the DB)
* If in doubt 'put it' in a new table
* Use useful and memorable names for your tables and table columns

I do:

tablename_colname

Good luck!
Russ

#---#

 "Believe nothing - consider everything"
   "Web Developers do it on-the-fly."
        
  Russ Michell
  Anglia Polytechnic University Webteam
  www.apu.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com

#---#


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




Re: [PHP-DB] Fw: sending e-mail thru PHP page.

2001-04-19 Thread Russ Michell

HaHa!! I'm just sorting that one too:

Try:
$sender = "[EMAIL PROTECTED]";
mail("$mail_to","$subject","$body","From: $sender");

That should do it...

Also check out the threads on phpbuilder.com:

http://www.phpbuilder.com/forum/read.php3?num=2&id=117925&loc=0&thread=117925


Good luck!!

Russ

#---#

 "Believe nothing - consider everything"
   "Web Developers do it on-the-fly."

  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] Sending e-mail thru PHP page (2nd part)

2001-04-19 Thread Russ Michell

I don't know how you're operating your PHP system but can you not 
simply have an email form field??

Russ

#---#

 "Believe nothing - consider everything"
   "Web Developers do it on-the-fly."
        
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




[PHP-DB] Querying 2 databases...???

2001-04-24 Thread Russ Michell

Hi all:

I want to be able to update,insert and delete identical information in 2 tables that 
lie in 
seperate Databases from my PHPfront-end. 

The info I am editing is username/access info for table data 
privileges. One table called 'users' is in my own DB: 'sportDB' and the 
other is the 'user' table in the 'mysql' database.

I'm not sure how to construct the queries and wether or not I need to set up a 
separate php-$connection setup (running 2: one to connect to my own 
datatase: 'sportDB' and the other to connect to: 'mysql')

I suppose I could include new columns in the 'mysql' database to 
incorporate the data I'm trying to extract from my 'users' table within
'sportDB', but I'm not sure what effect this may have on the other 
applications (not mine) that rely on this MySQL installation.

Does anyone have any views on this problem or has anyone any 
whole/partial solutions to point me in the right direction??

I am using php4.0.3pl1 with MySQL3.22.32 on RH6.1

Any help would be very much appreciated.
Kind regards:

Russ Michell (APU Webteam)

#---#

 "Believe nothing - consider everything"    
   "Web Developers do it on-the-fly."

  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




[PHP-DB] Querying 2 databases...???

2001-04-24 Thread Russ Michell

>sportdb.table_name.username_field = mysql.user.User

Do I not need to define for php what 'mysql' is, as I've done for 
'sportDB' ??  and is there any specific sort of JOIN I need to do??

Many thanks for your prompt reply..

Regards:
Russ



#---#

 "Believe nothing - consider everything"
   "Web Developers do it on-the-fly."
        
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




[PHP-DB] query problem

2001-04-25 Thread Russ Michell

Hi all:

I'm using mysql-3.22.32:

My PHP-embedded query is as follows:

else if($sortBy == '01') {
$sql = "SELECT * FROM $table_cal WHERE item_activity='$id' AND 
DATE_FORMAT('item_date','%m') LIKE '$sortBy'"; 
$sortBy = "Month of January";
}

* '$sortBy' is equal to '01'.
* MySQL isn't complaining about any of the query.
* DATE_FORMAT('item_date','%m') should be '01' (taken from 
a 'date' column in -MM-DD fromat.

Can anyone tell me what is wrong with this query (I may have missed 
something - but then that shouldn't surprise as I've been staring at it 
for 3 hours...;-)

Cheers:
Russ

#---#

 "Believe nothing - consider everything"
   "Web Developers do it on-the-fly."

  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




[PHP-DB] Query problem cont'd..

2001-04-26 Thread Russ Michell

Hi there:

I'm stil having problems with this query in that it doesn't bring up any results!
Here is the  menu that refreshes the page and deposites the var: 'sortedBy' 
into play:



--select one--
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec



The SQL qery:

if(
($sortedBy == 'Jan') || ($sortedBy == 'Feb') || ($sortedBy == 'Mar') || 
($sortedBy == 'Apr') || ($sortedBy == 'May') || ($sortedBy == 'Jun') ||
($sortedBy == 'Jul') || ($sortedBy == 'Aug') || ($sortedBy == 'Sep') || 
($sortedBy == 'Oct') || ($sortedBy == 'Nov') || ($sortedBy == 'Dec')
) 
{
$sql = "SELECT * FROM $table_cal WHERE item_activity='$id' AND 
DATE_FORMAT('item_date','%b')='$sortedBy'"; 
}

Thanks to Rasmus for helping me out so far!
Can anyone see what I may be doing wrong???

I'm using mysql-3.22.32 and the item_date column is a MySQL DATE() column..

Cheers:
Russ

#---#
    
 "Believe nothing - consider everything"
   "Web Developers do it on-the-fly."

  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] update problems

2001-04-27 Thread Russ Michell

If I have the right-end of the stick then this is what you want:

$dropdown = "


--choose one--";

while($row = mysql_fetch_array($result)) {
$var = $row['yourcolumn'];
$dropdown .= "$var";
}//end while loop

$dropdown  .= "";

Just replace the name of the column 'yourcolumn' and $var to the 
variable and column names you want to be pulled from the database.

Good luck and happy coding! :-)
Russ


On Thu, 26 Apr 2001 20:16:38 +0200 ns 
<[EMAIL PROTECTED]> wrote:

> hi
> i got to have data from mysql database to drop down menues in html how 
> do i do that?
> I can´t get any data to my drop down menues...
> 
> 
> 
> thanks to anyone who can do this...
> 
> ns
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#

 "Believe nothing - consider everything"    
   "Web Developers do it on-the-fly."

  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




[PHP-DB] Simple query problem

2001-05-03 Thread Russ Michell

Hi all:

I have a seemingly simple SQL problem when using the following PHP4/MySQL-3.22.32 
query:

$sql="SELECT * FROM $table_users WHERE usrName='$username' AND 
usrPswd=password('$password') AND affiliation='$aff_sport'";
$result = mysql_query($sql, $connection) or header("Location: error.php?err=query");
$num = mysql_num_rows($result);
//User hasn't been found in DB with current details:
if ($num != 1) {
header("Location: error.php?err=n_player");
exit;
}
//Else get vars and authenticate
else {
//while loop get's vars etc etc
}

My error checking mechanism check's if the inputted details can be found in the DB if 
not you are taken to an error page.
The table $table_users, at present has 2 rows where the same username/password crops 
up, but different data 
(other than the username and password) in their respective rows.

At it stands, I am taken to the error page. If I remove one of the same-name users it 
works fine. 
What can I do to this query or even my table to remedy this so I can have multiple 
same-name users/pswds but with different data,
such as 'affiliation' as above for example??

Please help - as I have nearly completed the projectjust some fiddly lil' things 
need to be sorted..
Many thanks.

Russ

#---#

 "Believe nothing - consider everything"
   "Web Developers do it on-the-fly."

  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] INSERT into mySQL over PHP (internet)

2001-05-03 Thread Russ Michell

> I'd like to have some kind of a GUI on the internet
Could you not use phpMyAdmin??

Download it for free from http://www.phpwizard.net/projects/phpMyAdmin/

Cheers.
Russ

On Thu, 3 May 2001 15:43:11 +0200 Nils Wetterich <[EMAIL PROTECTED]> wrote:

> Hi NG
> 
> Now that I finally realy work with the combination mySQL & PHP on a
> Windows-machine I began to just love it. There's only one problem I 
> still have:
> How can I INSERT data from a HTML-form to the database on the server? 
> I'd like to have some kind of a GUI on the internet so I could 
> administer and manage the database from everywhere I want.
> Please look at what I have yet. Maybe you can find the prob and help 
> me. (I have the idea that "mysql_query()" can't work with the variables 
> ($uName & $eMail).)
> 
> Thanx in advance,
> 
> Yours Nils.
> -
> 
> $con = @mysql_connect("host", "user", "password") or die("Oops... no
> connect.");
> $qry = "SELECT name, mail FROM TUsers";
> $res = mysql_db_query("database", $qry, $con);
> // $ins = "INSERT INTO TUsers (name, mail)
> //VALUES ($uName, $eMail)";  // --->  doesn't 
> work! $ins = "INSERT INTO TUsers (name, mail)
> VALUES (\"Any Name\", "\and eMail\");  // -->   
> works perfect!
> 
> mysql_query($ins) or die("Sorry. Couldn't execute INSERT.");
> 
> 
> Name:  eMail:  name="eMail"> 
> 
> 
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] Apache+PHP+MySQL installation at once - HOW?

2001-05-04 Thread Russ Michell

> I remember, that I saw somewhere some prepared package for very fast and
> comfortable installation of these three at once. Don't you now where I 
> can find it? Thanks

I think you wanna be going to:
http://www.phpgeek.com/phptriad.php

Good luck!
Russ.

On Fri, 4 May 2001 09:45:41 +0200 Vojtech Dvorak 
<[EMAIL PROTECTED]> wrote:

> Hi,
> I want to install this great trio Apache+PHP+MySQL and don't want it 
> install step by step, program by program.
> I remember, that I saw somewhere some prepared package for very fast and
> comfortable installation of these three at once. Don't you now where I 
> can find it? Thanks
> Vojtech
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#
        
  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] True and Flase in mysql !!

2001-05-10 Thread Russ Michell

> What is the best way to create True\Flase field in mysql ??
Use the 'ENUM' Field type.

http://www.mysql.com/doc/E/N/ENUM.html

Russ

On Thu, 10 May 2001 11:43:01 +0300 "DesClub.com" <[EMAIL PROTECTED]> wrote:

> hi all ..
> What is the best way to create True\Flase field in mysql ??
> 
> 
> -
> http://deslcub.com/phpLinkat/
> DesClub.com
> 

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] mysql newbie

2001-05-10 Thread Russ Michell

>how to set mysql to ask password to any user who try to enter ?

If you are using a GUI like phpMyAdmin to administer the MySQL 
database, you can use it to prompt for a username and password such as 
would occur with a .htaccess/.htpasswd file combination.

If you're on the command line - in Linux you can type mysql -p 
anywhere at the shell prompt (if you installed it to run in the 
background as a 'deamon') and it'll prompt you to type a username and a 
password.

Take care to remember these as it's v.hard to recover when you loose 
these (I know 'cos I did it!)

Good luck!
Russ

On Thu, 10 May 2001 11:45:32 +0700 andrie <[EMAIL PROTECTED]> 
wrote:

> Hello php-db,
> 
>   a allready install mysql on apache and idont create any user yet
>   one question from me, when i enter mysql, i can enter it without
>   being asking any password(i'm not root). how to set mysql to ask
>   password to any user who try  to enter ?
> 
> -- 
> Best regards,
>  andrie  mailto:[EMAIL PROTECTED]
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#-------#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] No MySQL-Link resource supplied

2001-05-10 Thread Russ Michell

> Is anyone familiar with this error and what causes it (or better, how 
> to fix it). 
> Warning: No MySQL-Link resource supplied 
> in /usr/local/apache/htdocs/sales/login.php on line 46

Go to: http://uk.php.net/manual/en/function.mysql-close.php, it seems 
as if mysql_close() does take some arguments, therefore the error
message: "Warning: No MySQL-Link resource supplied " means that php was 
expecting arguments for mysql_close() and was given none.

HTH

Russ

On Thu, 10 May 2001 07:56:07 -0500 "Rankin, Randy" 
<[EMAIL PROTECTED]> wrote:

> Is anyone familiar with this error and what causes it (or better, how 
> to fix it). 
>   Warning: No MySQL-Link resource supplied 
> in /usr/local/apache/htdocs/sales/login.php on line 46
> 
> Line 46 =  mysql_close(); I cannot seem to find anything regarding this
> message in the MySQL or PHP manuals. 
> 
> Thanks in advance, 
> 
> Randy Rankin
> 
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#-------#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: RE: [PHP-DB] exit code generation, php shell script/standalone

2001-05-11 Thread Russ Michell

Could you not use :

or(header("Location: local/or/absolute/path/to/exit_script.php"));

In the exit_script.php do [embed] some perl stuff - (Soz a bit vague, 
but you get the idea)

Hope that is of help - if not, then feel free to call me 'dumbass' ;-)
Cheers.

Russ

On Thu, 10 May 2001 18:27:33 -0400 Dave VanAuken 
<[EMAIL PROTECTED]> wrote:

> this particular instance of call is from a radius server (perl or C),
> so it is not interacting with the web server at all, no browsers...  a
> shell script for all intents and purposes, which parses the db for the
> required aiuthentication info and processes the request accordingly
> (along with other tasks).
> 
> perl scripts for example, can exit back to the calling program with a
> return code or value.  for example, the following when called by
> another program will return a 0
> 
>   #!/usr/bin/perl
>   $ret=0;
>   exit $ret;
> 
> if conditions are not met, you can pass a "failure" notice to the
> calling program depending on the value returned.
> 
> would like to do the same with the php script, but it returns the
> variable prior to exiting (ie printing it to the screen) rather than
> passing it back
> 
> Dave
> 
> 
> >-Original Message-
> >From: Miles Thompson [mailto:[EMAIL PROTECTED]]
> >Sent: Thursday, May 10, 2001 4:16 PM
> >To: Dave VanAuken
> >Subject: RE: [PHP-DB] exit code generation, php shell
> >script/standalone
> >
> >
> >Dave,
> >
> >I'm just free associating here, so these suggestions may be
> >worthless:
> >
> >If you are calling the PHP script as a CGI program does it
> >return different
> >values if you cause it to "die" or "exit" vs. successful
> >completion? I'm
> >not talking about the die message.
> >
> >If you are calling it from within the web browser (sic.) use
> >phpinfo() to
> >see if any http_vars would serve. (Or if IIS, whatever the
> >equivalents are.)
> >
> >Maybe you could fake this with a header() call.
> >
> >Miles
> >
> >
> >At 03:06 PM 5/10/01 -0400, you wrote:
> >>did try it,  no go.  Tried a number of permutations, but it doesn't
> >>seem to want to actually return the exit code...  just prints it to
> >>the screen (in terminal mode) which is pretty and all, but
> >not what I
> >>need :)
> >>
> >>just wondering is a solution exists and i just can't see the forest
> >>for the trees.
> >>
> >>Dave
> >>
> >> >-Original Message-
> >> >From: Miles Thompson
> >> >
> >> >Dave,
> >> >
> >> >You can return a value from a function ...
> >> >
> >> >function dosomething( para1, para2 )
> >> >{
> >> >code here
> >> >which depending on success or failure sets $reflag to 0 or 1
> >> >return $retflag;
> >> >}
> >> >
> >> >So now the question is "Can we return a value from a
> >> >script?" Hell, I don't
> >> >know, why not just try it?
> >> >My gut feeling is that it would go to the browser, not to
> >> >the calling program.
> >> >Interesting question.
> >> >
> >> >Cheers - Miles
> >> >
> >> >http:/www.php.net
> >> >At 02:26 PM 5/10/01 -0400, Dave wrote:
> >> >>to tie in web based scripts and database updates with some
> >> >server side
> >> >>authentication issues, we need to have a PHP script be
> >called from
> >> >>another program.  The program expects a return or exit
> >value to be
> >> >>transmitted back on completion or termination of the script.  0
> >> >>indicating success and anything else indicating failure
> >> >>
> >> >>PHP has exit() and die() which, all though you can place a
> >> >variable or
> >> >>string in
> >> >>it, only prints it to the screen (or other output
> >target) prior to
> >> >>killing itself, and does not send an exit code as would a
> >> >perl script
> >> >>
> >> >>is there any way to generate a exit code on the
> >completion of a php
> >> >>script that will be  interpreted by the program or CGI
> >calling the
> >> >>script, even if it is code to wrap the PHP script in yet
> >> >another perl
> >> >>shell.  We need to send some var

Re: [PHP-DB] Date display problem

2001-05-14 Thread Russ Michell

> How do I display the time and date on my message board depending on
> the time of the place from where the data is entered.Everytime the
> date that is displayed is not what it was when the message was posted.

If you mean what I think you mean then you can use a TIMESTAMP 
fieldtype on the row where the date lies in your table. A 
MySQL TIMESATMP comes in the mmdd hh:mm:ss formate, and changes 
whenever that field ia altered or updated.

Hope that is what you needed!
Russ

On Sat, 12 May 2001 18:27:36 + vipin chandran 
<[EMAIL PROTECTED]> wrote:

> Hi,
> How do I display the time and date on my message board depending on
> the time of the place from where the data is entered.Everytime the
> date that is displayed is not what it was when the message was posted.
> 
> thanx,
> 
> vipin chandran
> [EMAIL PROTECTED]
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#
    
  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] variable vaule lost

2001-05-14 Thread Russ Michell

Maybe this is what you wanted:

");
$i=10;
for ($j=0;$j<3;$j++){
echo $j;
echo("");
}
echo("");
echo("");
echo("");
?>

The value of '$i' can now be picked up by calling it from the new var: 
'passvar'

HTH :)

Russ

 how The variable being passed will be seen in the next form? 
On Fri, 11 May 2001 01:55:42 +0530 Sharmad Naik 
<[EMAIL PROTECTED]> wrote:

> pls look at the attachment
> -- 
> The secret of the universe is @*&í!'ñ^#+ NO CARRIER
> ___  _  _  _
> |_|_||_||_||\/||_|| \
> _|| || || \|  || ||_/

#-------#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] INSERT statement

2001-05-21 Thread Russ Michell

I don't use PostgresSQL, but the SQL can't be that different:

INSERT INTO table (column2,column4) VALUES ('$x','$y') WHERE column1 = 
'$z' 

//Loose the brackets after the WHERE clause, and add single quotes 
//around your variable.
Russ

INSERT INTO table (column2,column4) VALUES ('$x','$y') WHERE (column1 = 
$z)  Php shows:
On Mon, 21 May 2001 10:54:05 +0200 Bartek Pawlik 
<[EMAIL PROTECTED]> wrote:

> Hi,
> I have problem with INSERT statement in PostgresSQL v.7.0.3.
> In one script I insert values in column1,column3,column5.
> Later I want to fill column2 and column4.
> I use
> INSERT INTO table (column2,column4) VALUES ('$x','$y') WHERE (column1 = 
> $z)  Php shows:
> 
> Warning: PostgreSQL query failed: ERROR: parser: parse error at or near 
> "where" in file.php on line x
> 
> 
> Thanks in advance
> 
> Bartek Pawlik
> Poland
> 
> 
> 
> 
> 
> -- 
> 26 maja - Dzieñ Matki. Wygraj kwiaty dla swojej Mamy!
> Do rozdania 75 bukietów z dostaw± i ¿yczeniami.
> [ http://zakupy.onet.pl/prezenty.asp?k=7 ]

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




[PHP-DB] checking mechanism

2001-05-22 Thread Russ Michell

Hi all:

I have a simple checking mechanism:

$num = mysql_num_rows($result);
if($num == 0) {
$display_news = "Sorry, no news items.";
}
else {
while(this, that and the other) {
}
}

What's the difference between:
if($num == 0) {
$display_news = "Sorry, no news items.";
}
//and:

if($num != 1) {
$display_news = "Sorry, no news items.";
}

As I seem to remember the former working fine...now I have to switch to 
the latter???

Cheers.
Russ

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




[PHP-DB] web to access/excel

2001-05-22 Thread Russ Michell

*Apologies for cross-postings**

Hi there all:

Does anyone know of a product - preferably free, that once 
installed, can take info from an ordinary HTML web based form and 
drop it into an access/excel database/spreadsheet?? or a 
pre-defined/written script or class written for Apache/php4/MySQL that 
has the information filtering and sorting capabilites of excel/access??

One of our departments urgently requires such functionality to increase 
processing times of student enquiries. At present the information from 
the students is in a non-standardised format in the form of an email 
that has to be processed by hand.

The data needs to be formalised from a structured online form, and 
inserted into an access/excel type 'environment' that current 
(non-web technical) administrators are familliar with.

Any suggestions are most welcome.

Again I apologise for the cross posting but this is a pressing matter, 
that requires I find a pointer to a solution, or an actual solution 
as fast as I can!

Kind regards:
Russ



#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] Help With Getting Values Please!

2001-05-24 Thread Russ Michell

mysql_result() is used when you know the row number of the item you 
want to retrive from your table.

mysql_query() is used to get all results from a query, so you can loop 
thru an array of them or something.

Russ

On Wed, 23 May 2001 18:47:22 +0200 Johannes Janson 
<[EMAIL PROTECTED]> wrote:

> Hi,
> 
> >$sql2 = "SELECT ServiceDes FROM ServiceTypes WHERE ServiceID = 
> $serviceid";
> 
> put single quotes around $serviceid.
> 
> >$service_type = mysql_result($sql2, 1);
> 
> I might be perpetuating the spreading of rumors but I've heard and read
> somewhere
> that mysql_query() is supposed to be better in the performance. Perhaps
> someone
> else could clear this point for me thus stopping the rumors.
> 
> Cheers
> Johannes
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#-------#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] mssql_fetch_array problem

2001-06-20 Thread Russ Michell

Ok lets start from the beginning, apologies if this these have been 
mentioned previousely I haven't seent the rest of the thread:

* Make sure 'countryid' is spelled the same in your script as it is in 
  your DB table (I've done this and spent hours banging my head against 
  a brick wall) 
* Ensure they both have the same case.
* Ensure 'countryid' actually contains a value in the DB by looking 
  it up via the command line or your GUI.

These may sound trivial but think about it, why should some values 
return when another does not? What are the differences between the 
datatypes that are and are not returned? Compare them and try altering 
the differences you find to see what happens.

Good luck!
Russ


On Wed, 20 Jun 2001 13:17:23 +0800 Jennifer Arcino Demeterio 
<[EMAIL PROTECTED]> wrote:

> Thanks for all your answers, but, they still seem not to work.  In my 
> query, the value of countryname is retrieved as expected but the value 
> of countryid is not.  There seems to be no value retrieved for 
> countryid.  I am using PHP4 on IIS4 on an NT machine with SQL Server 7 
> as the database. "countryname" is of type varchar while "countryid" is 
> type int, indentity, auto_increment.  I tried listing them by printing 
> the resultset but countryid still does not have any value.  This could 
> be a quirk that some of you experienced and I sure would like to hear 
> how you overcame this.
> 
> Thanks.
> 
> I am posting again the code snippet below:
> 
>  $country_sql = "select countryname, countryid from TBL_COUNTRY";
> if ($country_query = mssql_query($country_sql)) {
>while ($myrow = mssql_fetch_array($country_query)) {
>  $countryid = $myrow["countryid"];
>  $countryname = $myrow["countryname"];
>  print "countryid is " . $countryid . " ,countryname is " .
> $countryname . "";
>  }
> }
> ?>
> 
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] flush privileges

2001-06-21 Thread Russ Michell

>   what kind of privileges i should have if i want to run
>   'flush privileges' ?

You need to be the MySQL superuser, this is the user who has permission 
to grant privileges to other users and set them up as such. You use 
'flush privileges' when you want to instruct MySQL to 'refresh' it's 
'mysql' table data AFTER you have set up a user. If you have been able 
to connect to MySQL from the command line or phpMyAdmin and 
successfully enabled a new user (Without SQL errors) then you should be 
able to issue 'flush privileges'.

I honestly cant remember how I set it all up originally, but you 
could go try: www.mysql.com/doc/P/r/Privileges.html and see if that 
helps.

Cheers
Russ

On Wed, 20 Jun 2001 22:38:20 +0700 andRie Is <[EMAIL PROTECTED]> 
wrote:

> Hello php-db,
> 
>   what kind of privileges i should have if i want to run
>   'flush privileges' ?
> 
>  ,,,   
> (@-@)   
> +==---o00(_)00o-==+
> 
> "It is better to be defeated on principle than to win on lies."
> --Arthur Calwell
> -- 
> Best regards,
>  andRie 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] Date field

2001-06-21 Thread Russ Michell

> Hi,
> Can someone tell me how do stote date field in MySQL DB ?
This is the dump from my phpMyAdmin: use this SQL from the command 
line and adapt it for your own needs:

# Table structure for table 'item'
#

CREATE TABLE item (
   id smallint(4) DEFAULT '0' NOT NULL auto_increment,
   name varchar(25) NOT NULL,
   dept varchar(25) NOT NULL,
   abstract mediumblob NOT NULL,
   submitDate datetime DEFAULT '-00-00 00:00:00' NOT NULL, // The 
//bit you need
   scale varchar(7) NOT NULL,
   PRIMARY KEY (id),
   UNIQUE id (id)
);

HTH !!
Russ

On Wed, 20 Jun 2001 18:27:42 +0300 Rosen <[EMAIL PROTECTED]> wrote:

> Hi,
> Can someone tell me how do stote date field in MySQL DB ?
> 
> Thanks,
> Rosen M.
> 
> 
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#
        
  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] concatenation

2001-06-21 Thread Russ Michell

U I might be missing something but isn't it something like:

$emailVal = "mailto:"; . $email . "\">" .  $email . "";

HTH :-)

Russ

On Thu, 21 Jun 2001 00:05:46 -0500 DanielW <[EMAIL PROTECTED]> wrote:

> Greetings.
> 
> Can anyone tell me how to concatenate text to the value of a cell 
> pulled out of a table in a while loop? I'm trying to add "mailto:"; to 
> an email address value.
> 
> Thanks,
> 
> Dan
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#-------#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] 1 is not a valid PostgreSQL link resource

2001-06-22 Thread Russ Michell

> someone friend say me that rebuild source code php 4.0.4 , is true
I don't think you need to do anything as drastic as that!
I generally receive this error message if mysql_connect() (similar to 
other _connect() functions) isn't given the right number of 
arguments.

Send the offending code to the list and I'll see if I can help out.

Russ

On Thu, 21 Jun 2001 12:03:26 -0500 Carlos Estala 
<[EMAIL PROTECTED]> wrote:

> ! Hi ¡
> i have redhat 7.1 and php 4.0.4 but i have a problem with conections
> becose send me this messages  "1 is not a valid PostgreSQL link
> resource", how i cant fix this problem
> 
> someone friend say me that rebuild source code php 4.0.4 , is true
> 
> o someone have a solution
> 
> Thanks :::
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#
        
  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] MySQL connection: Change on syntaxis?

2001-06-22 Thread Russ Michell

> Is this a new use of the function mysql_num_rows?
No!

You can use the @ to 'suppress error messages' that may reveal 
delicate information to users such as paths to directories on your 
server. It can be preppended to almost any php function likely to 
result in an error, if used incorrectly.

Russ

On Thu, 21 Jun 2001 23:30:03 +0200 Tom=?ISO-8859-1?B?4XMgR2FyY+0=?=a 
Ferrari <[EMAIL PROTECTED]> wrote:

> Hello,
> 
> I updated php to version 4.0.5 and MySQL to version 2.32.39, had errors 
> on lines like this:
> 
> $rows = mysql_num_rows($result);
> 
> and noticed that this is a solution:
> 
> $rows = @mysql_num_rows($result);
> 
> Is this a new use of the function mysql_num_rows?
> 
> +-- --+
>Tomás García FerrariBigital
>http://bigital.com/ +-- 
> --+
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#-------#
    
  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




[PHP-DB] this is a test

2001-07-02 Thread Russ Michell

this is a test, to see if I have REALLY been unsubscribed.



#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] blinking background

2001-08-09 Thread Russ Michell

> is there anyone who can give me an idea on how i can write a php script 
> that can make my table row background blinking.

Why on earth would you want to do that?? It would fully distract anyone 
looking at the information within the table - which I *presume* is why 
you want information in the table right? For people to look at and 
assimilate!?

I'm aware of the concept "A bad idea - but help out the person anyhow" 
but this one is just silly!

Russ

On Thu, 9 Aug 2001 17:53:23 +0800 J- E- N <[EMAIL PROTECTED]> wrote:

> hello!
> 
> is there anyone who can give me an idea on how i can write a php script 
> that can make my table row background blinking.
> 
> thanks :)
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#
        
  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] blinking background

2001-08-09 Thread Russ Michell

>Heh, there's a reason the  tag has been depreciated...  
>Actually I tried finding it in the newest version of HTML and can't 
>even find it there anymore :-)

That's cos it was a Nutscrape proprietry tag

Russ

Date: Thu, 9 Aug 2001 09:47:59 -0600
From: John Pickett <[EMAIL PROTECTED]>
Subject: Re: [PHP-DB] blinking background
Sender: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]

Reply-To: John Pickett <[EMAIL PROTECTED]>
Message-ID: <006f01c120ea$aac52f10$4c6146a6@notebook>


Heh, there's a reason the  tag has been depreciated...  Actually 
I tried finding it in the newest version of HTML and can't even find it 
there anymore :-)

My 2 ¢
John Pickett http://www.bvstudios.com/
Co-Author:  Inside Dreamweaver 
4 http://www.amazon.com/exec/obidos/ASIN/0735710848/xtremist

- Original Message -
From: "speedboy" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>
Sent: Thursday, August 09, 2001 6:19 AM Subject: Re: [PHP-DB] blinking 
background


> > Fergawdsake -- WHY?!!
> >
> > Irritating, annoying, amateurish -- go read Jakob Nielsen on 
usability. > >
> > Here's an alternate suggestion: A contrasting colour for the row you
wish > > to highlight, keeping in mind that some people are colour 
blind. >
> 1. You can create an animated gif with the an asterisk * that flashes 
on > and off light a light bulb (slowly).
> > 2. Or just use the asterisk to denote a certain requirement on a 
form or > to alert the user to some area of the page.
> > 3. Even changing the color of the text to red will alert the user.
> > Goodluck and please post to the correct list next time, this has 
nothing > to do with a database or php for that matter. :)
> >
> > --
> PHP Database Mailing List (http://www.php.net/) > To unsubscribe, 
e-mail: [EMAIL PROTECTED] > For additional commands, 
e-mail: [EMAIL PROTECTED] > To contact the list administrators, 
e-mail: [EMAIL PROTECTED] >
>


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

--- End Forwarded Message ---


#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] Anyone used Pearson Corilations in PHP

2001-08-14 Thread Russ Michell

I'm not sure what the hell a "Pearson Corilation" is but it sounds 
statistical, so using Excel/Access should do the trick.

Use MyODBC from mysql.com to connect your local copy of access to your 
remote MySQL database. You can then export fron Access to Excel and do 
all sorts of analyses on your MySQL data.

HTH :-)

Russ

On Mon, 13 Aug 2001 18:31:48 + Robert Trembath 
<[EMAIL PROTECTED]> wrote:

> Good Afternoon Everyone,
> 
> I am a fellow PHP developer that has run into a project where I need to 
> know if anyone has created anything like this.
> 
> I need to do Pearson Corilations on Data from MySQL to do a top 10 
> match that compares DNA numerical image data(grayscale(0-255) and 
> creates an image based on that image data for each row of image data.
> 
> Anyone done this before? Anything similar? Any comment are appreciated.
> 
> Thanks,
> Robert -
> --- Robert Trembath
> [EMAIL PROTECTED]
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#
    
  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




[PHP-DB] internal queries

2001-08-14 Thread Russ Michell

Hi crew:

I want to delete material from a database if it is older than say one 
month since its insertion. However I don't want to have to run a 
cron-job or something, as there must exist a way for a script to 
execute itself periodically or to have the MySQL database tell *itself* 
to execute a specific SQL query periodically.

I've heard it is possible to 'sink' a query into an Oracle DB itself 
instead of running something like a cron-job, so I'd like to hear from 
anyone who may have done this for MySQL or knows of an alternative 
method I can achieve my goal.

Many thnaks to you all in advance.
Russ


#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




[PHP-DB] Re: reload page

2001-08-14 Thread Russ Michell

I just needed a similar thing to occur in my app!
Just reload the page using the header function:

Once submit has been hit in one frame, pass a hidden value from Frame1 
to frame2:



Then detect for it in the 2nd frame and refresh the page using the 
header() function:

if (isset($refresh)) {
header("Location: $PHP_SELF");
}

HTH :-)

Russ


On Tue, 14 Aug 2001 10:54:59 -0400 Hugh Bothwell 
<[EMAIL PROTECTED]> wrote:

> 
> "Schleipp" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi everybody,
> > I have created a webpage with two frames. One of this frames is a form
> > in which the user can change some data, which you can see in the other
> > frame. I want the latter frame being updated as soon as I send the 
> form, > which is changing the data, i.e. a "reload" of the frame 
> containing the > changed data. However, I do not know how to realize 
> that with PHP. Does > anybody have a suggestion?
> 
> 
> ... 
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#-------#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] Re: reload page

2001-08-14 Thread Russ Michell

> I don't see what this gains you.
Well you asked if there was a way to refresh your target frame once a 
submission was made from an origin frame. This method would do that. 

Then again, why does the second frame not already display the results 
of the submission?? As it get's called from the first (origin) frame.

Maybe you should re-state your problem and indicate use of DB's in 
there too, as I may easily have got the wrong end of someone else's 
stick.

Cheers.
Russ


On Tue, 14 Aug 2001 11:09:28 -0400 Hugh Bothwell 
<[EMAIL PROTECTED]> wrote:

> "Russ Michell" <[EMAIL PROTECTED]> wrote in message
> news:SIMEON.10108141609.F@k1c. anglia.ac.uk...
> > I just needed a similar thing to occur in my app!
> > Just reload the page using the header function:
> >
> > Once submit has been hit in one frame, pass a hidden value from Frame1
> > to frame2:
> >
> > 
> >
> > Then detect for it in the 2nd frame and refresh the page using the
> > header() function:
> >
> > if (isset($refresh)) {
> > header("Location: $PHP_SELF");
> > }
> 
> That seems like an (umm...) *unusual* method...
> 
> When the form is submitted, it calls the target
> page - which then calls itself again?
> 
> I don't see what this gains you.
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: RE: [PHP-DB] Averaging Numbers

2001-08-15 Thread Russ Michell

> I have a cron job that runs on a Unix server that runs a PHP file that
> gets a number from a Web site and inserts it into the database.
> Jeff Oien

Oh nuts! I thought there may be some way for a script to tell itself to 
re-run over X-period of time or even have some kind of stored procedure 
for MySQL like Oracle..

Oh well.
Cheers anyway!

Russ

On Wed, 15 Aug 2001 11:50:43 -0500 Jeff Oien <[EMAIL PROTECTED]> 
wrote:

> > I'm real sorry to say I don't know the answer to your question unless 
> > there's a php function to get an average (or write one yourself) but 
> > you say you've managed to get a script/process to run in conjunction 
> > with your database every half an hour...how do you do this!? I've 
> been > wanting something like this for months.
> > > Cheers (and apologies!)
> > Russ
> 
> I have a cron job that runs on a Unix server that runs a PHP file that
> gets a number from a Web site and inserts it into the database.
> Jeff Oien
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#-------#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




[PHP-DB] Removal of HTML formating

2001-08-16 Thread Russ Michell

Use n12br() with the output from your DB to your webpage:

$content = n12br($content);
echo $content;


HTH :-)

Russ

On Thu, 16 Aug 2001 09:02:44 -0500 John Roach <[EMAIL PROTECTED]> wrote:

> 
> 
> -- Hello,
> 
> I have a mysql db with a largetext field defined. When users enter 
> data, it drops all of the blank lines, so paragraghs run together. Is 
> there a way to display the output with out it being formated in html? 
> It works fine if you insert  for each blank line. It of course 
> drops any indents or centering. I would like to maintain any user 
> formating without them entering html tags.
> 
> Thanks,
> 
> John
> 
> 
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#
        
  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




[PHP-DB] Query construction

2001-08-21 Thread Russ Michell

Hi there people:

I have a MySQL table consisting of category names among other things. 
I would like to be able to construct a query that tells me the number of times a 
unique category 
name occurs in the table:

//Table 'posts' from command-line
mysql> explain posts;
+--+-+--+-+++
| Field| Type| Null | Key | Default| Extra  |
+--+-+--+-+++
| id   | tinyint(3)  |  | PRI | 0  | auto_increment |
| category | varchar(25) |  | |||
| user | varchar(12) |  | |||
| dateFrom | date|  | | -00-00 ||
| dateTo   | date|  | | -00-00 ||
| title| varchar(25) |  | |||
| body | text|  | | NULL   ||
+--+-+--+-+++
7 rows in set (0.00 sec)

//Table 'posts' in phpMyAdmin tab
id category  userdateFromdateTo  titlebody 
3  some stuffmaurice 2001-09-23  2001-11-05  Maurcie's post   this is 
Maurice's test
4  russ category russmichell 2001-08-17  2001-08-27  Russ is theone   this is another 
test
9  russ category russmichell 2001-08-16  2001-08-19  Begon by Monday! This entry 
should dissapear
10 russ category russmichell 2001-08-16  2001-09-04  testing  This is another 
test!

For example I would like to know how many posts there are in the category 'russ 
category' (Should 
tell me there are 3 and only 1 for 'some stuff' ...

Can anyone help me toward a nice SQL query that would to this for me!?
Cheers all.

Russ

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




[PHP-DB] Re: Query construction

2001-08-21 Thread Russ Michell

Steve:

I tried your method which is pretty much what I was trying already, but got the 
following error 
message:

MySQL Error Info
1064: You have an error in your SQL syntax near 'distinct(category)) AS total FROM 
posts' at line 1

I am using MySQL 3.22.32 (Quite an oldish version - not sure if it allows the embedded 
'distinct' 
clause within 'count()'...)

Any advance in this...??!
Many thnaks for your efforts so far..

Cheers.
Russ

 
On Tue, 21 Aug 2001 11:51:29 +0100 Steve Brett <[EMAIL PROTECTED]> wrote:

> select count(distinct(category)) as number_of_posts from posts;
> 
> should do it.
> 
> Steve
> 
> "Russ Michell" <[EMAIL PROTECTED]> wrote in message
> news:SIMEON.10108211219.F@k1c. anglia.ac.uk...
> > Hi there people:
> >
> > I have a MySQL table consisting of category names among other things.
> > I would like to be able to construct a query that tells me the number of
> times a unique category
> > name occurs in the table:
> >
> > file://Table 'posts' from command-line
> > mysql> explain posts;
> > +--+-+--+-+++
> > | Field| Type| Null | Key | Default| Extra  |
> > +--+-+--+-+++
> > | id   | tinyint(3)  |  | PRI | 0  | auto_increment |
> > | category | varchar(25) |  | |||
> > | user | varchar(12) |  | |||
> > | dateFrom | date|  | | -00-00 ||
> > | dateTo   | date|  | | -00-00 ||
> > | title| varchar(25) |  | |||
> > | body | text|  | | NULL   ||
> > +--+-+--+-+++
> > 7 rows in set (0.00 sec)
> >
> > file://Table 'posts' in phpMyAdmin tab
> > id category  userdateFromdateTo  titlebody
> > 3  some stuffmaurice 2001-09-23  2001-11-05  Maurcie's post   this
> is Maurice's test
> > 4  russ category russmichell 2001-08-17  2001-08-27  Russ is theone   this
> is another test
> > 9  russ category russmichell 2001-08-16  2001-08-19  Begon by Monday! This
> entry should dissapear
> > 10 russ category russmichell 2001-08-16  2001-09-04  testing  This
> is another test!
> >
> > For example I would like to know how many posts there are in the category
> 'russ category' (Should
> > tell me there are 3 and only 1 for 'some stuff' ...
> >
> > Can anyone help me toward a nice SQL query that would to this for me!?
> > Cheers all.
> >
> > Russ
> >
> > #---#
> >
> >   "Believe nothing - consider everything"
> >
> >   Russ Michell
> >   Anglia Polytechnic University Webteam
> >
> >   e: [EMAIL PROTECTED]
> >   w: www.apu.ac.uk/webteam
> >   t: +44 (0)1223 363271 x 2331
> >
> >   www.theruss.com
> >
> > #---#
> >
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: RE: RE: [PHP-DB] Query construction

2001-08-21 Thread Russ Michell

Damn!!

That'll be it..

I'm running phpMyAdmin 2.1.0 , php.4.0.3pl1 and MySQL 3.22.32 
Then again I don't get an error message from your query..???

Perhaps it has to do with the query being embedded, that is *where* it's embedded:

$totalsql = "SELECT category,COUNT(*) FROM $Tpostings GROUP BY category";
$totalresult = mysql_query($totalsql,$connect) or error("Sorry! I was unable to 
process the 
required SQL transaction.");
while($totalrow = mysql_fetch_array($totalresult)) {
$total = $totalrow['category'];
}

//Results in:
'some stuff' being echoed to the page..

So I tried:
$totalsql = "SELECT category,COUNT(*) AS total FROM $Tpostings GROUP BY category";

//Resulted in '2' being echoed to the page (2 is the number of posts in the 'some 
stuff' category) 
but 2 is displayed as being the number of posts in *all* the categories which isn't 
the case...

What do you think? (It's my luchtime too and I'm gonna go get some...)
Cheers once agin for trying.

Russ

On Tue, 21 Aug 2001 12:19:00 +0100 Lunny Damian <[EMAIL PROTECTED]> wrote:

> Russ,
> 
> I recreated your table/data (it's lunchtime and I thought I'd take a look at
> this) - my query returned the rows as below:
> 
> --
>  category count (*) 
> Edit Delete  russ category   3  
> Edit Delete  some stuff  1  
> --
> 
> I'm running with phpMyAdmin 2.2.0rc3 on PHP Version 4.0.4pl1 (MySQL is
> 3.23.36) - perhaps the problem lies with the versions?
> 
> damian
> 
> > -Original Message-
> > From: Russ Michell [mailto:[EMAIL PROTECTED]]
> > Sent: 21 August 2001 12:46
> > To: Lunny Damian
> > Subject: Re: RE: [PHP-DB] Query construction
> > 
> > 
> > Damian:
> > 
> > Thanks for that but it doesn't do what I wanted though. It 
> > actually returns the first item ('some 
> > stuff') from the table, where I wanted the total number of 
> > occurances of *each category* in the 
> > table, thus indicating the number of posts for each category 
> > in the 'posts' table.
> > 
> > !
> > 
> > Many thanks.
> > Russ
> > 
> > 
> > On Tue, 21 Aug 2001 11:23:35 +0100 Lunny Damian 
> > <[EMAIL PROTECTED]> wrote:
> > 
> > > Russ,
> > > 
> > > This should work for you:
> > > 
> > > -
> > > select category,count(*)
> > > from posts
> > > group by category;
> > > -
> > > 
> > > All the best,
> > > 
> > > damian
> > > 
> > > 
> > > > -Original Message-
> > > > From: Russ Michell [mailto:[EMAIL PROTECTED]]
> > > > Sent: 21 August 2001 12:10
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [PHP-DB] Query construction
> > > > 
> > > > 
> > > > Hi there people:
> > > > 
> > > > I have a MySQL table consisting of category names among 
> > other things. 
> > > > I would like to be able to construct a query that tells me 
> > > > the number of times a unique category 
> > > > name occurs in the table:
> > > > 
> > > > //Table 'posts' from command-line
> > > > mysql> explain posts;
> > > > 
> > +--+-+--+-+++
> > > > | Field| Type| Null | Key | Default| 
> > Extra  |
> > > > 
> > +--+-+--+-+++
> > > > | id   | tinyint(3)  |  | PRI | 0  | 
> > auto_increment |
> > > > | category | varchar(25) |  | ||  
> >   |
> > > > | user | varchar(12) |  | ||  
> >   |
> > > > | dateFrom | date|  | | -00-00 |  
> >   |
> > > > | dateTo   | date|  | | -00-00 |  
> >   |
> > > > | title| varchar(25) |  | ||  
> >   |
> > > > | body | text|  | | NULL   |  
> >   |
> > > > 
> > +--+-+--+-+++
> > > > 7 rows in set (0.00 sec)
> > > > 
> > > > //Table 'posts' in phpMyAdmin tab
> > > > id category  userdateFromdateTo  title
> > > >     body 

Re: RE: RE: RE: [PHP-DB] Query construction

2001-08-21 Thread Russ Michell

> I always love that feeling when you beat a problem that refuses to go away.
So do I - but I aint beaten it yet! :-(

I'm still getting '2' as being the number of posts in each category when '2' is 
actually only the 
number of posts in *one* of the categories...weird-huh?

Cheers.

Russ

On Tue, 21 Aug 2001 12:46:37 +0100 Lunny Damian <[EMAIL PROTECTED]> wrote:

> I always love that feeling when you beat a problem that refuses to go away.
> 
> Enjoy your lunch!
> 
> damian
> 
> > -Original Message-
> > From: Russ Michell [mailto:[EMAIL PROTECTED]]
> > Sent: 21 August 2001 13:23
> > To: Lunny Damian
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: RE: RE: [PHP-DB] Query construction
> > 
> > 
> > Damn!!
> > 
> > That'll be it..
> > 
> > I'm running phpMyAdmin 2.1.0 , php.4.0.3pl1 and MySQL 3.22.32 
> > Then again I don't get an error message from your query..???
> > 
> > Perhaps it has to do with the query being embedded, that is 
> > *where* it's embedded:
> > 
> > $totalsql = "SELECT category,COUNT(*) FROM $Tpostings GROUP 
> > BY category";
> > $totalresult = mysql_query($totalsql,$connect) or 
> > error("Sorry! I was unable to process the 
> > required SQL transaction.");
> > while($totalrow = mysql_fetch_array($totalresult)) {
> > $total = $totalrow['category'];
> > }
> > 
> > //Results in:
> > 'some stuff' being echoed to the page..
> > 
> > So I tried:
> > $totalsql = "SELECT category,COUNT(*) AS total FROM 
> > $Tpostings GROUP BY category";
> > 
> > //Resulted in '2' being echoed to the page (2 is the number 
> > of posts in the 'some stuff' category) 
> > but 2 is displayed as being the number of posts in *all* the 
> > categories which isn't the case...
> > 
> > What do you think? (It's my luchtime too and I'm gonna go get some...)
> > Cheers once agin for trying.
> > 
> > Russ
> > 
> > On Tue, 21 Aug 2001 12:19:00 +0100 Lunny Damian 
> > <[EMAIL PROTECTED]> wrote:
> > 
> > > Russ,
> > > 
> > > I recreated your table/data (it's lunchtime and I thought 
> > I'd take a look at
> > > this) - my query returned the rows as below:
> > > 
> > > --
> > >  category count (*) 
> > > Edit Delete  russ category   3  
> > > Edit Delete  some stuff  1  
> > > --
> > > 
> > > I'm running with phpMyAdmin 2.2.0rc3 on PHP Version 
> > 4.0.4pl1 (MySQL is
> > > 3.23.36) - perhaps the problem lies with the versions?
> > > 
> > > damian
> > > 
> > > > -Original Message-
> > > > From: Russ Michell [mailto:[EMAIL PROTECTED]]
> > > > Sent: 21 August 2001 12:46
> > > > To: Lunny Damian
> > > > Subject: Re: RE: [PHP-DB] Query construction
> > > > 
> > > > 
> > > > Damian:
> > > > 
> > > > Thanks for that but it doesn't do what I wanted though. It 
> > > > actually returns the first item ('some 
> > > > stuff') from the table, where I wanted the total number of 
> > > > occurances of *each category* in the 

> > > > table, thus indicating the number of posts for each category 
> > > > in the 'posts' table.
> > > > 
> > > > !
> > > > 
> > > > Many thanks.
> > > > Russ
> > > > 
> > > > 
> > > > On Tue, 21 Aug 2001 11:23:35 +0100 Lunny Damian 
> > > > <[EMAIL PROTECTED]> wrote:
> > > > 
> > > > > Russ,
> > > > > 
> > > > > This should work for you:
> > > > > 
> > > > > -
> > > > > select category,count(*)
> > > > > from posts
> > > > > group by category;
> > > > > -
> > > > > 
> > > > > All the best,
> > > > > 
> > > > > damian
> > > > > 
> > > > > 
> > > > > > -Original Message-
> > > > > > From: Russ Michell [mailto:[EMAIL PROTECTED]]
> > > > > > Sent: 21 August 2001 12:10
> > > > > > To: [EMAIL PROTECTED]
> > > > > > Subject: [PHP-DB] Query construction
> > > > > > 
> &

RE: [PHP-DB] Query construction

2001-08-21 Thread Russ Michell

Okay I have it now!

while ($row = mysql_fetch_array($result)) {
$name = $row['name'];
$dc = $row['datecreated'];
$nameinurl = urlencode($name);

//Get total posts for each category

$totalsql = "SELECT COUNT(category) AS total FROM $Tpostings WHERE category='$name' 
GROUP BY 
category";
$totalresult = mysql_query($totalsql,$connect) or error("Sorry!");
$check2 = mysql_num_rows($totalresult);
if ($check2 == 0) {
$total = 0;
}
else {
while($totalrow = mysql_fetch_array($totalresult)) {
$total = $totalrow['total'];
}//end while
}//end else
}//end while

I used the WHERE clause on $name, which gives me the total postings for each category 
as a *name* 
as opposed simply to a *unique category*

Many thanks for all your efforts, it was those that led me to this solution!
Cheers.

Russ

On Tue, 21 Aug 2001 14:08:30 +0200 "Walter, Marcel" <[EMAIL PROTECTED]> wrote:

> What about this:
> select count(category), category from posts group by category
> 
> > -Original Message-
> > From:   Russ Michell [SMTP:[EMAIL PROTECTED]]
> > Sent:   Tuesday, August 21, 2001 14:44
> > To: Lunny Damian
> > Cc: [EMAIL PROTECTED]
> > Subject:Re: RE: RE: RE: [PHP-DB] Query construction
> > 
> > > I always love that feeling when you beat a problem that refuses to go
> > away.
> > So do I - but I aint beaten it yet! :-(
> > 
> > I'm still getting '2' as being the number of posts in each category when
> > '2' is actually only the 
> > number of posts in *one* of the categories...weird-huh?
> > 
> > Cheers.
> > 
> > Russ
> > 
> > On Tue, 21 Aug 2001 12:46:37 +0100 Lunny Damian <[EMAIL PROTECTED]>
> > wrote:
> > 
> > > I always love that feeling when you beat a problem that refuses to go
> > away.
> > > 
> > > Enjoy your lunch!
> > > 
> > > damian
> > > 
> > > > -Original Message-
> > > > From: Russ Michell [mailto:[EMAIL PROTECTED]]
> > > > Sent: 21 August 2001 13:23
> > > > To: Lunny Damian
> > > > Cc: [EMAIL PROTECTED]
> > > > Subject: Re: RE: RE: [PHP-DB] Query construction
> > > > 
> > > > 
> > > > Damn!!
> > > > 
> > > > That'll be it..
> > > > 
> > > > I'm running phpMyAdmin 2.1.0 , php.4.0.3pl1 and MySQL 3.22.32 
> > > > Then again I don't get an error message from your query..???
> > > > 
> > > > Perhaps it has to do with the query being embedded, that is 
> > > > *where* it's embedded:
> > > > 
> > > > $totalsql = "SELECT category,COUNT(*) FROM $Tpostings GROUP 
> > > > BY category";
> > > > $totalresult = mysql_query($totalsql,$connect) or 
> > > > error("Sorry! I was unable to process the 
> > > > required SQL transaction.");
> > > > while($totalrow = mysql_fetch_array($totalresult)) {
> > > > $total = $totalrow['category'];
> > > > }
> > > > 
> > > > //Results in:
> > > > 'some stuff' being echoed to the page..
> > > > 
> > > > So I tried:
> > > > $totalsql = "SELECT category,COUNT(*) AS total FROM 
> > > > $Tpostings GROUP BY category";
> > > > 
> > > > //Resulted in '2' being echoed to the page (2 is the number 
> > > > of posts in the 'some stuff' category) 
> > > > but 2 is displayed as being the number of posts in *all* the 
> > > > categories which isn't the case...
> > > > 
> > > > What do you think? (It's my luchtime too and I'm gonna go get some...)
> > > > Cheers once agin for trying.
> > > > 
> > > > Russ
> > > > 
> > > > On Tue, 21 Aug 2001 12:19:00 +0100 Lunny Damian 
> > > > <[EMAIL PROTECTED]> wrote:
> > > > 
> > > > > Russ,
> > > > > 
> > > > > I recreated your table/data (it's lunchtime and I thought 
> > > > I'd take a look at
> > > > > this) - my query returned the rows as below:
> > > > > 
> > > > > --
> > > > >  category count (*) 
> > > > > Edit Delete  russ category   3  
> > > > > Edit Delete  some stuff  1  
> > > &g

[PHP-DB] Query construction (again)

2001-08-22 Thread Russ Michell

Hey there folks - similar problem - different project!

I want to select some records for a period of 7days after their insert [dateFrom] date.
Last time I asked you guys for help I was helped toward the following solution:

$sql = "SELECT * FROM $Tpostings WHERE now()>=dateFrom AND now()http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Query construction (again)

2001-08-23 Thread Russ Michell

(Apologies for cross-postings here but I lost a php-db list members personal email 
address..)

I need a query that in English would read something like:

"Select all records from table: 'items' where each record is displayed for 7days after 
it's 
submission."

It was suggested I may have to modify the output of now() to match my MySQL DB 
'submitDate' field 
as in the query below:

$sql = "SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY) =
now()";

So I tried the following:

$sql = "SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY) = 
DATE_FORMAT(NOW(),'Y-M-D')";

MySQL didn't complain but nor did it print out all postings submitted in the last 
seven days which 
is what it is suppposed to be doing!

The 'submitDate' field is a MySQL DATE field and I'm using MySQL-3.22.32 if that's any 
use.
Why is the query not doing what it's told!!?


Cheers for your help thus far!
Russ

Depending on how the date is stored (date + time, or just date) 
On Wed, 22 Aug 2001 21:39:19 +0800 Gremlins Mailing List 
<[EMAIL PROTECTED]> wrote:

> - Original Message -
> From: Russ Michell <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, August 22, 2001 10:16 PM
> Subject: [PHP-DB] Query construction (again)
> 
> 
> > Hey there folks - similar problem - different project!
> >
> > I want to select some records for a period of 7days after their insert
> [dateFrom] date.
> > Last time I asked you guys for help I was helped toward the following
> solution:
> >
> > $sql = "SELECT * FROM $Tpostings WHERE now()>=dateFrom AND now() >
> > The problem in this new project is that the 'dateTo' field is not included
> in the DB. It is 7-days
> > after 'dateFrom'. So why does the following query not work:
> >
> > $sql = "SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7
> DAY)";
> > No error is received though...
> 
> There is no comparison in your WHERE clause. Try something like:
> 
> $sql = "SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY) =
> now()";
> 
> Depending on how the date is stored (date + time, or just date) you may have
> to modify the output of now() to match.
> 
> hth
> --
> Jason Wong
> Gremlins Associates
> www.gremlins.com.hk
> 
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: SV: [PHP-DB] Query construction (again)

2001-08-23 Thread Russ Michell

Thanks for that - but I just sorted it literally 10 seconds ago! I used:

$sql = "SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 8 DAY) > CURDATE()";

Something happens with using INTERVAL 7 DAY though, in that only 6 days worth of posts 
are 
displayed, so 8 will have to suffice!

Thanks very much!
Russ


On Thu, 23 Aug 2001 11:09:32 +0200 Torgil Zechel <[EMAIL PROTECTED]> wrote:

> This should work:
> 
> SELECT * FROM items WHERE TO_DAYS(NOW()) - TO_DAYS(submitDate) <= 7;
> 
> > -Ursprungligt meddelande-
> > Fran: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]For Russ Michell
> > Skickat: den 23 augusti 2001 11:46
> > Till: Gremlins Mailing List
> > Kopia: [EMAIL PROTECTED]
> > Amne: Re: [PHP-DB] Query construction (again)
> >
> >
> > (Apologies for cross-postings here but I lost a php-db list
> > members personal email address..)
> >
> > I need a query that in English would read something like:
> >
> > "Select all records from table: 'items' where each record is
> > displayed for 7days after it's
> > submission."
> >
> > It was suggested I may have to modify the output of now() to
> > match my MySQL DB 'submitDate' field
> > as in the query below:
> >
> > $sql = "SELECT * FROM $tabitem WHERE DATE_ADD(submitDate,
> > INTERVAL 7 DAY) =
> > now()";
> >
> > So I tried the following:
> >
> > $sql = "SELECT * FROM $tabitem WHERE DATE_ADD(submitDate,
> > INTERVAL 7 DAY) = DATE_FORMAT(NOW(),'Y-M-D')";
> >
> > MySQL didn't complain but nor did it print out all postings
> > submitted in the last seven days which
> > is what it is suppposed to be doing!
> >
> > The 'submitDate' field is a MySQL DATE field and I'm using
> > MySQL-3.22.32 if that's any use.
> > Why is the query not doing what it's told!!?
> >
> >
> > Cheers for your help thus far!
> > Russ
> >
> > Depending on how the date is stored (date + time, or just date)
> > On Wed, 22 Aug 2001 21:39:19 +0800 Gremlins Mailing List
> > <[EMAIL PROTECTED]> wrote:
> >
> > > - Original Message -
> > > From: Russ Michell <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Wednesday, August 22, 2001 10:16 PM
> > > Subject: [PHP-DB] Query construction (again)
> > >
> > >
> > > > Hey there folks - similar problem - different project!
> > > >
> > > > I want to select some records for a period of 7days after their insert
> > > [dateFrom] date.
> > > > Last time I asked you guys for help I was helped toward the following
> > > solution:
> > > >
> > > > $sql = "SELECT * FROM $Tpostings WHERE now()>=dateFrom AND
> > now() > > >
> > > > The problem in this new project is that the 'dateTo' field is
> > not included
> > > in the DB. It is 7-days
> > > > after 'dateFrom'. So why does the following query not work:
> > > >
> > > > $sql = "SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7
> > > DAY)";
> > > > No error is received though...
> > >
> > > There is no comparison in your WHERE clause. Try something like:
> > >
> > > $sql = "SELECT * FROM $tabitem WHERE DATE_ADD(submitDate,
> > INTERVAL 7 DAY) =
> > > now()";
> > >
> > > Depending on how the date is stored (date + time, or just date)
> > you may have
> > > to modify the output of now() to match.
> > >
> > > hth
> > > --
> > > Jason Wong
> > > Gremlins Associates
> > > www.gremlins.com.hk
> > >
> > >
> > >
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> > >
> >
> > #-------#
> >
> >   "Believe nothing - consider everything"
> >
> >   Russ Michell
> >   Anglia Polytechnic University Webteam
> >
> >   e: [EMAIL PROTECTED]
> >   w: www.apu.ac.uk/webteam
> >   t: +44 (0)1223 363271 x 2331
> >
> >   www.theruss.com
> >
> > #---#
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




[PHP-DB] Fatal error

2001-08-24 Thread Russ Michell

Hi there folks - this isn't *entirley* a DB question so I'm putting on my flack Jacket 
right now:

I keep getting this error and have never seen it before:
"Fatal error: Cannot redeclare parse_dir() in intranet/bin/includes/functions.php on 
line 47"

It gives me this error for every function I have (written). I know for a fact that 
this function 
('parse_dir') has only been declared once, so why is php lying to me!!?

Feel free *not to answer* instead of wasting your own time giving me jip for an off 
topic query.
Cheers

Russ

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: RE: [PHP-DB] Fatal error

2001-08-24 Thread Russ Michell

>Try to include your files with the command include_once() ... and not
>include() ...

Well Br me! Cheers..
That did the job...

I thank you sir!
Cheers

Russ

On Fri, 24 Aug 2001 13:04:15 +0200 "Walter, Marcel" <[EMAIL PROTECTED]> wrote:

> Try to include your files with the command include_once() ... and not
> include() ...
> Maybe this solves your problem... because you ARE trying to declare
> a function which is already declared ...
> 
> > -Original Message-
> > From:   Russ Michell [SMTP:[EMAIL PROTECTED]]
> > Sent:   Friday, August 24, 2001 13:48
> > To: [EMAIL PROTECTED]
> > Subject:[PHP-DB] Fatal error
> > 
> > Hi there folks - this isn't *entirley* a DB question so I'm putting on my
> > flack Jacket right now:
> > 
> > I keep getting this error and have never seen it before:
> > "Fatal error: Cannot redeclare parse_dir() in
> > intranet/bin/includes/functions.php on line 47"
> > 
> > It gives me this error for every function I have (written). I know for a
> > fact that this function 
> > ('parse_dir') has only been declared once, so why is php lying to me!!?
> > 
> > Feel free *not to answer* instead of wasting your own time giving me jip
> > for an off topic query.
> > Cheers
> > 
> > Russ
> > 
> > #---#
> > 
> >   "Believe nothing - consider everything"   
> >   
> >   Russ Michell
> >   Anglia Polytechnic University Webteam
> >   
> >   e: [EMAIL PROTECTED]
> >   w: www.apu.ac.uk/webteam
> >   t: +44 (0)1223 363271 x 2331
> > 
> >   www.theruss.com
> > 
> > #---#
> > 
> > 
> > -- 
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] How to show table???

2001-08-24 Thread Russ Michell

Hmmm try something like:

"$sql = "EXPLAIN dbame.table_name";

This will show something like:

+---+-+--+-+-++
| Field | Type| Null | Key | Default | Extra  |
+---+-+--+-+-++
| id| smallint(3) |  | PRI | 0   | auto_increment |
| firstName | varchar(30) |  | | ||
| lastName  | varchar(30) |  | | ||
| email | varchar(30) |  | | ||
| username  | varchar(12) |  | | ||
| password  | varchar(12) |  | | ||
+---+-+--+-+-++
6 rows in set (0.00 sec)

I hope this is what you wanted, can't think why though...

Russ

On Fri, 24 Aug 2001 11:09:06 -0400 kelvin <[EMAIL PROTECTED]> wrote:

> Hi there,
> 
> I just wonder how to list all the table when using PHP script.
> I know how to call when I in linux system. (show table) or (mysqlshow
> db_name)
> 
> But don't know how to do it in PHP Please Help...
> 
> Many Thanks.
> kelvin.
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#
        
  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] Password Question

2001-08-31 Thread Russ Michell

Have a registration screen that inserts their names, email etc *and* their choice of 
username + 
password:

$sql = "INSERT INTO  (username,realname,password,email) VALUES 
('$username',$realname',password('$password'),'$email')";
$result = mysql_query($sql,$connect);

//and do a check if the username chosen exists already:

$chksql = "SELECT username FROM  WHERE username='$username'";
$chkresult = mysql_query($chksql,$connect);
$check = mysql_num_rows($chkresult);
if ($check == 0)
echo "this username already exists, select another.";
}
else {
echo "continue!";
}

if they have fogotton their password after registering, then have a link that sets a 
variable, and 
check or this variable at the top of the page:

go here to retrieve lost password

if '$id' is set then have the user input their password and email address (the one 
they registered 
with) and query the database for a username on the basis of the inputted info, and 
email it using 
mail() to that email address!

Use the same method for a lost username, they can then input their password and email 
and the 
system will mail them the lost details!

Good luck!
Russ

On Fri, 31 Aug 2001 10:38:53 -0500 Jeff Oien <[EMAIL PROTECTED]> wrote:

> I would like users to be able to request to have their password
> sent to their email address if they forget it. I would also like it
> encrypted in the database though. How is this best handled?
> 
> The security isn't real important. But I let users choose their
> own password and if they use a password they use for other
> things I think it would be best for it to be encrypted.
> Jeff Oien
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  Room 1C 'The Eastings' East Road, Cambridge
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: [PHP-DB] Password Question

2001-08-31 Thread Russ Michell

Sorry it should have read:

if ($check != 0)
echo "this username already exists, select another.";
}
else {
echo "continue!";
}

Cheers.
Russ

On Fri, 31 Aug 2001 17:43:59 +0100 (GMT Daylight Time) Russ Michell 
<[EMAIL PROTECTED]> wrote:

> Have a registration screen that inserts their names, email etc *and* their choice of 
>username + 
> password:
> 
> $sql = "INSERT INTO  (username,realname,password,email) VALUES 
> ('$username',$realname',password('$password'),'$email')";
> $result = mysql_query($sql,$connect);
> 
> //and do a check if the username chosen exists already:
> 
> $chksql = "SELECT username FROM  WHERE username='$username'";
> $chkresult = mysql_query($chksql,$connect);
> $check = mysql_num_rows($chkresult);
> if ($check == 0)
>   echo "this username already exists, select another.";
>   }
> else {
>   echo "continue!";
> }
> 
> if they have fogotton their password after registering, then have a link that sets a 
>variable, and 
> check or this variable at the top of the page:
> 
> go here to retrieve lost password
> 
> if '$id' is set then have the user input their password and email address (the one 
>they registered 
> with) and query the database for a username on the basis of the inputted info, and 
>email it using 
> mail() to that email address!
> 
> Use the same method for a lost username, they can then input their password and 
>email and the 
> system will mail them the lost details!
> 
> Good luck!
> Russ
> 
> On Fri, 31 Aug 2001 10:38:53 -0500 Jeff Oien <[EMAIL PROTECTED]> wrote:
> 
> > I would like users to be able to request to have their password
> > sent to their email address if they forget it. I would also like it
> > encrypted in the database though. How is this best handled?
> > 
> > The security isn't real important. But I let users choose their
> > own password and if they use a password they use for other
> > things I think it would be best for it to be encrypted.
> > Jeff Oien
> > 
> > -- 
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> > 
> 
> #---#
>   
>   "Believe nothing - consider everything" 
>   
>   Russ Michell
>   Anglia Polytechnic University Webteam
>   Room 1C 'The Eastings' East Road, Cambridge
>   
>   e: [EMAIL PROTECTED]
>   w: www.apu.ac.uk/webteam
>   t: +44 (0)1223 363271 x 2331
> 
>   www.theruss.com
>   
> #-------#
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  Room 1C 'The Eastings' East Road, Cambridge
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: RE: [PHP-DB] Random

2001-09-03 Thread Russ Michell

Try:

$result = mysql_db_query ("$DBName","select * from Contacts order by rand()
LIMIT 0,5 ");

As your first example had the '0' and then the '5' after the LIMIT clause, the second 
didn't have 
th any '0'.

Cheers.
Russ

On Fri, 31 Aug 2001 20:59:16 +0100 Seb Frost <[EMAIL PROTECTED]> wrote:

> I know it's documented as rand() but you might want to try random() just in
> case... I'm sure I read that somewhere
> 
> - seb
> 
> 
> -Original Message-
> From: John Hurleston [mailto:[EMAIL PROTECTED]]
> Sent: 31 August 2001 19:18
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Random
> 
> 
> I would like to get the first 5 random entries out of my "mysql" database,
> what would be the correct SELECT option?
> 
> I adjusted this line
> 
> $result = mysql_db_query ("$DBName","select * from Contacts LIMIT 0,5 ");
> which works correctly. :)
> 
> $result = mysql_db_query ("$DBName","select * from Contacts order by rand()
> LIMIT 5 ");
> Doesn't work at all. :(
> 
> 
> Can anyone through any light on this subject.
> 
> Thanks.
> 
> 
> 
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  Room 1C 'The Eastings' East Road, Cambridge
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




[PHP-DB] Straightforward authentication?

2001-09-13 Thread Russ Michell

Hi all:

The few php/MySQL apps I've developed that required username/password access, have 
simply been a 
means of comparing usernames and hashes of passwords in a DB. My next application 
needs to be 
slightly more secure but nothing like the needs of protecting online banking or 
vulnerable private 
info.

I have read several articles at phpbuilder.com and stuff at php.net, and frankly most 
of it seems 
to be overly contrived.

I wonder wether some list members would be able to point me in the direction of code 
and/or 
tutorials that *explain* in English what they're doing and why. For example why they 
are storing an 
MD5() hash of something in a seperate file outside the web-server's doc-root etc etc.

Once I have my head round the concepts I'll be posting my findings to a public 
location which 
list-members will be among the first to view.

I thank y'all for any help you are able to give.
Cheers

Russ

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  Room 1C 'The Eastings' East Road, Cambridge
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




Re: SV: [PHP-DB] Straightforward authentication?

2001-09-17 Thread Russ Michell

Thanks for the password/info, however I have one further (possibly bumb) question, is 
there a 
commonly employed method of securing one's database to prevent hacker's peering in and 
viewing 
plain-text/hashed passwords?

I use MySQL 3.22.32 with php4.0.3
Cheers.

Russ

On Thu, 13 Sep 2001 19:28:18 +0200 Torgil Zechel <[EMAIL PROTECTED]> wrote:

> A common way to identify a client is to use the challange-response
> algorithm. It works like this:
> 
> Ps is the password stored on the server
> Pc is the password entered by the client
> H is a hash-function (md5 for example)
> V is a 'random' value
> 
> Server calculates H(V + Ps) and save this in a session variable. The server
> then send V to the client which respond with H(V + Pc). Now, the server can
> compare H(V + Ps) with H(V + Pc). If they are equal, the user must have
> given the correct password! Otherwise the identification failed.
> 
> The good thing with this algorithm is that no password need to be sent in
> plain-text between the client and the server. The random value is used to
> ensure that the response is not just something that a hacker has sniffed in
> a previous session. The downside is that the database must be secure, since
> the passwords are stored in plain-text.
> 
> A even better way is of course to use SSL. In that case the client just send
> the password to the server and the server compares H(P) with the stored hash
> in the database.
> 
> Don't know if this was what you were looking for...
> 
> /torgil
> 
> > -Ursprungligt meddelande-
> > Fran: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]For Russ Michell
> > Skickat: den 13 september 2001 17:36
> > Till: [EMAIL PROTECTED]
> > Amne: [PHP-DB] Straightforward authentication?
> >
> >
> > Hi all:
> >
> > The few php/MySQL apps I've developed that required
> > username/password access, have simply been a
> > means of comparing usernames and hashes of passwords in a DB. My
> > next application needs to be
> > slightly more secure but nothing like the needs of protecting
> > online banking or vulnerable private
> > info.
> >
> > I have read several articles at phpbuilder.com and stuff at
> > php.net, and frankly most of it seems
> > to be overly contrived.
> >
> > I wonder wether some list members would be able to point me in
> > the direction of code and/or
> > tutorials that *explain* in English what they're doing and why.
> > For example why they are storing an
> > MD5() hash of something in a seperate file outside the
> > web-server's doc-root etc etc.
> >
> > Once I have my head round the concepts I'll be posting my
> > findings to a public location which
> > list-members will be among the first to view.
> >
> > I thank y'all for any help you are able to give.
> > Cheers
> >
> > Russ
> >
> > #---#
> >
> >   "Believe nothing - consider everything"
> >
> >   Russ Michell
> >   Anglia Polytechnic University Webteam
> >   Room 1C 'The Eastings' East Road, Cambridge
> >
> >   e: [EMAIL PROTECTED]
> >   w: www.apu.ac.uk/webteam
> >   t: +44 (0)1223 363271 x 2331
> >
> >   www.theruss.com
> >
> > #---#
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  Room 1C 'The Eastings' East Road, Cambridge
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




[PHP-DB] table entries, query construction

2001-09-19 Thread Russ Michell

Hi all:

As it stands I have a users table with several fields of personal details and a 
single field representing a user's affiliated sports-team. 
I also have a separate table that consists of these sport-teams.

The problem is that I'd like each user to be able to sign up for more than one team, 
i.e.: for multiple teams to be listed in the team field.

However the entire system relies on the fact that users can be identified 
by which sport-teams they are affiliated with and appropriate 
page content is delivered on this basis.

How can I fill the users' team-affiliation field with multiple entries, 
and still be able to map these as individual entities to scripts/SQL queries that 
deliver content 
on the basis of single team affiliation?

I thought about a comma-separated list of sport-teams within the table field, 
but how would I construct the query to display appropriate username/sport-team 
content? 

//A possibility?

SELECT affil_team FROM $table_users WHERE usrName='$username' AND 
affiliation='one_of_the_comma_separated_values";

Would the 'LIKE' clause do the job here?
Does anyone have any ideas over and above my own, on how I may be able to go on with 
this?

Many thanks.
Russ


#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  Room 1C 'The Eastings' East Road, Cambridge
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




[PHP-DB] Query construction

2001-09-19 Thread Russ Michell

Hi there:

Further to a previous submission (which can be ignored), I'd like the following query 
to 'search' a 
table field of different team names (stored as a single string), but it does't seem to 
work!

"SELECT * FROM $table_users WHERE usrName='$username' AND 
usrPswd=password('$password') AND affil_team RLIKE '$team+'";
(I've also tried: RLIKE '$team?' )

This should match the string found in the variable: '$team' with the some of contents 
(string) 
found in 'affil_team'.

For example my test has been, trying to find 'footballSat', so $team = 'footballSat'. 
'footballSat' 
exists as part of the string in the 'affil_team' field but the above query refuses to 
find 
'footballSat'!! (No error is received though)

I'm using MySQL 3.22.32 + php4.0.3pl1

Cheers
Russ

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  Room 1C 'The Eastings' East Road, Cambridge
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


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




  1   2   >