Re: [PHP] bug in code - can't find it!
just a little point; u can replace by which is better imho. AciD On Wed, 6 Aug 2003 14:57:23 -0700, Jennifer Goodie <[EMAIL PROTECTED]> wrote: Ok, here is my query and the bit of code I can't figure out: $query = "SELECT * from apt_user_t a, apt_company_t b "; $query .= "WHERE a.user_cd = b.user_cd "; $query .= "ORDER BY a.username"; $search_results = mysql_query($query) or die("Select Failed!"); while ($search_result2 = mysql_fetch_array($search_results)) { TYPE="checkbox" NAME="" SIZE="20" MAXLENGTH="50" VALUE=" 1){?>CHECKED"> } Nothing shows up with the echo or the value. I only included this checkbox, but all of the other values show up fine. Can someone give me a hint? Mysql does not prefix returned columns with table_name., so there's probably no "a.retired_flag" index in your array. A simple way to check this would be to print_r($search_result2). If you have a column named retired_flag in both table a and table b and you specifically want the one from table a in your result set you are going to have to alias it to a different name in your query, i.e. "SELECT *, a.retired_flag as r_flag" -- www.cpm-fr.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] bug in code - can't find it!
> Ok, here is my query and the bit of code I can't figure out: > > $query = "SELECT * from apt_user_t a, apt_company_t b "; > $query .= "WHERE a.user_cd = b.user_cd "; > $query .= "ORDER BY a.username"; > > $search_results = mysql_query($query) or die("Select > Failed!"); > while ($search_result2 = mysql_fetch_array($search_results)) > { > TYPE="checkbox" > NAME="" > SIZE="20" > MAXLENGTH="50" > VALUE=" 1){?>CHECKED"> > } > Nothing shows up with the echo or the value. I only included this > checkbox, but all of the other values show up fine. Can someone give me a > hint? Mysql does not prefix returned columns with table_name., so there's probably no "a.retired_flag" index in your array. A simple way to check this would be to print_r($search_result2). If you have a column named retired_flag in both table a and table b and you specifically want the one from table a in your result set you are going to have to alias it to a different name in your query, i.e. "SELECT *, a.retired_flag as r_flag" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] bug in code - can't find it!
AciD wrote: just a little point; u can replace by which is better imho. and you're entitled to it, but it's not better. Shorter isn't always better. Your code will break if enable_short_open_tags is disabled in php.ini or an .htaccess file. Sure, it's on by default, but some people turn it off, especially when dealing with XML a lot. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals – www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] bug in code - can't find it!
} well for starters checkboxes dont have a size and maxlength you may want to try that and see if it works... - Original Message - From: "Amanda McComb" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, August 06, 2003 2:47 PM Subject: [PHP] bug in code - can't find it! > Ok, after all of the discussion on posting, I'm afraid to post. > Unfortunately, no one I know is a programmer, and I am a beginner. I can > normally figure out what I've done wrong, but I'm missing something here. > > Ok, here is my query and the bit of code I can't figure out: > > $query = "SELECT * from apt_user_t a, apt_company_t b "; > $query .= "WHERE a.user_cd = b.user_cd "; > $query .= "ORDER BY a.username"; > > $search_results = mysql_query($query) or die("Select > Failed!"); > while ($search_result2 = mysql_fetch_array($search_results)) > { > TYPE="checkbox" > NAME="" > SIZE="20" > MAXLENGTH="50" > VALUE="CHECKED"> > } > Nothing shows up with the echo or the value. I only included this > checkbox, but all of the other values show up fine. Can someone give me a > hint? > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] bug in code - can't find it!
silly me upon further looking > > - Original Message - From: "Amanda McComb" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, August 06, 2003 2:47 PM Subject: [PHP] bug in code - can't find it! > Ok, after all of the discussion on posting, I'm afraid to post. > Unfortunately, no one I know is a programmer, and I am a beginner. I can > normally figure out what I've done wrong, but I'm missing something here. > > Ok, here is my query and the bit of code I can't figure out: > > $query = "SELECT * from apt_user_t a, apt_company_t b "; > $query .= "WHERE a.user_cd = b.user_cd "; > $query .= "ORDER BY a.username"; > > $search_results = mysql_query($query) or die("Select > Failed!"); > while ($search_result2 = mysql_fetch_array($search_results)) > { > TYPE="checkbox" > NAME="" > SIZE="20" > MAXLENGTH="50" > VALUE="CHECKED"> > } > Nothing shows up with the echo or the value. I only included this > checkbox, but all of the other values show up fine. Can someone give me a > hint? > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] bug in code - can't find it!
Is it realy so? I remember someone noting on this list it also work if short tags are off. I have never tested it and I'm not going to restart our server now, but I will try it at home. John W. Holmes wrote: AciD wrote: just a little point; u can replace by which is better imho. and you're entitled to it, but it's not better. Shorter isn't always better. Your code will break if enable_short_open_tags is disabled in php.ini or an .htaccess file. Sure, it's on by default, but some people turn it off, especially when dealing with XML a lot. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] bug in code - can't find it!
Oh, yeah. Well, I just copied and pasted that from another form. Taken out, it still doesn't work. Even the echo, which is on no way related to the checkbox. Thanks! On Wed, 6 Aug 2003, Chris Sherwood wrote: > VALUE="CHECKED"> $search_result2[a.retired_flag]?> > } > > well for starters checkboxes dont have a size and maxlength > you may want to try that and see if it works... > > > > - Original Message - > From: "Amanda McComb" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, August 06, 2003 2:47 PM > Subject: [PHP] bug in code - can't find it! > > > > Ok, after all of the discussion on posting, I'm afraid to post. > > Unfortunately, no one I know is a programmer, and I am a beginner. I can > > normally figure out what I've done wrong, but I'm missing something here. > > > > Ok, here is my query and the bit of code I can't figure out: > > > > $query = "SELECT * from apt_user_t a, apt_company_t b "; > > $query .= "WHERE a.user_cd = b.user_cd "; > > $query .= "ORDER BY a.username"; > > > > $search_results = mysql_query($query) or die("Select > > Failed!"); > > while ($search_result2 = mysql_fetch_array($search_results)) > > { > > > TYPE="checkbox" > > NAME="" > > SIZE="20" > > MAXLENGTH="50" > > VALUE="CHECKED"> $search_result2[a.retired_flag]?> > > } > > Nothing shows up with the echo or the value. I only included this > > checkbox, but all of the other values show up fine. Can someone give me a > > hint? > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php