[PHP] Columns not displaying as they should

2002-05-01 Thread Jennifer Downey

Hi to everyone,

I am having trouble with this snip and wonder if you might help?

This is suppose to display the items 5 accross the browser instead it
displays them down like this:

item 1
item 2
item 3

I want them displayed like this:

item1 item 2 item 3

but for some odd reason it wont any ideas why?

if ($main == shop)
{
$get_shop_data = mysql_fetch_array(mysql_query(SELECT * FROM wt_items WHERE
id = '$shopid'));
$get_items = mysql_query(SELECT * FROM wt_instock WHERE shop = '$shopid'
AND howmany  '0');
while ($items_result = mysql_fetch_array($get_items))
{
$item_info = mysql_fetch_array(mysql_query(SELECT * FROM wt_items WHERE id
= '$items_result[item]'));
$column++;

$display_block =a
href=$php_self?main=buyitemitemid=$items_result[id]img
src=images/items/$item_info[image] height=75 width=75BRB
$item_info[name]/B/aBR $items_result[howmany] in stockBRCost:
$items_result[price]BR
;
echo table cellSpacing=0 cellPadding=0 width=\100%\ border=0trtd
width = \100\$display_block/td;

 if ($column  5)
 {
  echo /trtr;
  $column = 1;
 }
   echo/table;
}
}

Thanks for your time and help
Jennifer
--
The sleeper has awaken


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




[PHP] mail() through a form

2002-04-26 Thread Jennifer Downey

Hello to all,

I have a mail script with a set of options in a dropdown list that I'm
hoping you can help with.
Here is the part I wish to get working then after that I can do the rest

What I need this to do is send the users name, email address, the option in
the drop down list, and the message. I can't seem to get it to do this could
someone point out what I have done wrong?

$query = SELECT * FROM {$config[prefix]}_users WHERE uid =
{$session[uid]};
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$name = $row['name'];
$email = $row['email'];
if($submit)
{
if($automail == 'abuse')
{
$From = $name;
$to = [EMAIL PROTECTED];
mail( $to, $From, $email, $message );
}
else
{
else
{
echoFORM ACTION='$PHP_SELF' METHOD='POST' TITLE='contact';

echo brbrbrbrbrYour User Name: $name;
echo brbrYour Email Address: $emailbrDid your emailbrchange? a
href='myaccount.php'Click hereBRBR/a;

echo This is a ;
echo SELECT NAME='automail' SIZE='1';
echo OPTION VALUE='abuse'Abuse/OPTION;
echo OPTION VALUE='bug'Bug/OPTION;
echo OPTION VALUE='job'Employment/OPTION;
echo /SELECT ReportBR;

echo The message isBR;
echo TEXTAREA NAME='message'  ROWS='10' COLS='40';
echo /TEXTAREA;
echo BRINPUT TYPE='submit' VALUE='Send Report' NAME='submit';

echo /FORM;
}

Thanks
Jennifer

--
The sleeper has awaken


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




[PHP] Redirect

2002-04-25 Thread Jennifer Downey

Hi to all,

I am wondering if there are other ways to redirect users other than using
header()?

I have a script that if the user doesn't have enough money to buy an item
then it directs to one page and if they do then it directs them back to the
referring page.

Is this possible?


Thanks
Jennifer

--
The sleeper has awaken


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




[PHP] If else question

2002-04-23 Thread Jennifer Downey

Hi all,

I am wondering. When you use an if else statement and a condition exists
isn't the if part suppose to stop?
Then if the condition doesn't exist it is suppose to do something else?

I am wondering because I have a form that goes something like this.

select such and such from the table
if that condition  1
echo that it can't be found
else
echo the form

But in this case even if the condition  1 it still echoes the form.
I am not understanding this.


Thanks for your time and help
Jennifer




--
The sleeper has awaken


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey


 If and else expect to be followed by exactly 1 statement. To aggregate
 multiple statements as one, surround them with {curly braces}. I'm
 guessing you didn't do that, and you're seeing the execution of all but
 the first of the statements following the else.

 So it should be:

   if ($var1)
 echo can't be found;
   else
   {
 echo first line of form;
 echo second line of form;
   }
This is what I have:

if($quantity  1)
{
echo Sorry I can't seem to locate this item;
}
else
{
do this
}
So yes I have done exactly as you have stated and it still shows the form.

Jennifer


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey

It shows both.

Natalie Leotta [EMAIL PROTECTED] wrote in message
7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG...
 Does it show the message and the form or just the message?

 -Natalie

 -Original Message-
 From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, April 23, 2002 12:23 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] If else question



  If and else expect to be followed by exactly 1 statement. To aggregate
  multiple statements as one, surround them with {curly braces}. I'm
  guessing you didn't do that, and you're seeing the execution of all
  but the first of the statements following the else.
 
  So it should be:
 
if ($var1)
  echo can't be found;
else
{
  echo first line of form;
  echo second line of form;
}
 This is what I have:

 if($quantity  1)
 {
 echo Sorry I can't seem to locate this item;
 }
 else
 {
 do this
 }
 So yes I have done exactly as you have stated and it still shows the form.

 Jennifer


 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




Re: [PHP] Browser cache

2002-04-23 Thread Jennifer Downey

PLEASE TAKE THIS OUT OF MY THREAD.
I am trying to get an answer to my question. Not yours.

Thank you
Jennifer
Stuart Dallas [EMAIL PROTECTED] wrote in message
000d01c1eae5$96243450$de01420a@stuart">news:000d01c1eae5$96243450$de01420a@stuart...
 José León Serna [EMAIL PROTECTED] wrote:
  Hello:
  How could I disable the browser cache?, I have a script that
  generates an image and shows it via IMG SRC=myimage. The problem
  is if I change the image, the browser doesn't reflect the changes
  until I push refresh. I supose is sending a header, but which header?

 Headers aren't the best way since some browsers do a great job of ignoring
 them (or at least appearing to). The best way I've found to make sure the
 content is retrieved from the server is to add ?n to the URL replacing
 randomnumber with a random number (I usually use the return value from
 time()).

 HTH,
 Stuart



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey


I just looked at my hosting service thinkg it may have been because they
just upgraded to 4.1 php. so I dumped my database and loaded it to my
machine at home and find that it does the same thing.

I have 4.06 php on win me my hosting service is 4.1 php on redhat linux so
I'm thinking that is not the case.

I have used this code through out my site and this is the only part it does
this on and I am not understanding why.

Jennifer




Natalie Leotta [EMAIL PROTECTED] wrote in message
7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC4@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC4@SSIMSEXCHNG...
 My officemate and I talked about this and the only thing he could come up
 with was a possible problem with your parser.  Are you using a beta
version
 or something unusual?  I don't know if you have a way to know this - the
 programmers didn't set up PHP where I work, but I know our web server is
 apache and it's on a unix box.  I've never run into this problem before.
 Have you had it happen in other programs?  Have you ever used this code in
 another program?  If it's consistently incorrect then it may be a problem
 with your parser.  That's not really my area of expertise, but it's
 something you could look into if no one else has any better ideas :-)

 -Natalie

 -Original Message-
 From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, April 23, 2002 12:26 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] If else question


 It shows both.

 Natalie Leotta [EMAIL PROTECTED] wrote in message
 7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG...
  Does it show the message and the form or just the message?
 
  -Natalie
 
  -Original Message-
  From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, April 23, 2002 12:23 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] If else question
 
 
 
   If and else expect to be followed by exactly 1 statement. To
   aggregate multiple statements as one, surround them with {curly
   braces}. I'm guessing you didn't do that, and you're seeing the
   execution of all but the first of the statements following the else.
  
   So it should be:
  
 if ($var1)
   echo can't be found;
 else
 {
   echo first line of form;
   echo second line of form;
 }
  This is what I have:
 
  if($quantity  1)
  {
  echo Sorry I can't seem to locate this item;
  }
  else
  {
  do this
  }
  So yes I have done exactly as you have stated and it still shows the
  form.
 
  Jennifer
 
 
  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php


 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey

