Re: [PHP-DB] Geeky question

2007-04-06 Thread Mihail Bota
http://users.chariot.net.au/~gmarts/eastcalc.htm

Mihai
On Fri, 6 Apr 2007, Ron Piggott wrote:

 Is there a way to find out what dates Easter will be in PHP for 2008,
 2009, etc.?  Ron


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



Re: [PHP-DB] need help with a query

2003-12-31 Thread Mihail Bota
I do not think it is going to work, you may want to stick with the PHP
script. MySQL says that is going to enable subqueries from version 4.1 and
the most recent release is 4.0.16 or 4.0.17.

A question and 2 comments:
q: the teams are fixed within league?
c1: it is not clear how you record the goals of a team against of another.
2. you may want to check the sizes of some fields; some are too big, or
too small.

Mihai
On Wed, 31 Dec 2003, Kirk Babb wrote:

 If (in MySQL) I have to select 'playerID' from the table soccer.players
 based on lname='smith', fname='john', and dob='1988-12-02' and THEN update
 soccer.teams 'coachID' equal to the result of the select statement, can I do
 it all in one query?

 Or must I let my PHP script execute a select, grab the result, and then run
 the update statement?

 The scenario is this: I've just created the player record in soccer.players
 (it's an adult league, so a player could also be the coach) and need to grab
 that playerID to insert into the coachID section of  soccer.teams.

 Here's the definitions for my tables if it would help you follow my question
 (with thanks to Micah for the structural assistance):
 divisions
 Table comments : league division names with identifier

   Field Type Null Default
   divisionID   int(11) No
   division_name   varchar(15) No

 players
 Table comments : player registration and statistical info

   Field Type Null Default
   playerID   int(11) No
   lname   varchar(20) No
   fname   varchar(20) No
   teamID   int(11) No  0
   dob   date No  -00-00
   address   varchar(40) No
   telephone   int(9) No  2147483647
   email   varchar(40) No
   sex   enum('m', 'f') No  m
   yellow   int(2) No  0
   red   int(2) No  0
   disc_notes   text Yes  NULL
   goals_scored   int(2) No  0
   own_goals   int(2) No  0

 teams
 Table comments : Team registration and statistical info

   Field Type Null Default
   teamID   int(11) No
   team_name   varchar(20) No
   pwd   varchar(7) No
   coachID   int(11) No  0
   divisionID   int(11) No  0
   paid   enum('y', 'n') No  n
   pmnt_notes   text Yes  NULL
   win   int(2) No  0
   loss   int(2) No  0
   tie   int(2) No  0
   goals_for   int(2) No  0
   goals_against   int(2) No  0


 Thanks for your help!

 Kirk

 --
 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] table structure question

2003-12-29 Thread Mihail Bota
I would do it a little bit different:

1. I would add ID's for each of the tables.
2. I would split teams in 2 tables; the captain stuff would be in a
separate table (captain_team let's say), simply because I would have
different players as captains in different games. If you keep the
structure as it is now, you'll have a lot of duplication.
So, I would do it like this:

teams
---
IDteam | name | ...

teams_captain
---
IDteam| IDplayer| Game (this could be date format)


players

IDplayer |...

Then, if you want to see the players who were captains for a given team,
you can write smth. like:

select distinct p.lname from players p, teams_captain t, teams tt where
p.IDplayer=t.IDplayer and t.IDteam=tt.IDteam and tt.name like 'Real
Madrid'

Check also the normalization forms of a database, which you can find in
any database book, simply because you'll have complications if you record
more than 1 season and some teams can move in different leagues.

Hope this helps.

Mihai
On Mon, 29 Dec 2003, Kirk Babb wrote:

 Hi everyone,

 I would like to set up the following two tables inside a db for a soccer
 league, but wanted to run their structure by you guys first.  Here it is:

 dbname: soccer_stats
 tables: teams, players

 teams
 --
 name | captain | division | paid | pmnt_notes | win | loss | tie | goals_for
 | goals_against

 players
 --
 lname | fname | team_name | dob | address | telephone | email | sex | yellow
 | red | disc_notes | goals_scored | own goals

 I've never split the info over multiple tables, but this way made sense to
 me for some reason.  I've been thinking, and if, for example, I want to
 (using mysql) pull the captain of a specific player, how would I do that?
 Is this a good table design in the first place?  Comments and criticisms are
 welcome!  Thanks - Kirk

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



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



[PHP-DB] Re: Images-weird!!

2003-02-02 Thread Mihail Bota
No, this is not the problem. $i and $j start from 0, anyway. The real
problem, as I see it, is the following:
I have a big loop, to create something like a checkerboard, but with 13 or
so colors. If the loop iterates more than 256 times, then those cells with
indexes bigger than 255 (or 256, does not matter) will have a single
color: that of the 255th or 256th cell.
It is as if I do not have only 13 colors, but 256! Try to run the code and
see what I mean.

Now I try to do my job by using JPGraph, but I succeded to ruin
everything:)
Oh, dear:)
On Mon, 3 Feb 2003, Adam Royle wrote:

 Hi Mihai,

 Didn't try your code, but noticed your comment on colours. RBG values go from 0 - 
