Re: [PHP] Stuck on undefined function mysql_connect()

2011-10-13 Thread Daniel Brown
On Thu, Oct 13, 2011 at 14:19, Nick Khamis sym...@gmail.com wrote:
 I have been stuck on this, and have no idea what is causing it. I have
 compiled PHP with mysqli support:

Right which will use mysqli_connect(), et al.  If you didn't
compile it with straight MySQL support, then the mysql_*() functions
won't be there.

 However, there is no mysqli.so or mysql.so found anywhere? Please help, I
 have fallen behind because of this.

It's compiled into the core, not as an extension.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] Stuck on undefined function mysql_connect()

2011-10-13 Thread Daniel Brown
On Thu, Oct 13, 2011 at 14:33, Nick Khamis sym...@gmail.com wrote:
 I was just going to try recompilign with mysql instead of mysqli... I hope
 this fixes it.
 In terms of mysql being compiled into the core, does this mean I do not have
 to add

 extension=mysqli.so
 extension_dir=/usr/local/php/include/php/ext/

(Please don't top-post, and be sure to click reply-all so that
the discussion remains on the list for the benefit of others as well.)

Correct.  Extensions, such as those found in the PECL repository,
are added in that manner.  Things compiled into the core, such as what
you're doing with MySQLi, are automatically loaded regardless, because
they're statically-built into the PHP binary itself.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] Stuck on undefined function mysql_connect()

2011-10-13 Thread Nick Khamis
I was just going to try recompilign with mysql instead of mysqli... I hope
this fixes it.
In terms of mysql being compiled into the core, does this mean I do not have
to add

extension=mysqli.so
extension_dir=/usr/local/php/
include/php/ext/

Thanks in Advance,


Re: [PHP] Stuck on undefined function mysql_connect()

2011-10-13 Thread Nick Khamis
Correct.  Extensions, such as those found in the PECL repository,
are added in that manner.  Things compiled into the core, such as what
you're doing with MySQLi, are automatically loaded regardless, because
they're statically-built into the PHP binary itself.


RE: [PHP] Stuck in implementing PHP with HTML

2010-10-14 Thread Tommy Pham
 -Original Message-
 From: vivek [mailto:er.jadiyavi...@gmail.com]
 Sent: Thursday, October 14, 2010 2:26 AM
 To: php-general@lists.php.net
 Subject: [PHP] Stuck in implementing PHP with HTML
 
 Hi All,
 
 Hi i am a newbie in PHP environment.
 
 First of all my sincere regards to all behind developing this fabulous
 language  of-course to every one who are sharing their knowledge  views
 making others comfortable with the same.
 Coming to the point i am trying to create a contact form applying server
side
 validation for my site using PHP. Here the problem had arises.
 I have designed a from  applied validation referring the tutorials
available
 on web but unfortunately it is not working.
 I am applying the validation  trying to show the error in the same field