No this is the first if statement but there are nested if's after that. I'd
post the code but everyone yells at me about my coding style.
If you promise not to yell I will post it.

Jennifer
-Bd- [EMAIL PROTECTED] wrote in message
001d01c1eae9$d58f4360$[EMAIL PROTECTED]">news:001d01c1eae9$d58f4360$[EMAIL PROTECTED]...
 Is this a nested if? (inside another if statement?)




 - Original Message -
 From: Jennifer Downey [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, April 23, 2002 1:05 PM
 Subject: Re: [PHP] If else question


 
  I just looked at my hosting service thinkg it may have been because they
  just upgraded to 4.1 php. so I dumped my database and loaded it to my
  machine at home and find that it does the same thing.
 
  I have 4.06 php on win me my hosting service is 4.1 php on redhat linux
so
  I'm thinking that is not the case.
 
  I have used this code through out my site and this is the only part it
 does
  this on and I am not understanding why.
 
  Jennifer
 
 
 
 
  Natalie Leotta [EMAIL PROTECTED] wrote in message
  7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC4@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC4@SSIMSEXCHNG...
   My officemate and I talked about this and the only thing he could come
 up
   with was a possible problem with your parser.  Are you using a beta
  version
   or something unusual?  I don't know if you have a way to know this -
the
   programmers didn't set up PHP where I work, but I know our web server
is
   apache and it's on a unix box.  I've never run into this problem
before.
   Have you had it happen in other programs?  Have you ever used this
code
 in
   another program?  If it's consistently incorrect then it may be a
 problem
   with your parser.  That's not really my area of expertise, but it's
   something you could look into if no one else has any better ideas :-)
  
   -Natalie
  
   -Original Message-
   From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, April 23, 2002 12:26 PM
   To: [EMAIL PROTECTED]
   Subject: Re: [PHP] If else question
  
  
   It shows both.
  
   Natalie Leotta [EMAIL PROTECTED] wrote in message
   7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG...
Does it show the message and the form or just the message?
   
-Natalie
   
-Original Message-
    From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 23, 2002 12:23 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] If else question
   
   
   
 If and else expect to be followed by exactly 1 statement. To
 aggregate multiple statements as one, surround them with {curly
 braces}. I'm guessing you didn't do that, and you're seeing the
 execution of all but the first of the statements following the
else.

 So it should be:

   if ($var1)
 echo can't be found;
   else
   {
 echo first line of form;
 echo second line of form;
   }
This is what I have:
   
if($quantity  1)
{
echo Sorry I can't seem to locate this item;
}
else
{
do this
}
So yes I have done exactly as you have stated and it still shows the
form.
   