255, not 1 - 256, so this may be your problem.

 Adam




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




[PHP-DB] Images-weird!!

2003-02-02 Thread Mihail Bota
Hello,

If you have time, please run the code below. It is a very simple code
which has 2 nested loops and assigns colors to a given value. If the
product of $i and $j is smaller or equal to 256 (exactly the number of
colors allowed), then  you'll get a random pattern. If this product is
bigger than 256, then the last rows (i.e. all those cells with indexes
bigger than 256) of the rectangle will have the last
color encountered (as if is the 256'th), even though I only have 13
possible colors in the code.

Anybody has an indea to overcome this thing? Am I missing something, or
this is due to a problem in PHP (PHP 4.2.1, Win 2k), or GD?
I spent 3 days on this problem with no avail!

Thanks!

Mihai
 ---
?php
$image=imageCreate(500,500);
$white=imageColorAllocate($image,255,255,255);
imageFilledRectangle($image,0,0,500,500,$white);
for ($i=0; $i17; $i++) {
for ($j=0; $j17; $j++) {
$qq=rand(0,13);
if ($qq==1) {
$vstrong=imageColorAllocate($image, 255, 0, 0);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$vstrong);
}
elseif ($qq==0) {
$nueste=imageColorAllocate($image, 255, 255, 0);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$nueste);
}
elseif ($qq==2) {
$strong=imageColorAllocate($image, 255, 0, 100);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$strong);
}
elseif ($qq==3) {
$smoderate=imageColorAllocate($image, 255, 100, 100);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$smoderate);
}
elseif ($qq==4) {
$moderate=imageColorAllocate($image, 255, 210, 100);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$moderate);
}
elseif ($qq==5) {
$color3=imageColorAllocate($image, 0, 255, 255);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$color3);
}
elseif ($qq==6) {
$color4=imageColorAllocate($image, 0, 255, 200);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$color4);
}
elseif ($qq==7) {
$color5=imageColorAllocate($image, 0, 100, 255);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$color5);
}

elseif ($qq==8) {
$color6=imageColorAllocate($image, 0, 100, 200);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$color6);
}
elseif ($qq==9) {
$color7=imageColorAllocate($image, 200, 0, 0);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$color7);
}
elseif ($qq==12) {
$justis=imageColorAllocate($image, 0, 0, 138);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$justis);
}
else {
$ciudat=imageColorAllocate($image, 0, 0, 255);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$ciudat);
}

}
}
Header(Content-type: image/png);
imagePNG($image);
imageDestroy($image);
?
---




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




Re: [PHP-DB] Re: Images-weird!!

2003-02-02 Thread Mihail Bota
Yeah, I had the idea with truecolor, but I do not have GD2 installed. I
have to install it, first.
Still, I do not understand! I only have 13 colors, why is allocating only
255? I am not using the indexes in the color allocation.

Thanks.
On Mon, 3 Feb 2003, Pierre-Alain Joye wrote:

 On Sun, 02 Feb 2003 14:36:38 -0800 (PST)
 Mihail Bota [EMAIL PROTECTED] wrote:

  No, this is not the problem. $i and $j start from 0, anyway. The real
  problem, as I see it, is the following:
  I have a big loop, to create something like a checkerboard, but with
  13 or so colors. If the loop iterates more than 256 times, then those
  cells with indexes bigger than 255 (or 256, does not matter) will have
  a single color: that of the 255th or 256th cell.

 Random color, you create a palette based image, which has only 256
 colors (0..255), the 1st allocated color is the backgroud color, you
 have only 255 colors to use, 1..255.

 You loop 16*16 (17), you reached the maximum amount of color at the
 16th iteration.

 You can easily solve your problem by using a truecolor image, make your
 script a little bit more efficient by allocating before the loop, and
 cleaner without the ugly if else endless test. Find a quick cleanup at
 the footer

 As a side note, an image of 500x400 means a horizantal ranges from 0 to
 499 and a vertical range from 0 to 399.


 hth

 pierre

 ?php
 $image=imagecreatetruecolor(500,500);

 $white=imageColorAllocate($image,255,255,255);

 imageFilledRectangle($image,0,0,499,499,$white);

 $colors = array(
   imagecolorallocate($image, 255, 255, 0),
   imagecolorallocate($image, 255, 0, 0),
   imagecolorallocate($image, 255, 0, 100),
   imagecolorallocate($image, 255, 100, 100),
   imagecolorallocate($image, 255, 210, 100),
   imagecolorallocate($image, 0, 255, 255),
   imagecolorallocate($image, 0, 255, 200),
   imagecolorallocate($image, 0, 100, 255),
   imagecolorallocate($image, 0, 100, 200),
   imagecolorallocate($image, 200, 0, 0),
   imagecolorallocate($image, 0, 0, 138),
   imagecolorallocate($image, 0, 0, 255)
 );

 for ($i=0; $i17; $i++) {
   for ($j=0; $j17; $j++) {
   /* should be 0..11 to avoid the test */
   $qq=rand(0,13);
   if($qq  $qq12){
   imagefilledrectangle($image,
   7*$j,7*$i,7*$j+7,7*$i+7,$colors[$qq]);
   }
   }
 }
 header(Content-type: image/png);
 imagepng($image);
 imagedestroy($image);
 ?

 --
 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] Re: Images-weird!!