if
 there Here i am sending you the code snippet what i am trying to do. Your
 help is highly appreciable. kindly help me out.
 
 *form.php:-*
 body
 ?php
 $required =
 array(name=Name,number=Number,email=Email,detail=
 Comment);
 foreach($required as $field = $label){
 if(!$_POST[$field]){
 $warnings[$field] = Required;
 }
 if($_POST[email]  !eregi
 (^[_a-z0-9-]+(\.[_a-z0-9-]+)*...@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-
 z]{2,3})$,$_POST[email]))
 $warnings[email] = Invalid Email Format;
 
 if($_POST[number]  !eregi
(^[0-9]{10}$,$_POST[number]))
 $warnings[number] = Invalid number Format;
 
 if(count($warnings)0){
 ?
 !-- start form--
 div class=post
 h2 class=title-creditContact Form:-/h2
 div class=entry style=padding-left:30px;
 form name=feedback method=post
action=submit.php

Here is your problem... The form is submitting to submit.php while your
validation is done in form.php.  What you should do is have the form submit
TO form.php.  If validation passes, redirect via header() [1].  You might
have to use session [2] to have the value accessible in submit.php for
security reasons.

 pdiv style=padding:3px;Name span
style=margin-
 left:20pxinput name=name type=text id=name size=40
 ?php if($$warnings[name]) echo 'style=\shaded\';? value=?php
 echo $_POST[name];??php echo
 $warnings[name];?/span/div
 div style=padding:3px;Number span
style=margin-
 left:10pxinput name=number type=text id=number
 size=40 ?php if($$warnings[number]) echo 'style=\shaded\';?
 value=?php echo $_POST[number];??php echo
 $warnings[number];?/span/div
 div style=padding:3px;Email span
style=margin-
 left:22pxinput name=email type=text id=email
 size=40 ?php if($$warnings[email]) echo 'style=\shaded\';?
 value=?php echo $_POST[email];??php echo
 $warnings[email];?/span/div
 div style=padding:3px;Comment span
style=margin-
 left:0pxtextarea name=detail cols=50 rows=4
 id=detail ?php if($$warnings[detail]) echo 'style=\shaded\';?
 value=?php echo $_POST[detail];?/textarea?php echo
 $warnings[detail];?/span/div
 div style=padding:3px;
padding-left:150px;input
 type=submit name=Submit value=Submit
 input type=reset name=Reset
 value=Reset/div/p
 /form
 ?php
 }
 else{
 echo Thanks for valuable comments;
 }
 ?
 /body
 
 *submit.php*
 ?
 $con=mysql_connect(localhost,test,test1234) or die
 (mysql_errno().:b .mysql_error()./b);
 mysql_select_db(dbname,$con) or die (mysql_errno().:b
 .mysql_error()./b);
 
 $insert_query = 'insert into GUESTBOOK (NAME,NUMBER,EMAIL,DETAIL)
 values(
 ' . $_POST['name'] . ',
 ' . $_POST['number'] . ',
 ' . $_POST['email'] . ',
 ' . $_POST['detail'] . '
 )';

In submit.php, the values should be retrieved from $_SESSION.  Also, this is
very bad to SQL injection.  Look into escaping the input [3].  I suggest you
to use mysqli extension, if you can, over mysql extension.  There many
benefits to it.

 mysql_query($insert_query) or die ('Error updating database');
 mysql_close($con); ?
 header('Location: http://www.sweetsamaira.com/guest.php');
 
 Kindly help me out. Thanks in advance.
 
 
 --
 Kind Regards,
 Vivek Jadiya

Regards,
Tommy

[1] http://php.net/manual/en/function.header.php
[2] http://www.php.net/manual/en/book.session.php
[3] http://us2.php.net/manual/en/function.mysql-real-escape-string.php



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



RE: [PHP] stuck with simple query..... Plz have a look

2004-04-07 Thread Jay Blanchard
[snip]
We have two tables
[/snip]

Please do not cross-post, send only to the list where needed.

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



Re: [PHP] Stuck!

2003-04-03 Thread Chris Hewitt
Andrew wrote:

Having spent hours on my members registration and login pages I am getting
so close to cracking it, but have now hit a brick wall.
I am getting a warning message which I think could stem from somewhere else
in my code but I have no idea where.
There is a little too much code to put here so is there a kind sole out
there who would take a look at my code if I email it to you to see where I
am going wrong?
There are two pages a login page and a new member page.

With respect, I feel we might help you more if you post the exact error 
message, and the last couple of lines prior to the line number reported 
in the error message.

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


RE: [PHP] stuck n00b

2002-10-01 Thread Jay Blanchard

[snip]
Submits to addUser.php:

?php
echo $HTTP_SERVER_VARS['userName'];
?

Returns this error in my browser:

Notice: Undefined index: userName in E:\Inetpub\wwwroot\Test\addUser.php on
line 11

Is there a setting in my php.ini file I need to change? register_globals is
off, as that seems to be the preferred method now. But that's my issue,
trying to access this external variable. $_REQUEST doesn't work. $_POST
doesn't either. I have other scripts that it's working in, but I may not
know what I'm saying here.

PHP 4.2.3 on IIS (personal web server or whatever it's called) on WinXP Pro.
[/snip]

You mentioned everything but $_GET{'userName'] :^]
Since the form method=GET this is what you would have to do to 'get' the
result you're looking for.

HTH!

Jay



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




RE: [PHP] stuck n00b

2002-10-01 Thread Jay Blanchard

[snip]
You mentioned everything but $_GET{'userName'] :^]
[/snip]

Ooops, typo!

$_GET['userName']

HTH!

Jay


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