Jennifer
   
   
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
   
   
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
  
  
   ---
   Outgoing mail is certified Virus Free.
   Checked by AVG anti-virus system (http://www.grisoft.com).
   Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey

Ok you asked for it.
Don't say I didn't warn you.

session_start();
$query = SELECT name FROM {$config[prefix]}_users WHERE
uid={$session[uid]};
$ret = mysql_query($query);
while($row = mysql_fetch_array($ret))
{

$user = $row['name'];



$query = SELECT uid, id, iname, image, quantity, type FROM
{$config[prefix]}_my_items WHERE uid={$session[uid]} AND id = '$id'
ORDER BY id;
$ret = mysql_query($query);
while($row = mysql_fetch_array($ret))
{
  $uiid = $row['uid'];
 $iid = $row['id'];
  $image = $row['image'];
  $iname = $row['iname'];
  $quantity = $row['quantity'];
  $type = $row['type'];
// this is the problem if statement. Please don't yell at me for my style.
It is easy for me to read so I'm sorry if it's not for you.
if($quantity  1)
{
echo Sorry I can't seem to locate this item;
}
else
{

session_register(uiid);
session_register(iid);
session_register(image);
session_register(iname);
session_register(quantity);
session_register(type);


   if($iid == $id)
   {

$display_block .=CENTERimg src=$image border=0brfont size =
2$inameBR$quantityBR$typeBR/font/CENTER;

echo $display_blockBRBR;

  if($type == food)
  //if the item food is present then set an option and include in the
form later
  {
   $thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION;
  }
 else
{
//if book or weapon is present then set a blank
$thisoption=;
   }
  }
}
}
}
//check if form has been submitted
if($submit)
{

}
else
{

//if the form has not been submitted run the following


   echo FORM ACTION='$PHP_SELF' METHOD='post';
   echo SELECT NAME='sort' SIZE='1' ;
   echo $thisoption;
   echo OPTION VALUE='shop'Put in my shop/OPTION;
   echo OPTION VALUE='locker'Put into my Footlocker/OPTION;
   echo OPTION VALUE='discard'Discard this item/OPTION;
   echo OPTION VALUE='donate'Donate this item/OPTION;
   echo /SELECT;
   echo INPUT TYPE='submit' VALUE='Submit' NAME='submit';
   echo /FORM;


}

Jennifer



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey

You  are on the right track.
-Bd- [EMAIL PROTECTED] wrote in message
00a301c1eaf3$b181a260$[EMAIL PROTECTED]">news:00a301c1eaf3$b181a260$[EMAIL PROTECTED]...
 am i off on the wrong track here? i thought the original problem was that
 both clauses in the if statement were exectuting (the 'if' and the
'else')?






  Now, we're getting somewhere!!!
 
  First, have you printed out $query to ensure it contains what you
 expected?
  Show us.
 
  Second, are you certain the mysql_query() is successful?  I ask, because
 you
  don't have the or die() that SHOULD be on all queries.
 
  Third, have you printed out all the values fetched via
mysql_fetch_array()
  to ensure they contain valid data?
 
  - Original Message -
  From: Jennifer Downey [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Tuesday, April 23, 2002 12:48 PM
  Subject: Re: [PHP] If else question
 
 
  Ok you asked for it.
  Don't say I didn't warn you.
 
  session_start();
  $query = SELECT name FROM {$config[prefix]}_users WHERE
  uid={$session[uid]};
  $ret = mysql_query($query);
  while($row = mysql_fetch_array($ret))
  {
 
  $user = $row['name'];
 
 
 
  $query = SELECT uid, id, iname, image, quantity, type FROM
  {$config[prefix]}_my_items WHERE uid={$session[uid]} AND id = '$id'
  ORDER BY id;
  $ret = mysql_query($query);
  while($row = mysql_fetch_array($ret))
  {
$uiid = $row['uid'];
   $iid = $row['id'];
$image = $row['image'];
$iname = $row['iname'];
$quantity = $row['quantity'];
$type = $row['type'];
  // this is the problem if statement. Please don't yell at me for my
style.
  It is easy for me to read so I'm sorry if it's not for you.
  if($quantity  1)
  {
  echo Sorry I can't seem to locate this item;
  }
  else
  {
 
  session_register(uiid);
  session_register(iid);
  session_register(image);
  session_register(iname);
  session_register(quantity);
  session_register(type);
 
 
 if($iid == $id)
 {
 
  $display_block .=CENTERimg src=$image border=0brfont size =
  2$inameBR$quantityBR$typeBR/font/CENTER;
 
  echo $display_blockBRBR;
 
if($type == food)
file://if the item food is present then set an option and include
in
  the
  form later
{
 $thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION;
}
   else
  {
  file://if book or weapon is present then set a blank
  $thisoption=;
 }
}
  }
  }
  }
  file://check if form has been submitted
  if($submit)
  {
 
  }
  else
  {
 
  file://if the form has not been submitted run the following
 
 
 echo FORM ACTION='$PHP_SELF' METHOD='post';
 echo SELECT NAME='sort' SIZE='1' ;
 echo $thisoption;
 echo OPTION VALUE='shop'Put in my shop/OPTION;
 echo OPTION VALUE='locker'Put into my Footlocker/OPTION;
 echo OPTION VALUE='discard'Discard this item/OPTION;
 echo OPTION VALUE='donate'Donate this item/OPTION;
 echo /SELECT;
 echo INPUT TYPE='submit' VALUE='Submit' NAME='submit';
 echo /FORM;
 
 
  }
 
  Jennifer




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey

Ok I have hard coded $quantity so it does = 0 and else still prints.
Maxim Maletsky ) [EMAIL PROTECTED] wrote in message
004701c1eaf1$c915c6b0$92e3021a@machine52">news:004701c1eaf1$c915c6b0$92e3021a@machine52...

 Try this, Jennifer:

 Without messing the rest of your code, change the line:

 $quantity = $row['quantity'];

 With this one:

 $quantity = 0;

 In other words: hardcode it for testing.

 If else always prints, then you are missing something in your query.
 Otherwise you've got something wrong in your code.





 Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 www.PHPBeginner.com   // where PHP Begins




 -Original Message-
 From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, April 23, 2002 7:48 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] If else question


 Ok you asked for it.
 Don't say I didn't warn you.

 session_start();
 $query = SELECT name FROM {$config[prefix]}_users WHERE
 uid={$session[uid]}; $ret = mysql_query($query); while($row =
 mysql_fetch_array($ret)) {

 $user = $row['name'];



 $query = SELECT uid, id, iname, image, quantity, type FROM
 {$config[prefix]}_my_items WHERE uid={$session[uid]} AND id = '$id'
 ORDER BY id; $ret = mysql_query($query); while($row =
 mysql_fetch_array($ret)) {
   $uiid = $row['uid'];
  $iid = $row['id'];
   $image = $row['image'];
   $iname = $row['iname'];
   $quantity = $row['quantity'];
   $type = $row['type'];
 // this is the problem if statement. Please don't yell at me for my
 style. It is easy for me to read so I'm sorry if it's not for you.
 if($quantity  1) { echo Sorry I can't seem to locate this item; }
 else {

 session_register(uiid);
 session_register(iid);
 session_register(image);
 session_register(iname);
 session_register(quantity);
 session_register(type);


if($iid == $id)
{

 $display_block .=CENTERimg src=$image border=0brfont size =
 2$inameBR$quantityBR$typeBR/font/CENTER;

 echo $display_blockBRBR;

   if($type == food)
   //if the item food is present then set an option and include in
 the form later
   {
$thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION;
   }
  else
 {
 //if book or weapon is present then set a blank
 $thisoption=;
}
   }
 }
 }
 }
 //check if form has been submitted
 if($submit)
 {

 }
 else
 {

 //if the form has not been submitted run the following


echo FORM ACTION='$PHP_SELF' METHOD='post';
echo SELECT NAME='sort' SIZE='1' ;
echo $thisoption;
echo OPTION VALUE='shop'Put in my shop/OPTION;
echo OPTION VALUE='locker'Put into my Footlocker/OPTION;
echo OPTION VALUE='discard'Discard this item/OPTION;
echo OPTION VALUE='donate'Donate this item/OPTION;
echo /SELECT;
echo INPUT TYPE='submit' VALUE='Submit' NAME='submit';
echo /FORM;


 }

 Jennifer



 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey

I have it. I actually got it!

I had the if statement in the wrong place.

Here is what I did:

if($quantity 1)
{
 echo Sorry I can't seem to locate this item;
}
else
{
//check if form has been submitted
if($submit)
{
}
else
{

//if the form has not been submitted run the following


   echo FORM ACTION='sortitems.php'METHOD='post';
   echo SELECT NAME='sort' SIZE='1' ;
   echo $thisoption;
   echo OPTION VALUE='shop'Put in my shop/OPTION;
   echo OPTION VALUE='locker'Put into my Footlocker/OPTION;
   echo OPTION VALUE='discard'Discard this item/OPTION;
   echo OPTION VALUE='donate'Donate this item/OPTION;
   echo /SELECT;
   echo INPUT TYPE='submit' VALUE='Submit' NAME='submit';
   echo /FORM;
}
}
}