2003-02-02 Thread Mihail Bota
Got it.
Thanks a lot, guys!

On Mon, 3 Feb 2003, Pierre-Alain Joye wrote:

 On Sun, 02 Feb 2003 15:29:44 -0800 (PST)
 Mihail Bota [EMAIL PROTECTED] wrote:

  Yeah, I had the idea with truecolor, but I do not have GD2 installed.
  I have to install it, first.
  Still, I do not understand! I only have 13 colors, why is allocating
  only 255? I am not using the indexes in the color allocation.

 palette based image (imagecreate) can use a maximum of 256 colors. You
 allocate a new color in each iteration of the inside loop, 16*16=256
 and greater than 255, do not forget you have already one color allocated
 for the background color, btw, you do no need to draw a white box with a
 palette image, the 1st allocated color is the background color.

 hth

 pierre





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




[PHP-DB] Images

2003-02-01 Thread Mihail Bota
Hello,

I try to create a simple image from some data from a database (something
like a checkerboard: if $a=1 then red, elseif $a=2 then blue etc).
Everthing works fine until the assignment of colors. Whenever I use the
whole set of data that I have to display, wrong colors are assigned.
Whenever I use small subsets of the whole set, then I have the correct
display.  I only change the value of the limit from the query and the
whole pattern might change drastically.

Anybody encountered something similar?

Mihai


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




RE: [PHP-DB] Images

2003-02-01 Thread Mihail Bota
John,

the code is listed below. Very cluttered, I acknoweledge:)
The limit you'll see in the second query is the maximal value for which I
get a good checkerboard.

Mihai

$q1=mysql_query(select distinct idsend from connections where publi=1 and
uid=1 order by idsend);
$nu1=mysql_num_rows($q1);
for ($i=0; $i$nu1; $i++) {
$qmax=mysql_fetch_row($q1);
$send[$i]=$qmax[0];
}
$q2=mysql_query(select distinct idrec from connections where publi=1 and
uid=1 order by idrec limit 127);
$nu2=mysql_num_rows($q2);
for ($i=0; $i$nu2; $i++) {
$qmax2=mysql_fetch_row($q2);
$rec[$i]=$qmax2[0];
}
$image=imageCreate(5000,5000);

for ($i=0; $i$nu1; $i++) {
for ($j=0; $j$nu2; $j++) {

$qcheck=mysql_query(select count(*) from connections where
idsend=$send[$i] and idrec=$rec[$j] and publi=1 and uid=1) or
die(mysql_error());
$rcheck=mysql_fetch_row($qcheck);
$check=0+$rcheck[0];
if ($check0) {
$rmax=mysql_query(select min(strength) from connections where
idsend=$send[$i] and idrec=$rec[$j] and publi=1 and uid=1)  or
die(mysql_error());
$qmax3=mysql_fetch_row($rmax);
$qq=$qmax3[0];
if ($qq==1) {
$a=0;
$b=0;
$c=0;
}
elseif ($qq==2) {
$a=255;
$b=50;
$c=50;
}
elseif ($qq==3) {
$a=200;
$b=100;
$c=100;
}
elseif ($qq==4) {
$a=0;
$b=0;
$c=255;
}
elseif ($qq==5) {
$a=0;
$b=255;
$c=255;
}
elseif ($qq==6) {
$a=0;
$b=255;
$c=200;
}
elseif ($qq==7) {
$a=0;
$b=100;
$c=255;
}

elseif ($qq==8) {
$a=0;
$b=100;
$c=255;
}
elseif ($qq==9) {
$a=255;
$b=0;
$c=0;
}
elseif ($qq==12) {
$a=0;
$b=0;
$c=255;
}
 elseif ($qq==0){
$a=200;
$b=200;
$c=200;
}
}
elseif ($check==0) {
$a=0;
$b=0;
$c=0;
}

$cul=imageColorAllocate($image, $a, $b, $c);;
imagerectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$cul);
}
}

Header(Content-type: image/png);
imagePNG($image);
imageDestroy($image);

On Sat, 1 Feb 2003, John W. Holmes wrote:

  I try to create a simple image from some data from a database
 (something
  like a checkerboard: if $a=1 then red, elseif $a=2 then blue etc).
  Everthing works fine until the assignment of colors. Whenever I use
 the
  whole set of data that I have to display, wrong colors are assigned.
  Whenever I use small subsets of the whole set, then I have the correct
  display.  I only change the value of the limit from the query and the
  whole pattern might change drastically.

 Show your code...

 ---John W. Holmes...

 PHP Architect - A monthly magazine for PHP Professionals. Get your copy
 today. http://www.phparch.com/







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