Re: [PHP] stuck n00b

2002-10-01 Thread Chris Nielsen

My form is actually using method=post. And I did use $_POST. Can't
remember if I tried $_GET, but if I'm using post would that even work? I'll
give it a try later and let you know.

Jay Blanchard [EMAIL PROTECTED] wrote in message
000101c2697c$4ad74bc0$8102a8c0@000347D72515">news:000101c2697c$4ad74bc0$8102a8c0@000347D72515...
 [snip]
 Submits to addUser.php:

 ?php
 echo $HTTP_SERVER_VARS['userName'];
 ?

 Returns this error in my browser:

 Notice: Undefined index: userName in E:\Inetpub\wwwroot\Test\addUser.php
on
 line 11

 Is there a setting in my php.ini file I need to change? register_globals
is
 off, as that seems to be the preferred method now. But that's my issue,
 trying to access this external variable. $_REQUEST doesn't work. $_POST
 doesn't either. I have other scripts that it's working in, but I may not
 know what I'm saying here.

 PHP 4.2.3 on IIS (personal web server or whatever it's called) on WinXP
Pro.
 [/snip]

 You mentioned everything but $_GET{'userName'] :^]
 Since the form method=GET this is what you would have to do to 'get' the
 result you're looking for.

 HTH!

 Jay





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




RE: [PHP] stuck n00b

2002-10-01 Thread Jay Blanchard

[snip]
My form is actually using method=post. And I did use $_POST. Can't
remember if I tried $_GET, but if I'm using post would that even work? I'll
give it a try later and let you know.
[/snip]

My bad! I looked at two e-mails from different folks and saw a GET in one,
and a POST in another. Since you are using POST it should be
$_POST['userName'] or $_POST[userName]

Jay



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




Re: [PHP] stuck n00b

2002-10-01 Thread Chris Nielsen

I was sure I'd tried it, but $_POST works now.

Thanks guys.

Jay Blanchard [EMAIL PROTECTED] wrote in message
000501c2697d$ded95a10$8102a8c0@000347D72515">news:000501c2697d$ded95a10$8102a8c0@000347D72515...
 [snip]
 My form is actually using method=post. And I did use $_POST. Can't
 remember if I tried $_GET, but if I'm using post would that even work?
I'll
 give it a try later and let you know.
 [/snip]

 My bad! I looked at two e-mails from different folks and saw a GET in
one,
 and a POST in another. Since you are using POST it should be
 $_POST['userName'] or $_POST[userName]

 Jay





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




RE: [PHP] Stuck on array, need a little help.

2001-12-04 Thread Brian V Bonini

I still can't get this to do what I want:
$bikes = array(
 Road  = array(
  Trek  = array(
Trek 5200 = road.php?brand=t5200
),
  LeMond = array(
Zurich = road.php?brand=zurich,
Chambery = road.php?brand=chambery,
Alpe d'Huez = road.php?brand=alpe,
BuenosAries = road.php?brand=bueno,
Tourmalet = road.php?brand=tourmalet
),
  Moots = array(
VaMoots  = road.php?brand=vamoots
)
 ),
);
if ($cat == 'bikes') {
while (list($key, $val)=each($bikes[$sub_cat])) {
  echo TDIMG SRC=\images/spacer.gif\ WIDTH=\25\ HEIGHT=\1\
ALT=\\ BORDER=\0\/TD\n;
  echo TDA HREF=\$val\ CLASS=\menu\$key/A/TD\n;
while (list($sub_key, $sub_val) = each($val)) {
echo TDA HREF=\$sub_val\
CLASS=\menu\$sub_key/a/td\n;
}
}
}

Will produce:
Trek Trek 5200  LeMond Zurich Chambery Alpe d'Huez BuenosAries Tourmalet
Moots VaMoots
as it should...

But, I need it to produce:
Trek LeMond Moots
Trek 5200  Zurich Chambery Alpe d'Huez BuenosAries Tourmalet VaMoots

And I need to get the value of $sub_val in the nested while loop to where
$val is in the outer loop.

I'm really stuck, any suggestions??

