[PHP-DB] Question on CURDATE()

2005-09-14 Thread reclmaples




**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


GWAVAsigI am trying to write a statement that will basically do this:

SELECT * FROM WEEKS WHERE BEGIN = CURDATE() and END = CURDATE;

But for some reason I can only use one CURDATE() reference in my sql
statement, does anyone know why?  Is there a way I can get around this?


Any help would be greatly appreciated.

Thanks
-Rich

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




**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


GWAVAsigAdmID:EB9D127AD749FB030A007770AF02182A



**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


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

RE: [PHP-DB] Question on CURDATE()

2005-09-14 Thread reclmaples




**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


GWAVAsigI am using mysql Ver 12.22 Distrib 4.0.16

Sorry for not including that.

Thanks
-Rich

-Original Message-
From: Micah Stevens [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 13, 2005 9:13 PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Question on CURDATE()



What SQL server are you using? 

On Tuesday 13 September 2005 7:08 pm, reclmaples wrote:
 I am trying to write a statement that will basically do this:

 SELECT * FROM WEEKS WHERE BEGIN = CURDATE() and END = CURDATE;

 But for some reason I can only use one CURDATE() reference in my sql
 statement, does anyone know why?  Is there a way I can get around this?


 Any help would be greatly appreciated.

 Thanks
 -Rich

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

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




**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


GWAVAsigAdmID:5DCB563F8D32B50D1F0808DDF15FF28D



**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


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

[PHP-DB] Question on CURDATE()

2005-09-13 Thread reclmaples
I am trying to write a statement that will basically do this:

SELECT * FROM WEEKS WHERE BEGIN = CURDATE() and END = CURDATE;

But for some reason I can only use one CURDATE() reference in my sql
statement, does anyone know why?  Is there a way I can get around this?


Any help would be greatly appreciated.

Thanks
-Rich

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



RE: [PHP-DB] Question on CURDATE()

2005-09-13 Thread reclmaples
I am using mysql Ver 12.22 Distrib 4.0.16

Sorry for not including that.

Thanks
-Rich

-Original Message-
From: Micah Stevens [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 13, 2005 9:13 PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Question on CURDATE()



What SQL server are you using? 

On Tuesday 13 September 2005 7:08 pm, reclmaples wrote:
 I am trying to write a statement that will basically do this:

 SELECT * FROM WEEKS WHERE BEGIN = CURDATE() and END = CURDATE;

 But for some reason I can only use one CURDATE() reference in my sql
 statement, does anyone know why?  Is there a way I can get around this?


 Any help would be greatly appreciated.

 Thanks
 -Rich

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

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



[PHP-DB] Help Needed

2005-07-29 Thread ReClMaples
All,

 I know this is the wrong distro to be sending this request for help to
but I don’t know which one to send this to.  If you could either point me in
the direction that I should go or help me, I would greatly appreciate it.

Here is my issue.

I have a set of date that I want returned in 3 columns and an unspecified
number of rows (dependent on the number of records returned).  I cannot for
the life of me figure out how to do this.

Looking something like this

1st record
2Nd record
3trd record
4th record
5th record
6th record
7th record
8th record
9th record
And so on
And so fourth
…



Can any one help me out with this, or point me to the distro that can help
me?

Thanks
-Rich


RE: [PHP-DB] Help Needed

2005-07-29 Thread ReClMaples
Sorry, the data under 'Looking something like this' should be in a table
format with 3 columns and 4 rows.

-Original Message-
From: ReClMaples [mailto:[EMAIL PROTECTED]
Sent: Friday, July 29, 2005 8:46 PM
To: PHP
Subject: [PHP-DB] Help Needed

All,

 I know this is the wrong distro to be sending this request for help to
but I don't know which one to send this to.  If you could either point me in
the direction that I should go or help me, I would greatly appreciate it.

Here is my issue.

I have a set of date that I want returned in 3 columns and an unspecified
number of rows (dependent on the number of records returned).  I cannot for
the life of me figure out how to do this.

Looking something like this

1st record
2Nd record
3trd record
4th record
5th record
6th record
7th record
8th record
9th record
And so on
And so fourth
...



Can any one help me out with this, or point me to the distro that can help
me?

Thanks
-Rich

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



RE: [PHP-DB] Help Needed

2005-07-29 Thread ReClMaples
You ROCK!!!  Thanks so much, this worked perfectly!!!

Thanks
-Rich

-Original Message-
From: Alain Rivest [mailto:[EMAIL PROTECTED]
Sent: Friday, July 29, 2005 10:10 PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Help Needed

ReClMaples a écrit :

Sorry, the data under 'Looking something like this' should be in a table
format with 3 columns and 4 rows.

-Original Message-
From: ReClMaples [mailto:[EMAIL PROTECTED]
Sent: Friday, July 29, 2005 8:46 PM
To: PHP
Subject: [PHP-DB] Help Needed

All,

 I know this is the wrong distro to be sending this request for help to
but I don't know which one to send this to.  If you could either point me
in
the direction that I should go or help me, I would greatly appreciate it.

Here is my issue.

I have a set of date that I want returned in 3 columns and an unspecified
number of rows (dependent on the number of records returned).  I cannot for
the life of me figure out how to do this.



You can do something like this :

$i = 0 ;
echo tabletr;
while (fetch...)
{
echo td$your_data/td ;

// every 3 row
if ($i % 3 == 0)
   echo /trtr ;

$i ++ ;
}
echo /tr/table ;

I know it's not perfect, I'll let you rewrite it more elegantly...


--

Alain -- http://www.vivahate.org

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

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



RE: [PHP-DB] Can someone help me out?

2005-06-08 Thread reclmaples
This makes sense but I can't figure out how it should look in the field, can
you help?

Here is what I currently have:

select a.name,a.position,a.team,sum(b.yards) as Results from player
a,passing b where a.player_num = b.player_num and a.position = '$pos'
and b.year = '$year'
group by a.name
order by Results desc
limit '$display'

when I run it like this, I get this in my web server error log:

PHP Parse error:  parse error in Off_Stat_Leaders.php(35) : eval()'d code on
line 1, referer: Offensive_Stat_Search.php

Any ideas?

Thanks
-Rich

-Original Message-
From: Brad Webb [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 07, 2005 8:37 PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Can someone help me out?

eval($recss[sql1]).. variables inside a string have to be expanded
manually, since you're storing the variable names inside the DB, you
have to manually pull them out..

Sorry for not catching this earlier, I didn't realize the query itself
was stored in the DB.


ReClMaples wrote:

All,

   Here is the code that I'm using.  I have a form that feeds that top
values to this page:

?php

$pos = $_POST['sel_pos_name'];
$year = $_POST['sel_year_name'];
$cat_name = $_POST['sel_cat_name'];
$display = $_POST['display'];
$div = $_POST['Div'];


//MySql and Database Connection
$conn = mysql_connect(, , ) or die(mysql_error());
mysql_select_db(,$conn)  or die(mysql_error());


//Gets the id,cat_name,sql1 field sql2 field and cat_descript from the
table
$get_cat_info = select Id,Cat_Name,Cat_Descript,sql1,sql2 from
stat_categories where Cat_Name = '$cat_name';
$get_cat_info_res = mysql_query($get_cat_info) or die(mysql_error());

while ($recss = mysql_fetch_array($get_cat_info_res))
{
$id = $recss['Id'];
$cat_name1 = $recss['Cat_Name'];
$cat_descript = $recss['Cat_Descript'];
$sql1 = $recss['sql1'];
$sql2 = $recss['sql2'];
}

//Displays the top of the table
echo bResults for $cat_name/b;
echo table border='1' cellpadding='1' cellspacing='1';
echo tr;
echo td bgcolor=\#C0C0C0\centerbPlayer Name/b/center/td;
echo td bgcolor=\#C0C0C0\centerbPosition/b/center/td;
echo td bgcolor=\#C0C0C0\centerbTeam/b/center/td;
echo td bgcolor=\#C0C0C0\centerb$cat_descript/b/center/td;
echo /tr;

if ($div == 'NFL')
{
//sql2

$get_results = $sql2 limit $display;

//echo $get_results;

$get_results_res = mysql_query($get_results) or die(mysql_error());

while ($res = mysql_fetch_array($get_results_res))
   {
   $player_name = $res['name'];
   $position = $res['position'];
   $team = $res['team'];
   $Results = $res['Results'];

   echo tr;
   echo tdcenter$player_name/center/td;
   echo tdcenter$position/center/td;
   echo tdcenter$team/center/td;
   echo tdcenter$Results/center/td;
   echo /tr;
   echo /table;


   }

}
else
{
//sql1

$get_resultss = $sql1  limit $display;

echo $get_results1;
$get_results_res1 = mysql_query($get_results1) or die(mysql_error());

while ($res1 = mysql_fetch_array($get_results_res1))
{
   $player_name = $res1['name'];
   $position = $res1['position'];
   $team = $res1['team'];
   $Results = $res1['Results'];

   echo tr;
   echo tdcenter$player_name/center/td;
   echo tdcenter$position/center/td;
   echo tdcenter$team/center/td;
   echo tdcenter$Results/center/td;
   echo /tr;
   echo /table;

   }
}

?

There are no functions and I'm using double quotes.  In my table.  I have
two fields sql1 and sql2.

Here are the values in each of the fields:

Sql1
select a.name,a.position,a.team,sum(b.yards) as Results from player
a,passing b
where
a.player_num = b.player_num
and a.position = '$pos'
and b.year = '$year'
and a.team_div = '$div'
group by a.name
order by Results desc

Sql2
select a.name,a.position,a.team,sum(b.yards) as Results from player
a,passing b
where
a.player_num = b.player_num
and a.position = '$pos'
and b.year = '$year'
group by a.name
order by Results desc

I'm stumped.  I have tested each variable and they all come back, except in
the variables sql1 and sql2.

Thanks
-Rich
-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 07, 2005 7:21 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: php-db@lists.php.net
Subject: RE: [PHP-DB] Can someone help me out?

can you show the code around it? are you using single quotes in defining
the
sql statement? or double quotes?

Bastien



From: ReClMaples [EMAIL PROTECTED]
To: Jason Walker [EMAIL PROTECTED]
CC: PHP php-db@lists.php.net
Subject: RE: [PHP-DB] Can someone help me out?
Date: Tue, 7 Jun 2005 19:00:59 -0500

Jason,

   After looking at this a little more, the variable aren't being changed
into their value.

The echo looks like this:

select a.name,a.position,a.team,sum(b.yards) as Results from player
a,passing b where a.player_num = b.player_num and a.position = $pos

[PHP-DB] Can someone help me out?

2005-06-07 Thread ReClMaples
I am having a problem getting a sql statement to run.

I have this in a table called stat_categories, in a field called sql2

select a.name,a.position,a.team,sum(b.yards) as Results from player
a,passing b
where
a.player_num = b.player_num
and a.position = '$pos'
and b.year = '$year'
group by a.name
order by Results desc
limit '$display'

when I try to display this I get this error:

You have an error in your SQL syntax. Check the manual that corresponds to
your MySQL server version for the right syntax to use near ''$display'' at
line 8

I tried removing the ‘’s but this didn’t help.

If I put in the sql instead of the variable, it works fine.  What am I doing
wrong?

Any help would be greatly appreciated.

Thanks
-Rich


RE: [PHP-DB] Can someone help me out?

2005-06-07 Thread ReClMaples
Jason,

   After looking at this a little more, the variable aren't being changed
into their value.

The echo looks like this:

select a.name,a.position,a.team,sum(b.yards) as Results from player
a,passing b where a.player_num = b.player_num and a.position = $pos and
b.year = $year and a.team_div = $div group by a.name order by Results desc
limit '$display'

As you can see the variables aren't being changed, any ideas?

Thanks
-Rich

-Original Message-
From: Jason Walker [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 07, 2005 6:54 PM
To: 'ReClMaples'
Subject: RE: [PHP-DB] Can someone help me out?


In your PHP page, can you echo the actual query variable to the browser and
send that to the mail group?

I don't necessary see anything 'wrong' with your query but see the three
variables, as they are interpreted by PHP, may help.

Thanks,

-Original Message-
From: ReClMaples [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 07, 2005 4:05 PM
To: PHP
Subject: [PHP-DB] Can someone help me out?

I am having a problem getting a sql statement to run.

I have this in a table called stat_categories, in a field called sql2

select a.name,a.position,a.team,sum(b.yards) as Results from player
a,passing b where a.player_num = b.player_num and a.position = '$pos'
and b.year = '$year'
group by a.name
order by Results desc
limit '$display'

when I try to display this I get this error:

You have an error in your SQL syntax. Check the manual that corresponds to
your MySQL server version for the right syntax to use near ''$display'' at
line 8

I tried removing the ''s but this didn't help.

If I put in the sql instead of the variable, it works fine.  What am I doing
wrong?

Any help would be greatly appreciated.

Thanks
-Rich



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.6.5 - Release Date: 6/7/2005

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



RE: [PHP-DB] Can someone help me out?

2005-06-07 Thread ReClMaples
All,

   Here is the code that I'm using.  I have a form that feeds that top
values to this page:

?php

$pos = $_POST['sel_pos_name'];
$year = $_POST['sel_year_name'];
$cat_name = $_POST['sel_cat_name'];
$display = $_POST['display'];
$div = $_POST['Div'];


//MySql and Database Connection
$conn = mysql_connect(, , ) or die(mysql_error());
mysql_select_db(,$conn)  or die(mysql_error());


//Gets the id,cat_name,sql1 field sql2 field and cat_descript from the table
$get_cat_info = select Id,Cat_Name,Cat_Descript,sql1,sql2 from
stat_categories where Cat_Name = '$cat_name';
$get_cat_info_res = mysql_query($get_cat_info) or die(mysql_error());

while ($recss = mysql_fetch_array($get_cat_info_res))
{
$id = $recss['Id'];
$cat_name1 = $recss['Cat_Name'];
$cat_descript = $recss['Cat_Descript'];
$sql1 = $recss['sql1'];
$sql2 = $recss['sql2'];
}

//Displays the top of the table
echo bResults for $cat_name/b;
echo table border='1' cellpadding='1' cellspacing='1';
echo tr;
echo td bgcolor=\#C0C0C0\centerbPlayer Name/b/center/td;
echo td bgcolor=\#C0C0C0\centerbPosition/b/center/td;
echo td bgcolor=\#C0C0C0\centerbTeam/b/center/td;
echo td bgcolor=\#C0C0C0\centerb$cat_descript/b/center/td;
echo /tr;

if ($div == 'NFL')
{
//sql2

$get_results = $sql2 limit $display;

//echo $get_results;

$get_results_res = mysql_query($get_results) or die(mysql_error());

while ($res = mysql_fetch_array($get_results_res))
{
$player_name = $res['name'];
$position = $res['position'];
$team = $res['team'];
$Results = $res['Results'];

echo tr;
echo tdcenter$player_name/center/td;
echo tdcenter$position/center/td;
echo tdcenter$team/center/td;
echo tdcenter$Results/center/td;
echo /tr;
echo /table;


}

}
else
{
//sql1

$get_resultss = $sql1  limit $display;

echo $get_results1;
$get_results_res1 = mysql_query($get_results1) or die(mysql_error());

while ($res1 = mysql_fetch_array($get_results_res1))
{
$player_name = $res1['name'];
$position = $res1['position'];
$team = $res1['team'];
$Results = $res1['Results'];

echo tr;
echo tdcenter$player_name/center/td;
echo tdcenter$position/center/td;
echo tdcenter$team/center/td;
echo tdcenter$Results/center/td;
echo /tr;
echo /table;

}
}

?

There are no functions and I'm using double quotes.  In my table.  I have
two fields sql1 and sql2.

Here are the values in each of the fields:

Sql1
select a.name,a.position,a.team,sum(b.yards) as Results from player
a,passing b
where
a.player_num = b.player_num
and a.position = '$pos'
and b.year = '$year'
and a.team_div = '$div'
group by a.name
order by Results desc

Sql2
select a.name,a.position,a.team,sum(b.yards) as Results from player
a,passing b
where
a.player_num = b.player_num
and a.position = '$pos'
and b.year = '$year'
group by a.name
order by Results desc

I'm stumped.  I have tested each variable and they all come back, except in
the variables sql1 and sql2.

Thanks
-Rich
-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 07, 2005 7:21 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: php-db@lists.php.net
Subject: RE: [PHP-DB] Can someone help me out?

can you show the code around it? are you using single quotes in defining the
sql statement? or double quotes?

Bastien

From: ReClMaples [EMAIL PROTECTED]
To: Jason Walker [EMAIL PROTECTED]
CC: PHP php-db@lists.php.net
Subject: RE: [PHP-DB] Can someone help me out?
Date: Tue, 7 Jun 2005 19:00:59 -0500

Jason,

After looking at this a little more, the variable aren't being changed
into their value.

The echo looks like this:

select a.name,a.position,a.team,sum(b.yards) as Results from player
a,passing b where a.player_num = b.player_num and a.position = $pos and
b.year = $year and a.team_div = $div group by a.name order by Results desc
limit '$display'

As you can see the variables aren't being changed, any ideas?

Thanks
-Rich

-Original Message-
From: Jason Walker [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 07, 2005 6:54 PM
To: 'ReClMaples'
Subject: RE: [PHP-DB] Can someone help me out?


In your PHP page, can you echo the actual query variable to the browser and
send that to the mail group?

I don't necessary see anything 'wrong' with your query but see the three
variables, as they are interpreted by PHP, may help.

Thanks,

-Original Message-
From: ReClMaples [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 07, 2005 4:05 PM
To: PHP
Subject: [PHP-DB] Can someone help me out?

I am having a problem getting a sql statement to run.

I have this in a table called stat_categories, in a field called sql2

select a.name,a.position,a.team,sum(b.yards) as Results from player
a,passing b where a.player_num

RE: [PHP-DB] Can someone help me out?

2005-06-07 Thread ReClMaples
The default for limit starts at one, so you don't need the two variables.
My issue is with the variables not putting their value in.

Thanks
-Rich

-Original Message-
From: Isidor Stankov [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 07, 2005 7:56 PM
To: ReClMaples
Subject: Re: [PHP-DB] Can someone help me out?

error is in $limit !!!

you need to limit by two variables, starting and how many entities you want
to get, for exampe

LIMIT '$beggining', '$howmany'


Best regards

Isidor stankov
- Original Message -
From: ReClMaples [EMAIL PROTECTED]
To: PHP php-db@lists.php.net
Sent: Wednesday, June 08, 2005 1:04 AM
Subject: [PHP-DB] Can someone help me out?


I am having a problem getting a sql statement to run.

 I have this in a table called stat_categories, in a field called sql2

 select a.name,a.position,a.team,sum(b.yards) as Results from player
 a,passing b
 where
 a.player_num = b.player_num
 and a.position = '$pos'
 and b.year = '$year'
 group by a.name
 order by Results desc
 limit '$display'

 when I try to display this I get this error:

 You have an error in your SQL syntax. Check the manual that corresponds to
 your MySQL server version for the right syntax to use near ''$display'' at
 line 8

 I tried removing the ''s but this didn't help.

 If I put in the sql instead of the variable, it works fine.  What am I
 doing
 wrong?

 Any help would be greatly appreciated.

 Thanks
 -Rich


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



RE: [PHP-DB] Can someone help me out?

2005-06-07 Thread ReClMaples
This makes sense but I can't figure out how it should look in the field, can
you help?

Here is what I currently have:

select a.name,a.position,a.team,sum(b.yards) as Results from player
a,passing b where a.player_num = b.player_num and a.position = '$pos'
and b.year = '$year'
group by a.name
order by Results desc
limit '$display'

when I run it like this, I get this in my web server error log:

PHP Parse error:  parse error in Off_Stat_Leaders.php(35) : eval()'d code on
line 1, referer: Offensive_Stat_Search.php

Any ideas?

Thanks
-Rich

-Original Message-
From: Brad Webb [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 07, 2005 8:37 PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Can someone help me out?

eval($recss[sql1]).. variables inside a string have to be expanded
manually, since you're storing the variable names inside the DB, you
have to manually pull them out..

Sorry for not catching this earlier, I didn't realize the query itself
was stored in the DB.


ReClMaples wrote:

All,

   Here is the code that I'm using.  I have a form that feeds that top
values to this page:

?php

$pos = $_POST['sel_pos_name'];
$year = $_POST['sel_year_name'];
$cat_name = $_POST['sel_cat_name'];
$display = $_POST['display'];
$div = $_POST['Div'];


//MySql and Database Connection
$conn = mysql_connect(, , ) or die(mysql_error());
mysql_select_db(,$conn)  or die(mysql_error());


//Gets the id,cat_name,sql1 field sql2 field and cat_descript from the
table
$get_cat_info = select Id,Cat_Name,Cat_Descript,sql1,sql2 from
stat_categories where Cat_Name = '$cat_name';
$get_cat_info_res = mysql_query($get_cat_info) or die(mysql_error());

while ($recss = mysql_fetch_array($get_cat_info_res))
{
$id = $recss['Id'];
$cat_name1 = $recss['Cat_Name'];
$cat_descript = $recss['Cat_Descript'];
$sql1 = $recss['sql1'];
$sql2 = $recss['sql2'];
}

//Displays the top of the table
echo bResults for $cat_name/b;
echo table border='1' cellpadding='1' cellspacing='1';
echo tr;
echo td bgcolor=\#C0C0C0\centerbPlayer Name/b/center/td;
echo td bgcolor=\#C0C0C0\centerbPosition/b/center/td;
echo td bgcolor=\#C0C0C0\centerbTeam/b/center/td;
echo td bgcolor=\#C0C0C0\centerb$cat_descript/b/center/td;
echo /tr;

if ($div == 'NFL')
{
//sql2

$get_results = $sql2 limit $display;

//echo $get_results;

$get_results_res = mysql_query($get_results) or die(mysql_error());

while ($res = mysql_fetch_array($get_results_res))
   {
   $player_name = $res['name'];
   $position = $res['position'];
   $team = $res['team'];
   $Results = $res['Results'];

   echo tr;
   echo tdcenter$player_name/center/td;
   echo tdcenter$position/center/td;
   echo tdcenter$team/center/td;
   echo tdcenter$Results/center/td;
   echo /tr;
   echo /table;


   }

}
else
{
//sql1

$get_resultss = $sql1  limit $display;

echo $get_results1;
$get_results_res1 = mysql_query($get_results1) or die(mysql_error());

while ($res1 = mysql_fetch_array($get_results_res1))
{
   $player_name = $res1['name'];
   $position = $res1['position'];
   $team = $res1['team'];
   $Results = $res1['Results'];

   echo tr;
   echo tdcenter$player_name/center/td;
   echo tdcenter$position/center/td;
   echo tdcenter$team/center/td;
   echo tdcenter$Results/center/td;
   echo /tr;
   echo /table;

   }
}

?

There are no functions and I'm using double quotes.  In my table.  I have
two fields sql1 and sql2.

Here are the values in each of the fields:

Sql1
select a.name,a.position,a.team,sum(b.yards) as Results from player
a,passing b
where
a.player_num = b.player_num
and a.position = '$pos'
and b.year = '$year'
and a.team_div = '$div'
group by a.name
order by Results desc

Sql2
select a.name,a.position,a.team,sum(b.yards) as Results from player
a,passing b
where
a.player_num = b.player_num
and a.position = '$pos'
and b.year = '$year'
group by a.name
order by Results desc

I'm stumped.  I have tested each variable and they all come back, except in
the variables sql1 and sql2.

Thanks
-Rich
-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 07, 2005 7:21 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: php-db@lists.php.net
Subject: RE: [PHP-DB] Can someone help me out?

can you show the code around it? are you using single quotes in defining
the
sql statement? or double quotes?

Bastien



From: ReClMaples [EMAIL PROTECTED]
To: Jason Walker [EMAIL PROTECTED]
CC: PHP php-db@lists.php.net
Subject: RE: [PHP-DB] Can someone help me out?
Date: Tue, 7 Jun 2005 19:00:59 -0500

Jason,

   After looking at this a little more, the variable aren't being changed
into their value.

The echo looks like this:

select a.name,a.position,a.team,sum(b.yards) as Results from player
a,passing b where a.player_num = b.player_num and a.position = $pos

[PHP-DB] Need some help

2005-05-11 Thread ReClMaples
Hello all,

   I am having an issue with displaying a variable from another php script.
Can you help please?

Here is the code that I’m using:

?php

$item_ttlprice = $_POST[$ttl_price];
?
html
body
Your price is: $
?php
echo $item_ttlprice;
?
body
/html

pretty simple I would think but I can’t figure out what I’m doing wrong.
The above is the new script.  Below is the script that the $ttl_price is
coming from:

td align=center\$ $item_price br/td
td align=center$item_qty br/td
td align=center\$ $total_price/td
td align=centera
href=\removefromcart.php?id=$id\remove/a/td
/tr;
$ttl_price = $ttl_price + $total_price;


Can anyone tell me what I’m doing wrong?

I have tried changing this part:

?php

$item_ttlprice = $_POST[$ttl_price];
?

to $item_ttlprice = $_GET[ttl_price];

to $item_ttlprice = $_POST[‘$ttl_price’];

nothing seems to work.


Thanks for your help
-Rich


[PHP-DB] Help with PHP

2005-04-25 Thread ReClMaples

I'm not sure if this is the correct distro to be sending this question to,
if it's not, let me know which one I should send it to.

I am having an issue where a variable in on php file won't go to the next
php file:

Here is the code I am using:

get colors
   $get_colors = select Cat_Name from link_categories order by cat_name;
   $get_colors_res = mysql_query($get_colors) or die(mysql_error());

   if (mysql_num_rows($get_colors_res)  0) {
$display_block .= PstrongCategories:/strong
   select name=\sel_item_color\;
while ($colors = mysql_fetch_array($get_colors_res)) {
  $item_color = $colors['Cat_Name'];
  $display_block .= option
value=\$item_color\$item_color/option;
}
   $display_block .= /select;
   }

This gives me a drop down and when I select the item in the drop down that I
want, it should go into the variable sel_item_color

then in my included script I have

$cat_name = $_POST['sel_item_color'];

when i try to echo it, nothing comes up.  Can anyone help me figure this
out?

Thanks
-Rich



RE: [PHP-DB] Help with PHP

2005-04-25 Thread ReClMaples

I apologize but I figured out my mistake.

Thanks
-Rich
-Original Message-
From: ReClMaples [mailto:[EMAIL PROTECTED]
Sent: Monday, April 25, 2005 10:05 PM
To: PHP
Subject: [PHP-DB] Help with PHP



I'm not sure if this is the correct distro to be sending this question to,
if it's not, let me know which one I should send it to.

I am having an issue where a variable in on php file won't go to the next
php file:

Here is the code I am using:

get colors
   $get_colors = select Cat_Name from link_categories order by cat_name;
   $get_colors_res = mysql_query($get_colors) or die(mysql_error());

   if (mysql_num_rows($get_colors_res)  0) {
$display_block .= PstrongCategories:/strong
   select name=\sel_item_color\;
while ($colors = mysql_fetch_array($get_colors_res)) {
  $item_color = $colors['Cat_Name'];
  $display_block .= option
value=\$item_color\$item_color/option;
}
   $display_block .= /select;
   }

This gives me a drop down and when I select the item in the drop down that I
want, it should go into the variable sel_item_color

then in my included script I have

$cat_name = $_POST['sel_item_color'];

when i try to echo it, nothing comes up.  Can anyone help me figure this
out?

Thanks
-Rich

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



[PHP-DB] PHP and Mysql help

2005-04-24 Thread ReClMaples
Can someone help me out with an issue I'm having?



Here is my code:

$res = mysql_query(SELECT ZG_LATITUDE, ZG_LONGITUDE FROM zip_code
wherezg_zipcode = '$zip');

List($Lat,$Lon) = mysql_fetch_row($res);

$Lat1 = ($Lat-2);

$Lat2= ($Lat+2);

$Lon1= ($Lon-2);

$Lon2= ($Lon+2);

//echo ($Lat1);

//echo ($Lat2);

//echo ($Lon1);

//echo ($Lon2);

$zipcode = mysql_query(

SELECT * FROM zip_code where ZG_LATITUDE = $Lat1

and ZG_LATITUDE = $Lat2 and ZG_LONGITUDE = $Lon1 and ZG_LONGITUDE =

$Lon2);

if (!$zipcode) {

echo(PError performing query:  .

mysql_error() . /P);

exit();

}



while ( $row = mysql_fetch_array($zipcode) )

{

echo(bCity: /b . $row[ZG_CITY]. br);

echo(bState: /b . $row[ZG_STATE]. br);

echo(bZip Code: /b . $row[ZG_ZIPCODE]. br);

echo(bArea Code: /b . $row[ZG_AREACODE]. br);

echo(bCounty FIPS: /b . $row[ZG_COUNTY_FIPS]. br);

echo(bCounty Name: /b . $row[ZG_COUNTY_NAME]. br);

echo(bTime Zone: /b . $row[ZG_TIME_ZONE]. br);

echo(bDay Light Savings?: /b . $row[ZG_DST]. br);

echo(bLatitude: /b . $row[ZG_LATITUDE]. br);

echo(bLongitude: /b . $row[ZG_LONGITUDE]. P);

}

I get no results with this still, it acutally doesn't even go to the this

page. When I uncomment out:

//echo ($Lat1);

//echo ($Lat2);

//echo ($Lon1);

//echo ($Lon2);

and comment out everything below this, I get the expected results for

$Lat1,$Lat2,$Lon1, and $Lon2. So I have to believe my issue is below those

lines, can anyone see what I have that is incorrect here?



RE: [PHP-DB] PHP and MySql question

2005-04-18 Thread ReClMaples
Ok, I tried what you saidHere's the code:

$res = mysql_query(
SELECT ZG_LATITUDE, ZG_LONGITUDE FROM zip_code where
zg_zipcode = '$zip');
List($Lat,$Lon) = mysql_fetch_row($res);
$Lat1 = ($Lat-2);
$Lat2= ($Lat+2);
$Lon1= ($Lon-2);
$Lon2= ($Lon+2);

//echo ($Lat1);
//echo ($Lat2);
//echo ($Lon1);
//echo ($Lon2);

$zipcode = mysql_query(
  SELECT * FROM zip_code where ZG_LATITUDE = $Lat1
and ZG_LATITUDE = $Lat2 and ZG_LONGITUDE = $Lon1 and ZG_LONGITUDE =
$Lon2);
if (!$zipcode) {
echo(PError performing query:  .
 mysql_error() . /P);
exit();
}


while ( $row = mysql_fetch_array($zipcode) )
{
echo(bCity: /b . $row[ZG_CITY]. br);
echo(bState: /b . $row[ZG_STATE]. br);
echo(bZip Code: /b . $row[ZG_ZIPCODE]. br);
echo(bArea Code: /b . $row[ZG_AREACODE]. br);
echo(bCounty FIPS: /b . $row[ZG_COUNTY_FIPS]. br);
echo(bCounty Name: /b . $row[ZG_COUNTY_NAME]. br);
echo(bTime Zone: /b . $row[ZG_TIME_ZONE]. br);
echo(bDay Light Savings?: /b . $row[ZG_DST]. br);
echo(bLatitude: /b . $row[ZG_LATITUDE]. br);
echo(bLongitude: /b . $row[ZG_LONGITUDE]. P);

}

I get no results with this still, it acutally doesn't even go to the this
page.  When I uncomment out:

//echo ($Lat1);
//echo ($Lat2);
//echo ($Lon1);
//echo ($Lon2);

and comment out everything below this, I get the expected results for
$Lat1,$Lat2,$Lon1, and $Lon2.  So I have to believe my issue is below those
lines, can anyone see what I have that is incorrect here?

-Original Message-
From: Henrik Hornemann [mailto:[EMAIL PROTECTED]
Sent: Monday, April 18, 2005 2:44 AM
To: php-db@lists.php.net
Subject: SV: [PHP-DB] PHP and MySql question


Hi,

Your problem is that your variables $Lat1,$Lat2,$Lon1,$Lon2 all reffer
to resultsets and not the Latitudes or Longitudes.
Try something like this:

$res = mysql_query(
SELECT ZG_LATITUDE, ZG-LONGITUDE FROM zip_code where
zg_zipcode = '$zip');
List($Lat,$Lon) = mysql_fetch_row($res);
$Lat1=Lat-2; $Lat2=Lat+2; $Lon1=Lon-2; $Lon2=Lat+2;

Now you can use the values in your final query.

Hth Henrik Hornemann

-Oprindelig meddelelse-
Fra: ReClMaples [mailto:[EMAIL PROTECTED]
Sendt: 16. april 2005 22:38
Til: php-db@lists.php.net
Emne: [PHP-DB] PHP and MySql question

Hello, I'm kinda new at PHP programming with MySQL.  I am having an
issue and am not sure if this is the corret way to do this:  Here is my
code, I'll start there:

?php

  $Lat1 = mysql_query(
SELECT (ZG_LATITUDE-2) FROM zip_code where zg_zipcode =
'$zip');
  if (!$Lat1) {
echo(PError performing query:  .
 mysql_error() . /P);
exit();
  }

$Lat2 = mysql_query(
SELECT (ZG_LATITUDE+2) FROM zip_code where zg_zipcode =
'$zip');
  if (!$Lat2) {
echo(PError performing query:  .
 mysql_error() . /P);
exit();
  }

$Lon1 = mysql_query(
SELECT (ZG_LONGITUDE-2) FROM zip_code where zg_zipcode =
'$zip');
  if (!$Lon1) {
echo(PError performing query:  .
 mysql_error() . /P);
exit();
  }

$Lon2 = mysql_query(
SELECT (ZG_LONGITUDE+2) FROM zip_code where zg_zipcode =
'$zip');
  if (!$Lon2) {
echo(PError performing query:  .
 mysql_error() . /P);
exit();
  }

$ZipCode = mysql_query(
SELECT * FROM zip_code where ZG_LATITUDE = '$Lat1'
and ZG_LATITUDE = '$Lat2' and ZG_LONGITUDE = '$Lon1' and ZG_LONGITUDE
= '$Lon2');
  if (!$Zipcodesearch) {
echo(PError performing query:  .
 mysql_error() . /P);
exit();
  }

  while ( $row = mysql_fetch_array($ZipCode) ) {
echo(bCity: /b . $row[ZG_CITY]. br);
echo(bState: /b . $row[ZG_STATE]. br); echo(bZip Code:
/b . $row[ZG_ZIPCODE]. br); echo(bArea Code: /b .
$row[ZG_AREACODE]. br); echo(bCounty FIPS: /b .
$row[ZG_COUNTY_FIPS]. br); echo(bCounty Name: /b .
$row[ZG_COUNTY_NAME]. br); echo(bTime Zone: /b .
$row[ZG_TIME_ZONE]. br); echo(bDay Light Savings?: /b .
$row[ZG_DST]. br);
echo(bLatitude: /b . $row[ZG_LATITUDE]. br);
echo(bLongitude: /b . $row[ZG_LONGITUDE]. P); } ?

Basically I'm trying to have a user input a zip code and then have a php
script pull all zip codes that are in a region of that submitted zip
code.
Can you have a look at my code and see what I'm doing wrong?  When using
this it returns no results but makes the connection to the database so I
have to believe that it's within here that I have my issue.

I have Apache/2.0.47 (Win32) PHP/4.3.9 Server and MySql 4.0.14 (I know I
can upgrade and be able to do subselects but I would like to know what
I'm doing wrong here.

Thanks in advance for any help.

Thanks
-rich

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

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

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



[PHP-DB] PHP and MySql question

2005-04-16 Thread ReClMaples
Hello, I'm kinda new at PHP programming with MySQL.  I am having an issue
and am not sure if this is the corret way to do this:  Here is my code, I'll
start there:

?php

  $Lat1 = mysql_query(
SELECT (ZG_LATITUDE-2) FROM zip_code where zg_zipcode =
'$zip');
  if (!$Lat1) {
echo(PError performing query:  .
 mysql_error() . /P);
exit();
  }

$Lat2 = mysql_query(
SELECT (ZG_LATITUDE+2) FROM zip_code where zg_zipcode =
'$zip');
  if (!$Lat2) {
echo(PError performing query:  .
 mysql_error() . /P);
exit();
  }

$Lon1 = mysql_query(
SELECT (ZG_LONGITUDE-2) FROM zip_code where zg_zipcode =
'$zip');
  if (!$Lon1) {
echo(PError performing query:  .
 mysql_error() . /P);
exit();
  }

$Lon2 = mysql_query(
SELECT (ZG_LONGITUDE+2) FROM zip_code where zg_zipcode =
'$zip');
  if (!$Lon2) {
echo(PError performing query:  .
 mysql_error() . /P);
exit();
  }

$ZipCode = mysql_query(
SELECT * FROM zip_code where ZG_LATITUDE = '$Lat1'
and ZG_LATITUDE = '$Lat2' and ZG_LONGITUDE = '$Lon1' and ZG_LONGITUDE =
'$Lon2');
  if (!$Zipcodesearch) {
echo(PError performing query:  .
 mysql_error() . /P);
exit();
  }

  while ( $row = mysql_fetch_array($ZipCode) ) {
echo(bCity: /b . $row[ZG_CITY]. br);
echo(bState: /b . $row[ZG_STATE]. br);
echo(bZip Code: /b . $row[ZG_ZIPCODE]. br);
echo(bArea Code: /b . $row[ZG_AREACODE]. br);
echo(bCounty FIPS: /b . $row[ZG_COUNTY_FIPS]. br);
echo(bCounty Name: /b . $row[ZG_COUNTY_NAME]. br);
echo(bTime Zone: /b . $row[ZG_TIME_ZONE]. br);
echo(bDay Light Savings?: /b . $row[ZG_DST]. br);
echo(bLatitude: /b . $row[ZG_LATITUDE]. br);
echo(bLongitude: /b . $row[ZG_LONGITUDE]. P);
}
?

Basically I'm trying to have a user input a zip code and then have a php
script pull all zip codes that are in a region of that submitted zip code.
Can you have a look at my code and see what I'm doing wrong?  When using
this it returns no results but makes the connection to the database so I
have to believe that it's within here that I have my issue.

I have Apache/2.0.47 (Win32) PHP/4.3.9 Server and MySql 4.0.14 (I know I can
upgrade and be able to do subselects but I would like to know what I'm doing
wrong here.

Thanks in advance for any help.

Thanks
-rich

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



[PHP-DB] MySql and PHP question

2005-04-06 Thread ReClMaples
All,

I have a question as how I can return some results that I am looking
for.  Ideally I'd like to run this sql statement but for some reason MySql
won't allow me to run it:


SELECT
  *
FROM
  zip_code
WHERE
  zg_latitude between ((select zg_latitude from zip_code where zg_zipcode =
'78730')- 2) and
  ((select zg_latitude from zip_code where zg_zipcode = '78730') + 2)  and
  zg_longitude between ((select zg_longitude from zip_code where zg_zipcode
= '78730') - 2) and
  ((select zg_longitude from zip_code where zg_zipcode = '78730') + 2)

I get an error to check the mysql manual.  This statement runs in an oracle
environment though.

I guess I am stuck with writing multiple queries and them tying them
together.  In PHP how can I put a variable into the sql statement (if that's
possible).  Let's say I have these queries:
select zg_longitude from zip_code where zg_zipcode = '78730'

This one pulls the zg_longitude from the zip_code table where the zip_code
is 78730 for instance.  I want to take the result (one record) and put it in
this sql statment replacing 'result here':

select * from zip_code
where zg_longitude = ('result here'-2)
and zg_longitude = ('result here'+2)
order by zg_city asc

Can anyone help me with this or point me in a better direction?

Thanks

-Rich







[PHP-DB] Mail question

2005-02-14 Thread ReClMaples
I have a quick, probably easy to answer question.  I am trying to add the
ability to email from like a quest book or a calendar event and get an
authentication error in my error log.  I can only believe that this is due
to my smtp server needed to know my login and password.  Is there a way I
can pass this in the php.ini file?  I am using apache 2.0 and PHP 4.03 on a
windows xp machine.  If this can be done, please let me know, any other
suggestions would be welcomed.

Thanks
-Rich

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