Re: [PHP-DB] If conditional behaviour

2002-11-15 Thread Mihail Bota
Did you try $city==Victoria ?

On Fri, 15 Nov 2002, Bradley Crockett wrote:

 AT http://crockett.ca/joinoptional.php I have a page posted. PHP isn't set up on the 
server, so I've posted a screenshot of what it looks like at 
http://crockett.ca/joinoptionalrendered.bmp (1/2 MB, sorry). For some reason, it 
wants to repeat 'Victoria' in the form.

 If I comment out the If conditional:

   // if ($city = Victoria) {
   //  echo selected ;
   // }

 ..the problem goes away and the different cities appear as expected.

 The result of the query is at http://crockett.ca/queryresults.txt

 Can someone point me in the right direction?

 Brad Crockett
 Duncan BC


 --
 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] php, DB and arrays

2002-11-09 Thread Mihail Bota
did you try select max(v) as max_v from your_table where year=... ?

and put this query in a loop for years.

mihai
On Sun, 10 Nov 2002, Martin Allan Jensen wrote:

 Hi evryonei have a problem that i hope you can help me with.

 Here it goes!

 I have two arrays returned from my DB one called y adn one called v
 Togeather they hold a year(Y) and a value(V)

 The return from the DB looks like this:

 v:
 10
 20
 40
 60
 320
 780
 890
 920

 y:
 2002
 2002
 2002
 2002
 2002
 2003
 2003
 2003

 -

 Y represents a climping value
 A represents the year of the value
 

 So  the values 10, 20, 40, 60, 320 etc. grows until a new year is reachet. And then 
it schould start again in the new year.
 So MAXIMUM ONE VALUE per year

 How can i make it return this out of the earlier menchent array :

 (Arrays)
 Y:
 2002
 2003

 V:
 320
 920

 So much thanks peoplei tried now for two days and i just can't come up with 
anything...

 P.S. Sorry for my bad english!




 --
 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] Polls?

2002-11-08 Thread Mihail Bota
Leif,

off the wall...what if you have a table for question, identified with an
unique ID, and another where you store the results? BTW: how are the
questions? Yes/No, or multiple choices, or combination of these two
styles?


On Fri, 8 Nov 2002, Leif K-Brooks wrote:

 The problem is, I need to make a page that shows all of the polls, and
 one query per poll would kill the server.

 Peter Beckman wrote:

 Use the dual table questions and answers suggestion before.
 
 Then just use a loop:
 
 $question = mysql_query(select * from questions where id={$this_question});
 while ($r = mysql_fetch_array($question)) {
$answers = mysql_query(select * from answers where qid={$r[id]});
while ($s = mysql_fetch_array($answers)) {
print question input and labels;
}
 }
 
 On Fri, 8 Nov 2002, Leif K-Brooks wrote:
 
 
 
 I'm working on a polling system, and I'm having a bit of a problem.  I'm
 not sure how to store the questions.  Storing them in a seperate table
 would require a query for each poll displayed - not good.  I've also
 thought of storing them as a serialized array.  Any thoughts on this?
 
 --
 The above message is encrypted with double rot13 encoding.  Any unauthorized 
attempt to decrypt it will be prosecuted to the full extent of the law.
 
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 ---
 Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
 [EMAIL PROTECTED] http://www.purplecow.com/
 ---
 
 
 
 

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





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




Re: [PHP-DB] Dealing with Unchecked Checkboxes

2002-10-26 Thread Mihail Bota
Try to assign a value for each of these variables, or elements of array.
If it is checked let's say is =1,otherwise=0. Then grab the whole set of
variables with GET_VARS or something like this. Create the new array in
the page where you insert data, and then use if's to insert data in your
tables.
I am pretty sure is not the cleanest way, but I hope it makes sense.

Mihai

On Sat, 26 Oct 2002, Micah Stevens wrote:

 Unchecked checkboxed do not return a value. They don't return a NULL or
 empty string or anything. So what you have to do is check to see if the
 variable is set. If it is set, then it's checked, if it's not set, then
 it's unchecked.

 Kinda sucks if your variable names are dynamic, I just erase the whole
 record and re-insert in that case.

 -Micah


 At 09:02 PM 10/26/2002 +0100, Graeme McLaren wrote:
 Hey all, I'm trying to get my head around checkboxes.  I can insert
 checked checkboxes into a DB no problem but I get an error when the
 checkboxes are unchecked.  I've used the following to try and handle
 unchecked checkboxes but I still get the error query was empty can
 anyone point me in the right direction?
 
 
 $number=count($GiftWrapping);
   for($a=0;$a$number;$a++)
 {
   echo $GiftWrapping[$a];
   if ( empty( $GiftWrapping ) )
   {
   $GW = 'N';
   }
 
 INSERT INTO DB CODE HERE
 
 GiftWrapping = '$GW';
 
 }
 
 
 Cheers in advance,
 
 Graeme :)
 
 
 Public Sub House()
 
 On Error Resume drink
 
   If Pint.empty = True Then
   Pint.refill
 Else
   Pint.drink
   End if
 
 stomach.add Pint
 
 MsgBox  I've had    stomach.count   Pints
 MsgBox VERY DRUNK
 
 End Sub



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