-Brian
**


 -Original Message-
 From: Jim Musil [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 30, 2001 5:26 PM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP] Stuck on array, need a little help.




 The script is still working right, you just need to nest another
 while loop into your current while loop.

 Like so ...

 if ($cat == 'bikes'  $sub_cat != 'Road') {
   while (list($val, $key)=each($bikes[$sub_cat])) {

   echo trtd$val/td;

   while (list($sub_val, $sub_key) = each($key)) {


   echo TDIMG SRC=\images/spacer.gif\ WIDTH=\25\
   HEIGHT=\1\
   ALT=\\ BORDER=\0\/td\n;
   echo TDA HREF=\$sub_key\
 CLASS=\menu\$sub_val/a/td\n;


 }
 }
 }

 alternatively, if you know specifically what you want you could
 do this ...

 if ($cat == 'bikes'  $sub_cat != 'Road') {
   while (list($val, $key)=each($bikes[$sub_cat][Trek])) {



   echo TDIMG SRC=\images/spacer.gif\ WIDTH=\25\
   HEIGHT=\1\
   ALT=\\ BORDER=\0\/td\n;
   echo TDA HREF=\$key\ CLASS=\menu\$val/a/td\n;



 }
 }



 No, all that will do is reverse the placement
 of the values. So now it prints out Array
 and puts the item in the URL. Still the same problem.
 
 
   -Original Message-
   From: Jim Musil [mailto:[EMAIL PROTECTED]]
   Sent: Friday, November 30, 2001 4:54 PM
   To: [EMAIL PROTECTED]
   Cc: [EMAIL PROTECTED]
   Subject: Re: [PHP] Stuck on array, need a little help.
 
 
   Your script is working like you are asking it to ...
 
 
   Change ...
 