and it worked perfectly!

Thank you ALL for your time and help!
Jennifer

P.S. You people are wonderfull!




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




[PHP] SQL Warning

2002-04-23 Thread Jennifer Downey

Hi all,

Would you please direct your attention to this URL

http://testphp.netfirms.com/code1.html

Look at the bottom where the big orange commented syntax is and explain what
is going on there?


Thanks
Jennifer
--
The sleeper has awaken


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




Re: [PHP] Re: Using one submit button

2002-04-17 Thread Jennifer Downey

Thank you Jason and Kevin for your time and help.

Does this look like what I should have?

if(isset($update))
for ($i=0; $icount($id); $i++)
{
if ($id[$i] == $row[id])
{


 $query = UPDATE {$config[prefix]}_shop SET price = $price[$i]
where uid = {$session[uid]} AND id = $id[$i];
 $ret = mysql_query($query) or die(mysql_error());
}
else
{

 echo TD width=30%font size=2CENTERinput=\hidden\
name=\id[$i]\ value=\$id\input type=\text\ value=\\
name=\price[$i]\ size='8' MAXLENGTH='8'BR/a/CENTER/font/TD;

Jennifer

Kevin Stone [EMAIL PROTECTED] wrote in message
004301c1e633$e1e20090$6601a8c0@kevin">news:004301c1e633$e1e20090$6601a8c0@kevin...
 -
 I picked up your question soon after you submited it then my internet went
 down so I wasn't able to send it.  Looks like it's been answered by
someone
 else since then but here you go anyway.  I didn't want to feel as though
I'd
 wasted my time.  :D
 -kevin
 -

 Looks like you want to extract the values from the $price array in the
same
 order as you extracted the associated rows from the database.  At first
 glance I can say you aren't passing enough information to be able to
 determine an order for updating. You'll need to send the product ids along
 with the prices and then create a counter to loop through the ids array
and
 test each case.

 I would sugget you build an $id[] list the same way as the $price[] list
but
 generate them as hidden fields.  Then within the if(isset($update))
 statement loop through all $id values for each itteration of the while
 loop...

 for ($i=0; $icount($id); $i++)
 {
 if ($id[$i] == $row[id])
 {
 // we know that there are the same number of ids as there are
prices
 so we can use $i for the $price index as well.
 $query = UPDATE $table SET price = $price[$i] WHERE id =
$id[$i];
 // do update..
 }
 }

 -Kevin

 - Original Message -
 From: Jennifer Downey [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, April 17, 2002 10:11 AM
 Subject: [PHP] Re: Using one submit button


  I have no takers on this one?
 
  Just to let you know I have been working on this to here is some new
code.
  What I need this to do is update the price in the db table.
   if I have on item it is fine. If I have two items it won't update the
 first
   items price but will the second. if I try to enter a price in the first
   items textbox it doesn't update and then deletes the second item's
price.
 
   If I have 15 items and using one submit button how do I get this to
 update
   all items that are listed?
 
  $query = SELECT uid, id, name, image, type, quantity, price FROM
  {$config[prefix]}_shop WHERE uid = {$session[uid]};
 $ret = mysql_query($query);
 while($row = mysql_fetch_array($ret))
  {
 $uid = $row['uid'];
 $id = $row['id'];
 $name = $row['name'];
 $image = $row['image'];
 $iquantity = $row['quantity'];
 $itype = $row['type'];
 $iprice = $row['price'];
 
  if($update)
  {
   $eprice = '$price[]';
   $query = UPDATE {$config[prefix]}_shop SET price = '$eprice'
  where uid = {$session[uid]} AND id = '$id';
   $ret = mysql_query($query) or die(mysql_error());
  }
  else
  {
 
   echo TABLE BORDER='0' WIDTH='95%' CELLPADDING='0'
  CELLSPACING='0'TR;
   echo TD width=20%img src='$image'/TD;
   echo TD width=30%font size=2$name/font/TD;
   echo TD width=20%font
  size=2CENTER$iquantity/CENTER/font/TD;
   echo TD width=30%font size=2CENTERa
  href='$PHP_SELF?id=$idremove=yes'X/a/CENTER/font/TD;
   echo TD width=30%font size=2CENTERinput
type=\text\
  value=\\ name=\price[]\ size='8'
  MAXLENGTH='8'BR/a/CENTER/font/TD;
   echo /TD/TR/TABLE;
 echo input=\hidden\ name=\remove\ value=\yes\;
  }
  }
  echo CENTERINPUT TYPE=\submit\ NAME=\update\ VALUE=\Updat
  Prices\;
  echo /form;
  Jennifer Downey [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   Hi all,
  
   I thought I was going to give php a break today but I can't it's too
   adicting.
  
   I am having a little problem with a submit button in which it is
suppose
  to
   update records from a form.
  
   Here is the code
  
 

 --
  --
   
  
  
   echo BRBRa href=\locker.php\My Locker/a | a
   href=\myshop.php\My Shop/a | a href=\items.php\My
   Items/aBRBR;
   echo TABLE BORDER='0' WIDTH='95%' CELLPADDING='0'
  CELLSPACING='0'TRTD
   width=20%Bfont size=2Image/font/B/TDTD width=30%Bfont
   size=2Name/font/B/TDTD width=20%Bfont
   size=2CENTERQuantity/CENTER/font/B/TDTD width=30%Bfont
   size=2CENTERRemove Item/CENTER/font/B/TDTD
 width=30%Bfont
   size=2CENTERPrice/CENTER/font/B/TD/TR/table;
   echo FORM action='$PHP_SELF' METHOD='post';
  
$query = SELECT uid, id, name, image, type, quantity FROM
   {$conf

Re: [PHP] Re: Using one submit button

2002-04-17 Thread Jennifer Downey

Thank you Jason and Kevin for your time and help.

Does this look like what I should have?

if(isset($update))
for ($i=0; $icount($id); $i++)
{
if ($id[$i] == $row[id])
{


 $query = UPDATE {$config[prefix]}_shop SET price = $price[$i]
where uid = {$session[uid]} AND id = $id[$i];
 $ret = mysql_query($query) or die(mysql_error());
}
else
{

 echo TD width=30%font size=2CENTERinput=\hidden\
name=\id[$i]\ value=\$id\input type=\text\ value=\\
name=\price[$i]\ size='8' MAXLENGTH='8'BR/a/CENTER/font/TD;

Jennifer

Jason Wong [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 On Thursday 18 April 2002 00:11, Jennifer Downey wrote:
  I have no takers on this one?
 
  Just to let you know I have been working on this to here is some new
code.
  What I need this to do is update the price in the db table.
   if I have on item it is fine. If I have two items it won't update the
  first items price but will the second. if I try to enter a price in the
  first items textbox it doesn't update and then deletes the second item's
  price.
 
   If I have 15 items and using one submit button how do I get this to
update
   all items that are listed?
 
  $query = SELECT uid, id, name, image, type, quantity, price FROM
  {$config[prefix]}_shop WHERE uid = {$session[uid]};
 $ret = mysql_query($query);
 while($row = mysql_fetch_array($ret))
  {
 $uid = $row['uid'];
 $id = $row['id'];
 $name = $row['name'];
 $image = $row['image'];
 $iquantity = $row['quantity'];
 $itype = $row['type'];
 $iprice = $row['price'];
 
  if($update)
  {
   $eprice = '$price[]';

 I don't know what else is wrong with your code, but this is *definitely*
 going to cause problems.

 I assume you mean:

   $eprice = $price[];

 But even this is wrong. You should probably be keeping a counter, eg $i,
then
 use:

   $eprice = $price[$i];

 [snip]

  value=\\ name=\price[]\ size='8'

   value=\\ name=\price[$i]\ size='8'

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

 /*
 We have a equal opportunity Calculus class -- it's fully integrated.
 */


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002



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




[PHP] Using one submit button

2002-04-16 Thread Jennifer Downey

Hi all,

I thought I was going to give php a break today but I can't it's too
adicting.

I am having a little problem with a submit button in which it is suppose to
update records from a form.

Here is the code





echo BRBRa href=\locker.php\My Locker/a | a
href=\myshop.php\My Shop/a | a href=\items.php\My
Items/aBRBR;
echo TABLE BORDER='0' WIDTH='95%' CELLPADDING='0' CELLSPACING='0'TRTD
width=20%Bfont size=2Image/font/B/TDTD width=30%Bfont
size=2Name/font/B/TDTD width=20%Bfont
size=2CENTERQuantity/CENTER/font/B/TDTD width=30%Bfont
size=2CENTERRemove Item/CENTER/font/B/TDTD width=30%Bfont
size=2CENTERPrice/CENTER/font/B/TD/TR/table;
echo FORM action='$PHP_SELF' METHOD='post';

 $query = SELECT uid, id, name, image, type, quantity FROM
{$config[prefix]}_shop WHERE uid = {$session[uid]};
 $ret = mysql_query($query);
 while($row = mysql_fetch_array($ret))
{
 $uid = $row['uid'];
 $id = $row['id'];
 $name = $row['name'];
 $image = $row['image'];
 $iquantity = $row['quantity'];
 $itype = $row['type'];


 echo TABLE BORDER='0' WIDTH='95%' CELLPADDING='0'
CELLSPACING='0'TR;
 echo TD width=20%img src='$image'/TD;
 echo TD width=30%font size=2$name/font/TD;
 echo TD width=20%font
size=2CENTER$iquantity/CENTER/font/TD;
 echo TD width=30%font size=2CENTERa
href='$PHP_SELF?id=$idremove=yes'X/a/CENTER/font/TD;
 echo TD width=30%font size=2CENTERinput type=\text\
value=\\ name=\price\ size='6'
MAXLENGTH='8'BR/a/CENTER/font/TD;
 echo /TD/TR/TABLE;

 echo input=\hidden\ name=\remove\ value=\yes\;
}
echo CENTERINPUT TYPE=\submit\ NAME=\update\ VALUE=\Updat
Prices\;
echo /form;
 if($update)
{
 $query = UPDATE {$config[prefix]}_shop SET price = '$price'
where uid = {$session[uid]};
 $ret = mysql_query($query);
}








What I need this to do is update the price in the db table.
if I have on item it is fine. If I have two items it won't update the first
items price but will the second. if I try to enter a price in the first
items textbox it doesn't update and then deletes the second item's price.

If I have 15 items and using one submit button how do I get this to update
all items that are listed?

TIA
Jennifer

--
The sleeper has awaken


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002



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




Re: [PHP] Using one submit button

2002-04-16 Thread Jennifer Downey

Do you mean something like this?

   if($update)
{
 $iprice = $price[price];
   $query = UPDATE {$config[prefix]}_shop SET price = $iprice where uid =
{$session[uid]} AND id = $id;
   $ret = mysql_query($query);
}

Martin Towell [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 user price[] as the name
 you'll also need to pass the ids as $id[]
 so you know which one you're updating

 -Original Message-
 From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, April 17, 2002 11:51 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Using one submit button


 Hi all,

 I thought I was going to give php a break today but I can't it's too
 adicting.

 I am having a little problem with a submit button in which it is suppose
to
 update records from a form.

 Here is the code

 --
--
 


 echo BRBRa href=\locker.php\My Locker/a | a
 href=\myshop.php\My Shop/a | a href=\items.php\My
 Items/aBRBR;
 echo TABLE BORDER='0' WIDTH='95%' CELLPADDING='0'
CELLSPACING='0'TRTD
 width=20%Bfont size=2Image/font/B/TDTD width=30%Bfont
 size=2Name/font/B/TDTD width=20%Bfont
 size=2CENTERQuantity/CENTER/font/B/TDTD width=30%Bfont
 size=2CENTERRemove Item/CENTER/font/B/TDTD width=30%Bfont
 size=2CENTERPrice/CENTER/font/B/TD/TR/table;
 echo FORM action='$PHP_SELF' METHOD='post';

  $query = SELECT uid, id, name, image, type, quantity FROM
 {$config[prefix]}_shop WHERE uid = {$session[uid]};
  $ret = mysql_query($query);
  while($row = mysql_fetch_array($ret))
 {
  $uid = $row['uid'];
  $id = $row['id'];
  $name = $row['name'];
  $image = $row['image'];
  $iquantity = $row['quantity'];
  $itype = $row['type'];


  echo TABLE BORDER='0' WIDTH='95%' CELLPADDING='0'
 CELLSPACING='0'TR;
  echo TD width=20%img src='$image'/TD;
  echo TD width=30%font size=2$name/font/TD;
  echo TD width=20%font
 size=2CENTER$iquantity/CENTER/font/TD;
  echo TD width=30%font size=2CENTERa
 href='$PHP_SELF?id=$idremove=yes'X/a/CENTER/font/TD;
  echo TD width=30%font size=2CENTERinput type=\text\
 value=\\ name=\price\ size='6'
 MAXLENGTH='8'BR/a/CENTER/font/TD;
  echo /TD/TR/TABLE;

  echo input=\hidden\ name=\remove\ value=\yes\;
 }
 echo CENTERINPUT TYPE=\submit\ NAME=\update\ VALUE=\Updat
 Prices\;
 echo /form;
  if($update)
 {
  $query = UPDATE {$config[prefix]}_shop SET price = '$price'
 where uid = {$session[uid]};
  $ret = mysql_query($query);
 }



 --
--
 



 What I need this to do is update the price in the db table.
 if I have on item it is fine. If I have two items it won't update the
first
 items price but will the second. if I try to enter a price in the first
 items textbox it doesn't update and then deletes the second item's price.

 If I have 15 items and using one submit button how do I get this to update
 all items that are listed?

 TIA
 Jennifer

 --
 The sleeper has awaken


 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002



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


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002



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




[PHP] Re: Closing curly brackets?

2002-04-13 Thread Jennifer Downey

Well as I have seen lot's of people get yelled at if they post in the wrong
list. So rather than letting that happen and risk not getting any help I
thought I would apologize and send it to the right list.

Anyway the file you sent is it in the correct format? I have asked about a
tutorial on proper code formatting and got back a tutorial that was
extremely hard to understand. While lots of people have screamed at me for
my  coding format no one has supplied an understandable answer. That is
until this morning.

From Paul Burney :

Hi Jennifer,

The first thing you should do is properly indent your code.  If you do so,
you'll be sure to find the missing bracket.  Basically, for each new block,
tab out again.  It really helps to use a programmer's editor with syntax
highlighting like vim or BBEdit.

Thought that was the best tutorial I could ever get. Short and sweet and oh
so easy to understand.
I am using HTML_Kit as it has the same features as all the othere editors
(color coding and such) but it also has a lot more I can get plugins for
anything I would ever need. Except a formatting tutorial ;)

I will use your code as an example of formatting.
It doesn't work as far as the script goes as it returns multiple:
Warning: Supplied argument is not a valid MySQL result resource.

So I am going to study your formatting and start at the beginning.

But thank you for your time and help! :)

You have been a great help, look at my new signature.

Thanks again
Jennifer



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002



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




[PHP] PHP MySQL Hosting services

2002-04-13 Thread Jennifer Downey

Hi everyone,

I am wondering if anyone has a good hosting service? I am currently with
Aletia which has an excellant package good tech support but sometimes not
very functional servers.

My site has gone down at least 3 times within the last 20 days. Too many for
me.

It has to be at least 50 mb disk space, 10 to 15gig /m transfer, of course
PHP and MySQL, ftp, ssh or telnet, cgi/perl, free domain transfer, at least
15 POP3 email accounts, cron support.

Thanks
Jennifer
--
The sleeper has awaken






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002



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




[PHP] Closing curly brackets?

2002-04-12 Thread Jennifer Downey

Hi everyone,

I have a question about this code. The way it sits now it always shows the
last record in the table.
in other words if the user has 6 items, like:
item id 1
item id 2
item id 5
item id 6
item id 7
item id 8

it will only show the last record item id 8.

I believe it has something to do with the first while statement's closing
curly bracker
But I can't seem to get it in the right place.

Can someone spot the mistake and show me how to fix it.
see also comments in code.



$id = $HTTP_GET_VARS[id];


$query = SELECT id, name, image, quantity, type FROM
{$config[prefix]}_my_items WHERE uid={$session[uid]} ORDER BY id;
$ret = mysql_query($query);
 while($row = mysql_fetch_array($ret))
{
$iid = $row['id'];
$image = $row['image'];
$name = $row['name'];
$quantity = $row['quantity'];
$type = $row['type'];


if($iid == $id)
{
$display_block =CENTERimg src=$image border=0brfont size =
2$nameBR$quantityBR$type/font/CENTER;
echo $display_blockBRBR;
if($type == food)
//if book or weapon is present then set an option and include in the form
later
{$thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION;
}else{
//if any other type is present then set a blank
$thisoption=;}
}
}



//check if form has been submitted
if($submit){

   if($sort == 'shop')
 {
 echo This item has been taken care ofBR;

// We are selecting user id to insert into the users items.
$db=SELECT  uid FROM {$config[prefix]}_users WHERE
uid={$session[uid]};
$ret = mysql_query($db);
while(list($db)=mysql_fetch_row($ret))
{ $user = $db;
echo Your user ID is $userBR;
}


echo You have $quantity of this item and it's id is $iidBR;


}
// it seems like the first while statement's closing curly bracket should go
here but if I put it here I get a pars error.
}else{
//if the form has not been submitted run the following


?
FORM ACTION=?echo$PHP_SELF;? METHOD=post
SELECT NAME=sort SIZE=1 
?echo $thisoption;?
OPTION VALUE=shopPut in my shop/OPTION
OPTION VALUE=lockerPut into my Footlocker/OPTION
OPTION VALUE=discardDiscard this item/OPTION
OPTION VALUE=donateDonate this item/OPTION
/SELECT
INPUT TYPE=submit VALUE=Submit NAME=submit 
/FORM
?
}
//if I put the first while statement's closing curly bracket here it works
great except it prints multiple dropdown lists on the page.

I have tried the bracket in numerous places but I can't find the right spot.





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002



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




[PHP] Re: Closing curly brackets?

2002-04-12 Thread Jennifer Downey

My apologies for putting this in the wrong list.

Jennifer

Jennifer Downey [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi everyone,

 I have a question about this code. The way it sits now it always shows the
 last record in the table.
 in other words if the user has 6 items, like:
 item id 1
 item id 2
 item id 5
 item id 6
 item id 7
 item id 8

 it will only show the last record item id 8.

 I believe it has something to do with the first while statement's closing
 curly bracker
 But I can't seem to get it in the right place.

 Can someone spot the mistake and show me how to fix it.
 see also comments in code.



 $id = $HTTP_GET_VARS[id];


 $query = SELECT id, name, image, quantity, type FROM
 {$config[prefix]}_my_items WHERE uid={$session[uid]} ORDER BY id;
 $ret = mysql_query($query);
  while($row = mysql_fetch_array($ret))
 {
 $iid = $row['id'];
 $image = $row['image'];
 $name = $row['name'];
 $quantity = $row['quantity'];
 $type = $row['type'];


 if($iid == $id)
 {
 $display_block =CENTERimg src=$image border=0brfont size =
 2$nameBR$quantityBR$type/font/CENTER;
 echo $display_blockBRBR;
 if($type == food)
 //if book or weapon is present then set an option and include in the form
 later
 {$thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION;
 }else{
 //if any other type is present then set a blank
 $thisoption=;}
 }
 }



 //check if form has been submitted
 if($submit){

if($sort == 'shop')
  {
  echo This item has been taken care ofBR;

 // We are selecting user id to insert into the users items.
 $db=SELECT  uid FROM {$config[prefix]}_users WHERE
 uid={$session[uid]};
 $ret = mysql_query($db);
 while(list($db)=mysql_fetch_row($ret))
 { $user = $db;
 echo Your user ID is $userBR;
 }


 echo You have $quantity of this item and it's id is $iidBR;


 }
 // it seems like the first while statement's closing curly bracket should
go
 here but if I put it here I get a pars error.
 }else{
 //if the form has not been submitted run the following


 ?
 FORM ACTION=?echo$PHP_SELF;? METHOD=post
 SELECT NAME=sort SIZE=1 
 ?echo $thisoption;?
 OPTION VALUE=shopPut in my shop/OPTION
 OPTION VALUE=lockerPut into my Footlocker/OPTION
 OPTION VALUE=discardDiscard this item/OPTION
 OPTION VALUE=donateDonate this item/OPTION
 /SELECT
 INPUT TYPE=submit VALUE=Submit NAME=submit 
 /FORM
 ?
 }
 //if I put the first while statement's closing curly bracket here it works
 great except it prints multiple dropdown lists on the page.

 I have tried the bracket in numerous places but I can't find the right
spot.





 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002



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




[PHP] Getting user name in text area

2002-03-28 Thread Jennifer Downey

Hi all,

Here is what I have and what I am trying to do.

I would like the user name to be printed in the  Username text box but can't
seem to get it there.
I don't want the user to have to type there username in, just click the
submit button and it is entered into the db.
Can anyone show me what I have done wrong?

$query=SELECT name FROM users WHERE uid={$session[uid]};
$ret = mysql_query($query);
while(list($name)=
mysql_fetch_row($ret))
print(BRBRBR$name);


?
table ALIGN=center WIDTH=80%tr
tdform ACTION=?php  echo($PHP_SELF);? METHOD=post
?
print tdbrUsername: input type=\text\ value=\$name\
name=\u_name\ size=30/td/trtrtd;
print input TYPE=\submit\ name=\action\ VALUE=\Submit my
entry\/centerbrbr;
?
/form/td/tr
/table
?
if($action = Submit my entry){
if (!empty($name)){
$enter = insert into entry (id, user_name) values ('','$u_name');
mysql_query($enter) or die(mysql_error());
}
}


TIA
Jennifer



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




[PHP] MySQL and indexes

2002-03-18 Thread Jennifer Downey

Hi all,

Just wondering, does a table have to have an index? If so what should I
consider when making a colum an index?

Here is the table I am using but I can't get php to update it.
Is it because there is no index?


CREATE TABLE wt_pet (
  petid varchar(100) default NULL,
  pet_user int(10) NOT NULL default '0',
  petname varchar(50) NOT NULL default '',
  pet_sex enum('Male','Female') NOT NULL default 'Male',
  pet_equip varchar(50) NOT NULL default '',
  pet_state varchar(20) NOT NULL default '',
  pet_hunger varchar(20) NOT NULL default '',
  pet_date date NOT NULL default '-00-00',
  num_pets int(1) NOT NULL default '0',
  ) TYPE=MyISAM;


Thanks
Jennifer Downey



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




[PHP] DHTML Trouble please help

2002-03-13 Thread Jennifer Downey

Hi all,

I am no DHTML expert and don't even know the language also didn't know where
to post this. But after today I am going to learn.

I downloaded a tetris game from Dynamic Drive:
http://www.dynamicdrive.com/dynamicindex12/tetris/index.htm

Have a look. I would add it here but it's too long.

I want to add the high score to a users data in the database.

Would one of you DHTML and PHP Gurues (SP) please point out what section of
the code I would use to get the high score.

I would like to (I can do this part if someone would show what I use from
the DHTML) echo or print the score to the bottom of the browser window and
then have that added to the db.


TIA
GC







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




[PHP] Random number Question

2002-03-12 Thread Jennifer Downey

Hi all,

I having a hard time understanding why this won't work. I have a form which
is suppose to pass the guess to the script. Here it is:

the form is guess.php:

form action=number.php method=post
The computer has picked a number between 1 and 10. Guess the number and you
win!BR


Enter your guess:
input type=text size=3
INPUT TYPE=submit VALUE=Submit my number NAME=guess
/form


The script is number.php:

?php
echoThe number is:;

srand((double)microtime()*100);
$number = rand(1,10);

echo $number;

if($guess = = $number) {
 echoBRYou have won!;
 }else{
 print(BRSorry that wasn't the answer);

}
?

Any help would be appreciated.

Thanks in advance
Jennifer Downey



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