Re: [PHP-DB] Dealing with Unchecked Checkboxes

2002-10-26 Thread Mihail Bota
I think you should a loop under the form.
my 2 cents...

Mihai

On Sat, 26 Oct 2002, Graeme McLaren wrote:

 Mihail, do u mean something like this?

 ?
 if (!isset($pick)) {
 echo Fill out and submit the form below.; }
 else {
 $j = count($pick);
 for($i=0; $i$j; $i++) {
 echo Pick b$pick[$i]/b is Checkedbr /; }
 }
 ?

 form action=? echo $PHP_SELF; ?
 ol
 liPaintinginput name=pick[] type=checkbox value=Painting //li
 liPlumbinginput name=pick[] type=checkbox value=Plumbing //li
 liElectricinput name=pick[] type=checkbox value=Electric //li
 /ol

 input type=submit value=Submit! /
 input type=reset value=Reset /
 /form


 Cheers,

 Graeme :)

 - Original Message -
 From: Mihail Bota [EMAIL PROTECTED]
 To: Micah Stevens [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Saturday, October 26, 2002 10:01 PM
 Subject: Re: [PHP-DB] Dealing with Unchecked Checkboxes


  Try to assign a value for each of these variables, or elements of array.
  If it is checked let's say is =1,otherwise=0. Then grab the whole set of
  variables with GET_VARS or something like this. Create the new array in
  the page where you insert data, and then use if's to insert data in your
  tables.
  I am pretty sure is not the cleanest way, but I hope it makes sense.
 
  Mihai
 
  On Sat, 26 Oct 2002, Micah Stevens wrote:
 
   Unchecked checkboxed do not return a value. They don't return a NULL or
   empty string or anything. So what you have to do is check to see if the
   variable is set. If it is set, then it's checked, if it's not set, then
   it's unchecked.
  
   Kinda sucks if your variable names are dynamic, I just erase the whole
   record and re-insert in that case.
  
   -Micah
  
  
   At 09:02 PM 10/26/2002 +0100, Graeme McLaren wrote:
   Hey all, I'm trying to get my head around checkboxes.  I can insert
   checked checkboxes into a DB no problem but I get an error when the
   checkboxes are unchecked.  I've used the following to try and handle
   unchecked checkboxes but I still get the error query was empty can
   anyone point me in the right direction?
   
   
   $number=count($GiftWrapping);
 for($a=0;$a$number;$a++)
   {
 echo $GiftWrapping[$a];
 if ( empty( $GiftWrapping ) )
 {
 $GW = 'N';
 }
   
   INSERT INTO DB CODE HERE
   
   GiftWrapping = '$GW';
   
   }
   
   
   Cheers in advance,
   
   Graeme :)
   
   
   Public Sub House()
   
   On Error Resume drink
   
 If Pint.empty = True Then
 Pint.refill
   Else
 Pint.drink
 End if
   
   stomach.add Pint
   
   MsgBox  I've had    stomach.count   Pints
   MsgBox VERY DRUNK
   
   End Sub
  
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 


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






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




Re: [PHP-DB] Inserting checkbox data

2002-10-25 Thread Mihail Bota
Graeme,

first, extend the for loop over the if and the query for insertion of
data. As you have it now, it just inserts the last element of the array.
second, I think that the for loop should be $a$number. if you put =,
then the loop is processing the array with the last value not assigned by
you (an extra element in the array).
Hope it helps.

Mihai

On Fri, 25 Oct 2002, Graeme McLaren wrote:

 Hi all, I'm having a problem inserting a value from a checkbox into a MySQL DB.  I 
can print out what the variable holds, the problem is it just won't go into the DB.  
Weird thing is when I login to SSH there isn't a NULL value for it instead that field 
is just blank.

 Anyone got any ideas what the problem is?


 The HTML that is used for the checkbox is:

 Gift Wrapping: input type=checkbox Name=GiftWrapping[] Value=\Y\


 So it should theoretically insert Y into the DB

 Here is the code that appears to be causing the problem:

 $number=count($GiftWrapping);
  for($a=0;$a=$number;$a++)
  {
  echo $GiftWrapping[$a];
  $GW = $GiftWrapping[$a];
  echo $GW;
  }

 if ($Submit == Submit) {
   $sql = INSERT INTO SiteMember SET
 FirstName = '$FirstName',
 LastName = '$LastName'
 Username = '$Username',
 Password = '$Password',
 GiftWrapping = '$GW';
  }


 Thank you in advance for any help.

 Graeme :)


 Public Sub House()

 On Error Resume drink

  If Pint.empty = True Then
  Pint.refill