while (list($val, $key)=each($bikes[$sub_cat])) {
 
   To ...
 
while (list($key, $val)=each($bikes[$sub_cat])) {
 
   and it should work like you WANT it to ...
 
   I'm stuck. $key returns Array how can I get at each
   level of this array?
   
   if ($cat == 'bikes'  $sub_cat != 'Road') {
while (list($val, $key)=each($bikes[$sub_cat])) {
echo TDIMG SRC=\images/spacer.gif\ WIDTH=\25\
   HEIGHT=\1\
   ALT=\\ BORDER=\0\/TD\n;
echo TDA HREF=\$key\ CLASS=\menu\$val/A/TD\n;
   
   $bikes = array(
 Road  = array(
  Trek  = array(
Trek 5200 = road.php?brand=t5200
),
  LeMond = array(
Zurich = road.php?brand=zurich,
Chambery = road.php?brand=chambery,
Alpe d'Huez = road.php?brand=alpe,
BuenosAries = road.php?brand=bueno,
Tourmalet = road.php?brand=tourmalet
),
  Moots = array(
VaMoots  = road.php?brand=vamoots
)
 ),
 Mountain  = array(
  Trek  = array(
Fuel 100 = mountain.php?brand=tfuel90,
Fuel 90  = mountain.php?brand=schhg
),
  Klein = array(
bike 1 = URL,
bike 2 = URL
),
  Gary Fisher = array(
bike 1 = URL,
bike 2 = URL
),
  Moots = array(
bike 1 = URL,
bike 2 = URL
)
 ),
   
   
   --
   PHP General 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]
 
 
   --
   Jim Musil
   -
   Multimedia Programmer
   Nettmedia
   -
   212

Re: [PHP] Stuck on array, need a little help.

2001-11-30 Thread Jim Musil

Your script is working like you are asking it to ...


Change ...

 while (list($val, $key)=each($bikes[$sub_cat])) {

To ...

 while (list($key, $val)=each($bikes[$sub_cat])) {

and it should work like you WANT it to ...

I'm stuck. $key returns Array how can I get at each
level of this array?

if ($cat == 'bikes'  $sub_cat != 'Road') {
 while (list($val, $key)=each($bikes[$sub_cat])) {
 echo TDIMG SRC=\images/spacer.gif\ WIDTH=\25\ HEIGHT=\1\
ALT=\\ BORDER=\0\/TD\n;
 echo TDA HREF=\$key\ CLASS=\menu\$val/A/TD\n;

$bikes = array(
  Road  = array(
   Trek  = array(
 Trek 5200 = road.php?brand=t5200
 ),
   LeMond = array(
 Zurich = road.php?brand=zurich,
 Chambery = road.php?brand=chambery,
 Alpe d'Huez = road.php?brand=alpe,
 BuenosAries = road.php?brand=bueno,
 Tourmalet = road.php?brand=tourmalet
 ),
   Moots = array(
 VaMoots  = road.php?brand=vamoots
 )
  ),
  Mountain  = array(
   Trek  = array(
 Fuel 100 = mountain.php?brand=tfuel90,
 Fuel 90  = mountain.php?brand=schhg
 ),
   Klein = array(
 bike 1 = URL,
 bike 2 = URL
 ),
   Gary Fisher = array(
 bike 1 = URL,
 bike 2 = URL
 ),
   Moots = array(
 bike 1 = URL,
 bike 2 = URL
 )
  ),


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


-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General 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] Stuck on array, need a little help.

2001-11-30 Thread Jim Musil



The script is still working right, you just need to nest another 
while loop into your current while loop.

Like so ...

if ($cat == 'bikes'  $sub_cat != 'Road') {
  while (list($val, $key)=each($bikes[$sub_cat])) {

echo trtd$val/td;

while (list($sub_val, $sub_key) = each($key)) {


  echo TDIMG SRC=\images/spacer.gif\ WIDTH=\25\
  HEIGHT=\1\
  ALT=\\ BORDER=\0\/td\n;
  echo TDA HREF=\$sub_key\ CLASS=\menu\$sub_val/a/td\n;


}
}
}

alternatively, if you know specifically what you want you could do this ...

if ($cat == 'bikes'  $sub_cat != 'Road') {
  while (list($val, $key)=each($bikes[$sub_cat][Trek])) {



  echo TDIMG SRC=\images/spacer.gif\ WIDTH=\25\
  HEIGHT=\1\
  ALT=\\ BORDER=\0\/td\n;
  echo TDA HREF=\$key\ CLASS=\menu\$val/a/td\n;



}
}



No, all that will do is reverse the placement
of the values. So now it prints out Array
and puts the item in the URL. Still the same problem.


  -Original Message-
  From: Jim Musil [mailto:[EMAIL PROTECTED]]
  Sent: Friday, November 30, 2001 4:54 PM
  To: [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP] Stuck on array, need a little help.


  Your script is working like you are asking it to ...


  Change ...

   while (list($val, $key)=each($bikes[$sub_cat])) {

  To ...

   while (list($key, $val)=each($bikes[$sub_cat])) {

  and it should work like you WANT it to ...

  I'm stuck. $key returns Array how can I get at each
  level of this array?
  
  if ($cat == 'bikes'  $sub_cat != 'Road') {
   while (list($val, $key)=each($bikes[$sub_cat])) {
   echo TDIMG SRC=\images/spacer.gif\ WIDTH=\25\
  HEIGHT=\1\
  ALT=\\ BORDER=\0\/TD\n;
   echo TDA HREF=\$key\ CLASS=\menu\$val/A/TD\n;
  
  $bikes = array(
Road  = array(
 Trek  = array(
   Trek 5200 = road.php?brand=t5200
   ),
 LeMond = array(
   Zurich = road.php?brand=zurich,
   Chambery = road.php?brand=chambery,
   Alpe d'Huez = road.php?brand=alpe,
   BuenosAries = road.php?brand=bueno,
   Tourmalet = road.php?brand=tourmalet
   ),
 Moots = array(
   VaMoots  = road.php?brand=vamoots
   )
),
Mountain  = array(
 Trek  = array(
   Fuel 100 = mountain.php?brand=tfuel90,
   Fuel 90  = mountain.php?brand=schhg
   ),
 Klein = array(
   bike 1 = URL,
   bike 2 = URL
   ),
 Gary Fisher = array(
   bike 1 = URL,
   bike 2 = URL
   ),
 Moots = array(
   bike 1 = URL,
   bike 2 = URL
   )
),
  
  
  --
  PHP General 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]


  --
  Jim Musil
  -
  Multimedia Programmer
  Nettmedia
  -
  212-629-0004
  [EMAIL PROTECTED]

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


-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General 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] stuck

2001-08-17 Thread Jan De Luyck

You need to put the info in an array for all record to be available, like
this:

 while ($row = mysql_fetch_array($result)) {
$uid[] = $row['uid'];
$address[] = $row['address'];
$city[] = $row['city'];
$state[] = $row['state'];
$zip_code[] = $row['zip_code'];
$country[] = $row['country'];
$company[] = $row['company'];
$occupation[] = $row['occupation'];
$telephone[] = $row['telephone'];
$fax[] = $row['fax'];

and to get it out again, you need to use a for loop

for ($i = 0; $i  count($uid); $i++)
{
echo $uid[$i];
...
}

Hope this helps,

Jan De Luyck


 -Original Message-
 From: Jeremy Morano [mailto:[EMAIL PROTECTED]]
 Sent: Friday, August 17, 2001 6:05 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] stuck


 Hi,

 Can someone please tell me what is wrong with this page. The
 problem is that
 my option block is always stuck on the last record in the table. No matter
 what option I choose, the information, address, city, state...etc, that is
 passed is always the one of the last record in the table...Help!





 ?
 session_start();
 session_register(address);
 session_register(city);
 session_register(state);
 session_register(zip_code);
 session_register(country);
 session_register(company);
 session_register(occupation);
 session_register(telephone);
 session_register(fax);

 $db_name = contact;
 $table_name = company;

 $connection = @mysql_connect(l, c, c) or die(Couldn't connect.);

 $db = @mysql_select_db($db_name, $connection) or die(Couldn't select
 database.);

 $sql = SELECT *
   FROM $table_name
   ;

 $result = @mysql_query($sql,$connection) or die(Couldn't execute
 query.);


 while ($row = mysql_fetch_array($result)) {
   $uid = $row['uid'];
   $address = $row['address'];
   $city = $row['city'];
   $state = $row['state'];
   $zip_code = $row['zip_code'];
   $country = $row['country'];
   $company = $row['company'];
   $occupation = $row['occupation'];
   $telephone = $row['telephone'];
   $fax = $row['fax'];

   $option_block .= option value=\$uid\$company/option;
 }



 $display_block = 

 FORM METHOD=post ACTION=show_adduserbycompany.php


 PstrongCompany:/strong
 select name=\uid\
 $option_block
 /select

 INPUT TYPE=\SUBMIT\ NAME=\submit\ VALUE=\Select this Company\/P
 /form

 ;

 ?


 HTML
 HEAD
 TITLEUser Information: Add a User/TITLE
 /HEAD
 BODY
 h1 User Information/h1
 h2emAdd a User/em/h2
 PSelect a company from the list below, to continue to the user
 addition./p

 ? echo $display_block; ?

 pa href=contact_menu.phpReturn to Main Menu/a/p

 /BODY
 /HTML


 --
 PHP General 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 General 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] stuck

2001-08-17 Thread Rob Hardowa

I'm not 100% sure what you want to accomplish here, or why it is stuck 
on the last row, but I've made some observations.

On Friday 17 August 2001 09:05 am, you wrote:
?
 session_start();
 session_register(address);
 session_register(city);
 session_register(state);
 session_register(zip_code);
 session_register(country);
 session_register(company);
 session_register(occupation);
 session_register(telephone);
 session_register(fax);

-Session register variables that were supposed to have been passed by a form.
For a piece of test code you may want to execute this to see what variables and
values were passed.  I think only UID and company have been passed via the uid select.

echo 'preFrom variables were:BR', print_r($HTTP_POST_VARS), '/pre';



 while ($row = mysql_fetch_array($result)) {
   $uid = $row['uid'];
   $address = $row['address'];
   $city = $row['city'];
   $state = $row['state'];
   $zip_code = $row['zip_code'];
   $country = $row['country'];
   $company = $row['company'];
   $occupation = $row['occupation'];
   $telephone = $row['telephone'];
   $fax = $row['fax'];

   $option_block .= option value=\$uid\$company/option;
 }

-Here you've requested a bunch of info back from your query, but you only use uid
and company in the option form, so you never actually pass the other info back to be
registered by the session in your first lines.  You could simplify with:

$option_block = NULL;
while ($row = mysql_fetch_array($result)) {
  $option_block .= 'option value='.$row['uid'].''.$row['company']. '/option';
}

you may also want to do an echo in this block, or examine your html source 
to make sure you are getting back the values you request, and make sure that uid
is unique to each row.

...if you need the other info you may want to do a query for it after the
UID and company have been passed via the form on the second iteration,
and then sess register them.


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