Else
  Pint.drink
  End if

 stomach.add Pint

 MsgBox  I've had    stomach.count   Pints
 MsgBox VERY DRUNK

 End Sub




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




RE: [PHP-DB] URGET HELP : Logic Help - for first record do_this f oreach record after do_that

2002-10-25 Thread Mihail Bota
Why not use the for loop to post the values?
for ($i=0; $i$num_rows, $i++) {
if ($i==0) {

bla bla
}
else {
bla2 bla2
}
}
$i=0 ensures that the first record of his query is retrieved.

On Fri, 25 Oct 2002, Hutchins, Richard wrote:
 What about wrapping your logic in a counter? Set $count=1,
 if($count=1){do_this; then $count++;} else{do_that}. Wouldn't really add any
 overhead to your script since the counter only gets incremented once when
 the if() statement is true then stays at 2 and executes the else{} stuff
 after that.

 Pretty stupid solution and maybe not the most elegant, but you DID say
 URGENT.

 I just read Paul's post. This is pretty similar.

  -Original Message-
  From: Aaron Wolski [mailto:aaronjw;martekbiz.com]
  Sent: Friday, October 25, 2002 2:54 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] URGET HELP : Logic Help - for first record
  do_this for
  each record after do_that
 
 
 
  Hey guys,
 
  Not really off topic as this involves some Db work as I have to query
  the DB.
 
  Got a logic problem that was jumped dumped on me from UPS (dummys!).
 
  Basically I need to pull some records out of a database and for the
  first record do_this logic and for each record after in the array
  do_something_else logic.
 
  How would I approach this?
 
  something like:
 
  for ($first_record) {
 
  do_something;
 
  } else {
 
  do_something_else;
 
  }
 
  Any clues?
 
  Thanks!
 
  Aaron
   -Original Message-
   From: Graeme McLaren [mailto:mickel;ntlworld.com]
   Sent: Friday, October 25, 2002 2:40 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP-DB] Inserting checkbox data
  
  
   Hi all, I'm having a problem inserting a value from a
   checkbox into a MySQL DB.  I can print out what the variable
   holds, the problem is it just won't go into the DB.  Weird
   thing is when I login to SSH there isn't a NULL value for it
   instead that field is just blank.
  
   Anyone got any ideas what the problem is?
  
  
   The HTML that is used for the checkbox is:
  
   Gift Wrapping: input type=checkbox Name=GiftWrapping[] Value=\Y\
  
  
   So it should theoretically insert Y into the DB
  
   Here is the code that appears to be causing the problem:
  
   $number=count($GiftWrapping);
for($a=0;$a=$number;$a++)
{
echo $GiftWrapping[$a];
$GW = $GiftWrapping[$a];
echo $GW;
}
  
   if ($Submit == Submit) {
 $sql = INSERT INTO SiteMember SET
   FirstName = '$FirstName',
   LastName = '$LastName'
   Username = '$Username',
   Password = '$Password',
   GiftWrapping = '$GW';
}
  
  
   Thank you in advance for any help.
  
   Graeme :)
  
  
   Public Sub House()
  
   On Error Resume drink
  
If Pint.empty = True Then
Pint.refill
  Else
Pint.drink
End if
  
   stomach.add Pint
  
   MsgBox  I've had    stomach.count   Pints
   MsgBox VERY DRUNK
  
   End Sub
  
  
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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






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




Re: [PHP-DB] Pedigree question

2002-10-06 Thread Mihail Bota

Yes, there are. There is a pretty good php code, called HTML Tree which
can make trees, dynamically.

Regarding the coding itself...you can have a simple table that records who
is ancestor of who. This is a solution. Another one, which is not so neat
is to create a table with 5 columns...one per generation.
Does this make sense?

Mihai
On Sun, 6 Oct 2002, Russell Griechen wrote:

 I need to develop a tree-like pedigree of animals up to 5 generations.
 I know there are other attributes to the animal; but do I need anyother
 tables...assuming that I can develop all the code to generate these
 ancestors.
 I have developed a CSS positioning code that will place these results in a
 neat 5 generation tree.
 Is there any other alternatives?

 Animal
   ID
   Name

 Foal
   ID
   SireID
   DamID

 Russell Griechen
 htttp://sportsmenafield.com
 Russell Griechen


 --
 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] Pedigree question

2002-10-06 Thread Mihail Bota

No, that is not the link. I am using this code:
http://pear.php.net/package-info.php?pacid=77

There are many tree codes out there. Just try to use one.

On Sun, 6 Oct 2002, Russell Griechen wrote:


 Mihail Bota [EMAIL PROTECTED]wrote:


  Yes, there are. There is a pretty good php code, called HTML Tree which
  can make trees, dynamically.

 I did a search in the Php Manual...but did not understand what I was looking
 at.
 http://www.php.net/manual/sv/printwn/ref.domxml.php
 I will look closer...Is this the link you were referring to.

  Regarding the coding itself...you can have a simple table that records who
  is ancestor of who. This is a solution. Another one, which is not so neat
  is to create a table with 5 columns...one per generation.
  Does this make sense?

 I must only enter an animal once ...and I want to have users update the
 database...sort of a DMOZ directory...with an editor/moderator approach for
 the different breeds/animals.
 I would like to have someone comment on whether the 2 tables mentioned would
 suffice and what functions...or code would be better to apply.
 Michael Koifler  sp?  in a book is purported to have a solution for
 heirarchical display...but I am over budget now on this project so if any
 one has seen this book and could help I would appreciate the code...until I
 can afford the book.
 see the tables in the original post below.

 Russell Griechen
 htttp://sportsmenafield.com

  On Sun, 6 Oct 2002, Russell Griechen wrote:
 
   I need to develop a tree-like pedigree of animals up to 5 generations.
   I know there are other attributes to the animal; but do I need anyother
   tables...assuming that I can develop all the code to generate these
   ancestors.
   I have developed a CSS positioning code that will place these results in
 a
   neat 5 generation tree.
   Is there any other alternatives?
  
   Animal
 ID
 Name
  
   Foal
 ID
 SireID
 DamID






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




Re: [PHP-DB] Categorized list?

2002-09-26 Thread Mihail Bota

Leif,

You may want to look over the system I am creating. It is for
neurobiology, but it uses categories. The URL
is http://brancusi.usc.edu/bkms
I am using both trees and colors.

Regarding your specific problem, you have to have an indexing table, which
will make the necessary relations between the different objects.

Mihai

On Thu, 26 Sep 2002, Leif K-Brooks wrote:

 I'm trying to create a system to store virtual objects.  Each object
 will be in a category, and the categories may be in other categories.
  The categorie list might look something like:
 Food
 Candy
 Healthy Food
 Vegeterian food
 Organic food
 Gross food

 I'm thinking of a datbase structure for the categorys something like:
 id (int, auto_inc, primary)
 name (text)
 insideof(int, id of other catrgory which this one is inside of)

 The problem is, I need to generate an indented list such as I showed
 before.  I know how to do this with a lot of colors (selecting what each
 category contains, etc.), but is there a more effieient way?  I use
 mysql.  Thanks for any ideas.



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




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




Re: [PHP-DB] Ranking in MySQL

2002-08-09 Thread Mihail Bota

David,

Your question is a little bit unclear.
First, if it is rank, you do not need decimal, but integer (tinyint will
do it). Then you need a little bit of statistics to rank the picture
against the others, so, anytime each picture is ranked, you have to run
the statistics and update the table (update images set rating=... where
image_id=...).
Then, in order to post the rank, just extract max(rating) (something like
select max(rating) as ... from images) and then extract the rank of the
image (select decimal from images where image_id=...) and you'll have
what you need.

Hope this helps and I did not write to many stupid things:)

Mihai

On Fri, 9 Aug 2002, David Balatero wrote:

 I have a MySQL table called images, each with a rating from 1-10. The column is a 
decimal(10,2). For simplicity's sake, let's say i have the following:

 CREATE TABLE images (
   image_id int not null auto_increment,
   image_path varchar(255) not null,
   rating decimal(10,2) not null,
   primary key(image_id)
 );


 What I'm looking to do is be able to pull from the database the ranked position each 
image is in. I.e. this image is ranked 70 out of 121

 Any suggestions on a MySQL query that could do this?

 Thanks,
 David Balatero
 [EMAIL PROTECTED]



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




RE: [PHP-DB] protecting

2002-02-11 Thread Mihail Bota

correct!

On Tue, 12 Feb 2002, Beau Lebens wrote:

 you might find the library at http://www.dentedreality.com.au/jsvalidation/
 useful, but you should also perform similar checks server-side using PHP
 since if you are that worried about malicious use of your site, people can
 easily circumvent javascript validation
 
 // -Original Message-
 // From: Mihail Bota [mailto:[EMAIL PROTECTED]]
 // Sent: Tuesday, 12 February 2002 12:19 PM
 // To: CrossWalkCentral
 // Cc: [EMAIL PROTECTED]
 // Subject: Re: [PHP-DB] protecting
 // 
 // 
 // put some javascript validation form. if the value of the form cntains
 // .jpg, etc. don't allow the user to go further.
 // 
 // On Mon, 11 Feb 2002, CrossWalkCentral wrote:
 // 
 //  How can I help protect people form modifying a form that 
 // submits data to php file that stores the data in a database
 //  
 //  for example I have a text box that ask for a first name 
 // and I am getting a lot of garbage back like if they modified 
 // my form and submitted a image instead.
 //  
 //  I know that their is some sort of parse out their that I 
 // can put in the php file that will help validate this
 //  
 // 
 // 
 // -- 
 // 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] if variable is equal to 2 through 4

2002-02-06 Thread Mihail Bota

try this:
if ($v=2  $v=4) {
echo ...;
}

mihai
On Wed, 6 Feb 2002, Jay Fitzgerald wrote:

 i am currently using this code:
 
 if ($variable == 2) || ($variable == 3) || ($variable == 4)
 {
 echo hello;
 }
 
 how would I write it if I wanted to say this:
 
 if $variable == 2 through 4 ???
 
 
 
 Should you have any questions, comments or concerns, feel free to call me 
 at 318-338-2034.
 
 Thank you for your time,
 
 Jay Fitzgerald, Design Director - CSBW-A, CPW-A, CWD-A, CEMS-A
 ==
 Bayou Internet..(888) 
 30-BAYOUhttp://www.bayou.com
 Mississippi Internet...(800) 
 MISSISSIPPI...http://www.mississippi.net
 Vicksburg Online..(800) 
 MISSISSIPPIhttp://www.vicksburg.com
 ==
 Tel: (318) 338-2034ICQ: 38823829 Fax: 
 (318) 323-5053
 
 
 -- 
 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] Creating a pdf document

2002-01-24 Thread Mihail Bota


Thanks a lot guys! This really helps a lot.

MySql is not installed on my machine, so it would take a while to install
all the necessary libraries. I'll stick with the material given by Daniel,
for the moment.

Mihai


-- 
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] Creating a pdf document

2002-01-23 Thread Mihail Bota

Hello,

I was wondering if I could save the result of a query in a pdf document. I
looked for any functions that might help, but I got confused because I
could not see how/where exactly to insert the necessary .dll's. I'd like
to do this (saving the output of a query) by using mysql installed on a
Irix machine, and PHP4.
If this is not possible, could I create a pdf document or a word document
from a query from either Access database or mysql on a win2k system,
PHP4.1?
Any references that might help?
Thanks for your help!

Mihai


-- 
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] Input to DB from form

2002-01-03 Thread Mihail Bota

check if all your fields are indeed strings (char, varchar) and not
numbers.


Mihail Bota

On Thu, 3 Jan 2002, James Kupernik wrote:

 I'm trying to input that data entered into a form into a table in my DB.
 Here is the code I have.

 $db = mysql_connect(localhost,cloft,spring);

   mysql_select_db(countryloft,$db);

   $sql = INSERT INTO catalogreq
 (BFNAME,BLNAME,ADD1,ADD2,BCITY,BZIPA,BSTATE,BCTRY,BTELO,DATE) VALUES
 ('$BFNAME','$BLNAME','$BADD1','$BADD2','$BCITY','$BZIPA','$BSTATE','$BCTRY',
 '$BTELO','$TODAY');

 This is embedded in an HTML document and loads the entire document, but
 doesn't add the information to the table. Any help would be wonderful!

 James



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




Re: [PHP-DB] Passing parameter in Paging

2001-12-28 Thread Mihail Bota

Bogdan, in this respect, I have a question: can I pass the values of
javascript variables to php variables? if yes, how?

Mihai

On Fri, 28 Dec 2001, Bogdan Stancescu wrote:

 I don't understand why you won't use forms with buttons and hidden controls
 since you know about this solution. I have two suggestions along this line:
 1. You probably don't want buttons on the page -- you may use image icons
 instead (similar to a tape recorder's play and fast forward for next page
 and last page)
 2. If you don't want to use images either, you may use regular links with
 href='javascript:document.nextPage.submit()' where nextPage would be the form
 name with the page forward data -- and so on.

 HTH

 Bogdan

 Karthikeyan wrote:

  Dear members,
  I am querying a Mysql database, which will result in 100 of records. I want
  to display 10 records in each page. First page it is working fine. When I
  navigate to second page it is not working.
  When I used hidden controls. Hidden controls send the details to next
  page only by using submit button and not by hyperlink
  When I used session variable. After one set of searching was over. When
  I trying for second search string without closing browser, changing the
  search string in the first search page it is still showing the old search
  string, unless I close the browser.
  Any solution for my problem
  Thanking you
  yours
  Karthikeyan
 
  --
  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]




-- 
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] problems in connecting Access database

2001-11-26 Thread Mihail Bota

Hello,

I know this may be a stupid question, but I've looked everywhere for help
and since I could not resolve the problem myself, I am asking your help.

The problem is simple: i have an Access 2000 database (Windows 2000,
IIS5.0) that
i want to query it using php4.06.
I've added the database at the ODBC driver, the path to it is okay, but
when I try to run the simple thing like:

$conn = odbc_connect( 'test' , ' ', ' ' );

where test is the name of that database, then the output is smth. like

Warning: SQL error: [Microsoft][ODBC Driver Manager] Data source name not
found and no default driver specified, SQL state IM002 in SQLConnect in
c:\inetpub\wwwroot\test.php on line 11

Does anybody have any idea why this thing is happening and how I can solve
the problems?

Thanks!
Mihai


-- 
PHP Windows 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]