RE: [PHP] baffled - please explain
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 10 December 2004 00:15, adwin wijaya wrote: > but > { > ?> > My function was called > } > > is not correct :) Why do you say that? Looks perfectly fine to me. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] baffled - please explain
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 10 December 2004 00:06, Malcolm Mill wrote: > Hi, > I just came across a sniplet of code in a book I'm reading and I'm not > sure what point the author is trying to make. > > The code is: > > function my_function ( ) > { > echo 'My function was called'; > } > > > function my_function ( ) > { > ?> > My function was called > } > ?> > > What are those single opening and closing curly braces doing in > separate tag blocks? What's the point? The point is you can put raw HTML (or anything else!) in there which can be extremely useful for very long chunks, or blocks containing lots of quotes. I think that example could have been better constructed to illustrate this point; something like: function my_function ( ) { echo "\n" echo " My function was called\n" echo "\n"; } My function was called > The author says "Withing a function, curly braces enclose the code > that performs the task you require. Between these braces, you can have > anything that is legal elsewheere in a PHP script" - PHP and MySQL Web > Development, 3rd Edition: Welling & Thomson. > > If the point is to illustrate what this quote says, does that mean... > > { > ?> > My function was called > } > > ...is a syntactically correct code block for my_function? Yes. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] baffled - please explain
Malcolm Mill wrote: Hi, I just came across a sniplet of code in a book I'm reading and I'm not sure what point the author is trying to make. The code is: function my_function ( ) { echo 'My function was called'; } function my_function ( ) { ?> My function was called } ?> What are those single opening and closing curly braces doing in separate tag blocks? What's the point? The author says "Withing a function, curly braces enclose the code that performs the task you require. Between these braces, you can have anything that is legal elsewheere in a PHP script" - PHP and MySQL Web Development, 3rd Edition: Welling & Thomson. If the point is to illustrate what this quote says, does that mean... { ?> My function was called } ...is a syntactically correct code block for my_function? It is correct but it is not suggested. The author want to show to you instead of using echo 'My function was called', you can do in that way. but { ?> My function was called is not correct :) best regards adwin www.kuya-kuya.net www.e-rhema.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] baffled - please explain
Hi, I just came across a sniplet of code in a book I'm reading and I'm not sure what point the author is trying to make. The code is: function my_function ( ) { echo 'My function was called'; } My function was called What are those single opening and closing curly braces doing in separate tag blocks? What's the point? The author says "Withing a function, curly braces enclose the code that performs the task you require. Between these braces, you can have anything that is legal elsewheere in a PHP script" - PHP and MySQL Web Development, 3rd Edition: Welling & Thomson. If the point is to illustrate what this quote says, does that mean... { ?> My function was called http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] baffled on error_reporting
On Monday 27 October 2003 09:08 am, Curt Zirzow wrote: > * Thus wrote Marek Kilimajer ([EMAIL PROTECTED]): > > This should be reported at least as a documentation bug (if it's not > > already mentioned, I'm lazy to search :) > > I dunno, this seems like a php bug to me. The @ should only effect > the reporting status of the current line, not disabling certain > functions within the included file. Yeah, I believe its a bug, as the @ only should affect the line in question at that instance, then go back to what it was previously. At least I think thats how it was supposed to work. Ill file a bug report and see what they say... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] baffled on error_reporting
* Thus wrote Marek Kilimajer ([EMAIL PROTECTED]): > This should be reported at least as a documentation bug (if it's not > already mentioned, I'm lazy to search :) I dunno, this seems like a php bug to me. The @ should only effect the reporting status of the current line, not disabling certain functions within the included file. Curt -- "My PHP key is worn out" PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] baffled on error_reporting
This should be reported at least as a documentation bug (if it's not already mentioned, I'm lazy to search :) Gerard Samuel wrote: Yes I know about turning off error reporting, but what happens after that point. An example. -- common.php -- // php.ini error reporting is set to E_ALL error_reporting( 0 ); // sets it to 0 var_dump(error_reporting()); // Returns 0 ?> -- foo.php -- @require('./common.php'); // Here is the problem var_dump(error_reporting()); // Returns 2047 ?> If I remove @ from require('./common.php'); in foo.php, the var_dump() then correctly reports it as 0 instead of 2047 Kinda goofy if you ask me... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] baffled on error_reporting
On Sunday 26 October 2003 07:12 pm, Dan McCullough wrote: > No I believe that is a feature the ability to turn off error reporting. > You can do the same with mysql functions. > > @mysql_ Yes I know about turning off error reporting, but what happens after that point. An example. -- common.php -- -- foo.php -- If I remove @ from require('./common.php'); in foo.php, the var_dump() then correctly reports it as 0 instead of 2047 Kinda goofy if you ask me... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] baffled on error_reporting
I have a common included file with error_reporting set to 0 If I do a var_dump(error_reporting()) right after it it returns 0 In a file that includes this common file, if I var_dump(error_reporting()) there it return 2047, which I believe is E_ALL It that the correct behaviour of error_reporting??? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] baffled on error_reporting
No I believe that is a feature the ability to turn off error reporting. You can do the same with mysql functions. @mysql_ -Original Message- From: Gerard Samuel [mailto:[EMAIL PROTECTED] Sent: Sunday, October 26, 2003 7:04 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] baffled on error_reporting On Sunday 26 October 2003 06:45 pm, Gerard Samuel wrote: > On Sunday 26 October 2003 12:19 pm, Gerard Samuel wrote: > > I have a common included file with error_reporting set to 0 > > If I do a var_dump(error_reporting()) right after it it returns 0 > > In a file that includes this common file, if I > > var_dump(error_reporting()) there it return 2047, which I believe is > > E_ALL > > It that the correct behaviour of error_reporting??? > > Thanks > > Cant say why, but after doing a fresh pull from CVS, the problem seems to > have gone away. > Just another glitch in the Matrix... Actually, I found the real problem. The file that was including the common file was including it with a @ like -> @require('./common_file.php'); Once I remove the @, the error_reporting level, reported correctly, what was set in the included file, so it seems that while @ turns off error reporting, after that point, it goes back to php.ini's default of E_ALL (2047) Is it a bug, I have no idea at the moment. Im currently running php 4.3.3. Please advise. Thanks -- 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] baffled on error_reporting
On Sunday 26 October 2003 12:19 pm, Gerard Samuel wrote: > I have a common included file with error_reporting set to 0 > If I do a var_dump(error_reporting()) right after it it returns 0 > In a file that includes this common file, if I var_dump(error_reporting()) > there it return 2047, which I believe is E_ALL > It that the correct behaviour of error_reporting??? > Thanks Cant say why, but after doing a fresh pull from CVS, the problem seems to have gone away. Just another glitch in the Matrix... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] baffled on error_reporting
On Sunday 26 October 2003 06:45 pm, Gerard Samuel wrote: > On Sunday 26 October 2003 12:19 pm, Gerard Samuel wrote: > > I have a common included file with error_reporting set to 0 > > If I do a var_dump(error_reporting()) right after it it returns 0 > > In a file that includes this common file, if I > > var_dump(error_reporting()) there it return 2047, which I believe is > > E_ALL > > It that the correct behaviour of error_reporting??? > > Thanks > > Cant say why, but after doing a fresh pull from CVS, the problem seems to > have gone away. > Just another glitch in the Matrix... Actually, I found the real problem. The file that was including the common file was including it with a @ like -> @require('./common_file.php'); Once I remove the @, the error_reporting level, reported correctly, what was set in the included file, so it seems that while @ turns off error reporting, after that point, it goes back to php.ini's default of E_ALL (2047) Is it a bug, I have no idea at the moment. Im currently running php 4.3.3. Please advise. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Baffled, line producing error
> Notice the ' inside the '', this is bad syntax. For more > information on using strings in PHP, see: Sheesh you're right, as I said it was probably a dumb error, three other people have looked at this that I'm aware of and missed it toolol glad your eyes are better than ours. Thank you for pointing out the mistake Sincerely, Craig Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Baffled, line producing error
You have: if ($player_password != $player_password_verify) { $errmsg .= 'Password don't match. Please try again'; $error = 1; } Notice the ' inside the '', this is bad syntax. For more information on using strings in PHP, see: http://www.zend.com/zend/tut/using-strings.php http://www.php.net/manual/en/language.types.string.php One thing you can do is escape it: \' regards, Philip Olson On Sun, 2 Jun 2002, Craig Vincent wrote: > > If the "error" is a warning about undefined variable, then set a default > > value for $errmsg before you start adding strings to it. > > > > $errmsg .= "this"; > > > > That by itself means $errmsg = $errmsg . "this";, but if $errmsg isnt' > > defined, you'll get the warning. > > > > Set $errmsg = ''; at the beginning of your script if that is the > > problem... > > > > For future reference, always give the exact error when posting. > > > > Trying to be psychic, > > You'll notice a few lines up I have defined $errmsg =) It's a standard > parsing error I'm getting > > Parse error: parse error in admin_add_player.php on line 15 > > Since this message does not arise when line 15 is removed I can only assume > the error is actually on that line and not a missing quote or bracket > somewhere else in the script. > > Sincerely, > > Craig Vincent > > > > -- > 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] Baffled, line producing error
> If the "error" is a warning about undefined variable, then set a default > value for $errmsg before you start adding strings to it. > > $errmsg .= "this"; > > That by itself means $errmsg = $errmsg . "this";, but if $errmsg isnt' > defined, you'll get the warning. > > Set $errmsg = ''; at the beginning of your script if that is the > problem... > > For future reference, always give the exact error when posting. > > Trying to be psychic, You'll notice a few lines up I have defined $errmsg =) It's a standard parsing error I'm getting Parse error: parse error in admin_add_player.php on line 15 Since this message does not arise when line 15 is removed I can only assume the error is actually on that line and not a missing quote or bracket somewhere else in the script. Sincerely, Craig Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Baffled, line producing error
If the "error" is a warning about undefined variable, then set a default value for $errmsg before you start adding strings to it. $errmsg .= "this"; That by itself means $errmsg = $errmsg . "this";, but if $errmsg isnt' defined, you'll get the warning. Set $errmsg = ''; at the beginning of your script if that is the problem... For future reference, always give the exact error when posting. Trying to be psychic, ---John Holmes... > -Original Message- > From: Craig Vincent [mailto:[EMAIL PROTECTED]] > Sent: Saturday, June 01, 2002 11:29 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Baffled, line producing error > > I was happily coding when I came across a mysterious error. I've traced > it > to this line > > if ($player_password != $player_password_verify) { $errmsg .= 'Password > don't match. Please try again'; $error = 1; } > > commented out the script runs fine, if this line is active an error is > produced. My eyes are going bug eyed trying to find what the problem is > and > I'm hoping a second pair of eyes may point out my error. > > I've provided the entire script in case by chance the error is actually > stemming from elsewhere in the script and I'm missing that as well. The > error message from the compiler states the error is stemming from line 15 > (which is the line I posted above). Any suggestions? > > require('config.inc.php'); > authenticate(); > > if ($action == 'add') { > // The connection/query commands will need to be modified once the db > abstraction layer is ready > mysql_connect($mysql_host, $mysql_user, $mysql_pass); > mysql_select_db($mysql_database); > $errmsg = ''; > > if (mysql_num_rows(mysql_query("SELECT player_id FROM eq_guildmembers > WHERE > player_name = '$player_name'")) > 0) { $errmsg .= 'Player name already > exists'; $error = 1; } > if (!$player_password) { $errmsg .= 'You must specify a password for this > user'; $error = 1; } > > # For some weird reason the line below produces an error...I can't find > anything wrong > if ($player_password != $player_password_verify) { $errmsg .= 'Password > don't match. Please try again'; $error = 1; } > > if (!$error) { > mysql_query("INSERT INTO eq_guildmembers (player_name, date_joined, > player_email_address, player_icq, priv_admin, player_password) VALUES > ('$player_name',NOW(), > '$player_email_address','$player_icq','$priv_admin','$player_password')" ); > else { echo 'Submission successful...click here > to return to the roster'; exit; } > } > } > ?> > > > > -- > 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] Baffled, line producing error
What is the exact error message are you seeing? > -Original Message- > From: Craig Vincent [mailto:[EMAIL PROTECTED]] > Sent: Saturday, June 01, 2002 11:29 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Baffled, line producing error > > > I was happily coding when I came across a mysterious > error. I've traced it > to this line > > if ($player_password != $player_password_verify) { > $errmsg .= 'Password > don't match. Please try again'; $error = 1; } > > commented out the script runs fine, if this line is > active an error is > produced. My eyes are going bug eyed trying to find > what the problem is and > I'm hoping a second pair of eyes may point out my error. > > I've provided the entire script in case by chance the > error is actually > stemming from elsewhere in the script and I'm missing > that as well. The > error message from the compiler states the error is > stemming from line 15 > (which is the line I posted above). Any suggestions? > > require('config.inc.php'); > authenticate(); > > if ($action == 'add') { > // The connection/query commands will need to be > modified once the db > abstraction layer is ready > mysql_connect($mysql_host, $mysql_user, $mysql_pass); > mysql_select_db($mysql_database); > $errmsg = ''; > > if (mysql_num_rows(mysql_query("SELECT player_id FROM > eq_guildmembers WHERE > player_name = '$player_name'")) > 0) { $errmsg .= > 'Player name already > exists'; $error = 1; } > if (!$player_password) { $errmsg .= 'You must specify > a password for this > user'; $error = 1; } > > # For some weird reason the line below produces an > error...I can't find > anything wrong > if ($player_password != $player_password_verify) { > $errmsg .= 'Password > don't match. Please try again'; $error = 1; } > > if (!$error) { > mysql_query("INSERT INTO eq_guildmembers (player_name, > date_joined, > player_email_address, player_icq, priv_admin, > player_password) VALUES > ('$player_name',NOW(), > '$player_email_address','$player_icq','$priv_admin','$p > layer_password')"); > else { echo 'Submission successful... HREF="admin_roster.php">click here > to return to the roster'; exit; } > } > } > ?> > > > > -- > 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
[PHP] Baffled, line producing error
I was happily coding when I came across a mysterious error. I've traced it to this line if ($player_password != $player_password_verify) { $errmsg .= 'Password don't match. Please try again'; $error = 1; } commented out the script runs fine, if this line is active an error is produced. My eyes are going bug eyed trying to find what the problem is and I'm hoping a second pair of eyes may point out my error. I've provided the entire script in case by chance the error is actually stemming from elsewhere in the script and I'm missing that as well. The error message from the compiler states the error is stemming from line 15 (which is the line I posted above). Any suggestions? 0) { $errmsg .= 'Player name already exists'; $error = 1; } if (!$player_password) { $errmsg .= 'You must specify a password for this user'; $error = 1; } # For some weird reason the line below produces an error...I can't find anything wrong if ($player_password != $player_password_verify) { $errmsg .= 'Password don't match. Please try again'; $error = 1; } if (!$error) { mysql_query("INSERT INTO eq_guildmembers (player_name, date_joined, player_email_address, player_icq, priv_admin, player_password) VALUES ('$player_name',NOW(), '$player_email_address','$player_icq','$priv_admin','$player_password')"); else { echo 'Submission successful...click here to return to the roster'; exit; } } } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] baffled :<:
""Peter Houchin"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > can any one see a problem with this loop? > >$db = include"connect.inc"; > $foo = "SELECT * FROM 6pci WHERE card='$card' ORDER BY card"; > > $result = mysql_query($foo,$db); > > > while ( ($myrow = mysql_fetch_array($result) ) ) { > > $id = $myrow["id"]; > $card = $myrow["card"]; > $serial = $myrow["serial"]; > $avail = $myrow["avail"]; > $pn = $myrow["pn"]; > $cat = $myrow["cat"]; > $box = $myrow["box"]; > $quote = $myrow["quote"]; > } If you are doing print $myrow["card"] here, $myrow at this point is false, so that's why you see nothing. It's reset to false by the final $myrow = mysql_fetch_array($result). Here's wishing you more sleep and less debugging next time :-) Regards, John > ?> > > if i call say just $card it only displays the one record (the last one), the minute i try to call $myrow["card"]; i get nothing at all... any idea's? > > I have script identical to this that works perfectly .. only difference is this one has different names for the values > > Peter Houchin > [EMAIL PROTECTED] > = > _ __ /\ > /_/_/_\/ |_/ \ >/_/_/___ __ __ __ / \ >\_/_/_\ /_/ /_/ /_/ /_/ \ _ / > ___\_\_\/ /_/_/_/ /_//\/_/\_/ \/\_/ > \_//_/_/ /_/_/_/ /_/ \/_/v > > /_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ >/_/_ _/_/ __ __ __ /_/ __ __ > /_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\/_//_/_/_/ > /_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\ > /_/\_\/_/_/_/ /_/ \/_/ /_/ /_/\_\/_/_/_//_/_/_/ > = > Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755 > * We rent the dot in .COM! ** > -- 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] baffled :<:
On Tuesday 17 April 2001 07:59, you wrote: > can any one see a problem with this loop? > while ( ($myrow = mysql_fetch_array($result) ) ) { > > $id = $myrow["id"]; > $card = $myrow["card"]; > $serial = $myrow["serial"]; > $avail = $myrow["avail"]; > $pn = $myrow["pn"]; > $cat = $myrow["cat"]; > $box = $myrow["box"]; > $quote = $myrow["quote"]; > } > ?> > > if i call say just $card it only displays the one record (the last > one), the minute i try to call $myrow["card"]; i get nothing at all... > any idea's? Sure. Let's say you pull 4 records from the DB, with the "card" field set to "A", "B", "C" and "D" respectively. Now you loop over the records, setting $card to "A", then setting $card to "B", then to "C" and finally to "D". In other words: in each iteration you overwrite all previous values > I have script identical to this that works perfectly .. only difference > is this one has different names for the values I don't believe that, sorry :) -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) "Never doubt that a small group of thoughtful, committed people can change the world... Indeed, it's the only thing that ever has." - Margaret Mead -- 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] baffled :<:
In the loop, try using print_r($myarray) in the loop to see if the data is in there at all. Other than that, switch the while loop to: while ($myrow = mysql_fetch_assoc($result)) { That should fix it... -- Plutarck Should be working on something... ...but forgot what it was. ""Peter Houchin"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > can any one see a problem with this loop? > >$db = include"connect.inc"; > $foo = "SELECT * FROM 6pci WHERE card='$card' ORDER BY card"; > > $result = mysql_query($foo,$db); > > > while ( ($myrow = mysql_fetch_array($result) ) ) { > > $id = $myrow["id"]; > $card = $myrow["card"]; > $serial = $myrow["serial"]; > $avail = $myrow["avail"]; > $pn = $myrow["pn"]; > $cat = $myrow["cat"]; > $box = $myrow["box"]; > $quote = $myrow["quote"]; > } > ?> > > if i call say just $card it only displays the one record (the last one), the minute i try to call $myrow["card"]; i get nothing at all... any idea's? > > I have script identical to this that works perfectly .. only difference is this one has different names for the values > > Peter Houchin > [EMAIL PROTECTED] > = > _ __ /\ > /_/_/_\/ |_/ \ >/_/_/___ __ __ __ / \ >\_/_/_\ /_/ /_/ /_/ /_/ \ _ / > ___\_\_\/ /_/_/_/ /_//\/_/\_/ \/\_/ > \_//_/_/ /_/_/_/ /_/ \/_/v > > /_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ >/_/_ _/_/ __ __ __ /_/ __ __ > /_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\/_//_/_/_/ > /_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\ > /_/\_\/_/_/_/ /_/ \/_/ /_/ /_/\_\/_/_/_//_/_/_/ > = > Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755 > * We rent the dot in .COM! ** > -- 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] baffled :<:
I made a mistake: $id = $myrow["id"]; should read: $id[] = $myrow["id"]; -Original Message- From: Romulo Roberto Pereira [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 17, 2001 3:04 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] baffled :<:< even better: use foreach! $id = $myrow["id"]; . foreach ($id as $loop) { . } -Original Message- From: Chris Fry [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 17, 2001 3:00 AM To: Mark Maggelet Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] baffled :<:< This loop will only return the last record from the db as the variables are getting overwritten each time through the loop. It would make more sense to make each variable an array eg: $id[$i] = $myrow["id"]; or do something with each set of info inside the loop. Chris Mark Maggelet wrote: > On Tue, 17 Apr 2001 15:59:37 +1000, Peter Houchin > ([EMAIL PROTECTED]) wrote: > >can any one see a problem with this loop? > > > > >$db = include"connect.inc"; > >$foo = "SELECT * FROM 6pci WHERE card='$card' ORDER BY card"; > > > > $result = mysql_query($foo,$db); > > > > > >while ( ($myrow = mysql_fetch_array($result) ) ) { > > > >$id = $myrow["id"]; > >$card = $myrow["card"]; > >$serial = $myrow["serial"]; > >$avail = $myrow["avail"]; > >$pn = $myrow["pn"]; > >$cat = $myrow["cat"]; > >$box = $myrow["box"]; > >$quote = $myrow["quote"]; > >} > >?> > > > >if i call say just $card it only displays the one record (the last > >one) > > if you call it after the loop you mean? thats what i would expect to > be there. > > >the minute i try to call $myrow["card"]; i get nothing at > >all... any idea's? > > outside the loop again? well if the last call to mysql_fetch_array() > returns false, then that sounds right too. you probably mean to do > something inside the loop. here's another tip, use extract: > > while ( ($myrow = mysql_fetch_array($result) ) ) { > extract($myrow); > echo $card."\n"; > } > > >I have script identical to this that works perfectly .. only > >difference is this one has different names for the values > > > >Peter Houchin > >[EMAIL PROTECTED] > >= > > _ __ /\ > >/_/_/_\/ |_/ \ > > /_/_/___ __ __ __ / \ > > \_/_/_\ /_/ /_/ /_/ /_/ \ _ / > > ___\_\_\/ /_/_/_/ /_//\/_/\_/ \/\_/ > > \_//_/_/ /_/_/_/ /_/ \/_/v > > > >/_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ > > /_/_ _/_/ __ __ __ /_/ __ __ > > /_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\/_//_/_/_/ > > /_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\ > >/_/\_\/_/_/_/ /_/ \/_/ /_/ /_/\_\/_/_/_//_/_/_/ > >= > >Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755 > >* We rent the dot in .COM! ** > > > > -- > 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] -- Chris Fry Quillsoft Pty Ltd Specialists in Secure Internet Services and E-Commerce Solutions 10 Gray Street Kogarah NSW 2217 Australia Phone: +61 2 9553 1691 Fax: +61 2 9553 1692 Mobile: 0419 414 323 eMail: [EMAIL PROTECTED] http://www.quillsoft.com.au You can download our Public CA Certificate from:- https://ca.secureanywhere.com/htdocs/cacert.crt ** This information contains confidential information intended only for the use of the authorised recipient. If you are not an authorised recipient of this e-mail, please contact Quillsoft Pty Ltd by return e-mail. In this case, you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. This e-mail and any attachments may also contain copyright material belonging to Quillsoft Pty Ltd. The views expressed in this e-mail or attachments are the views of the author and not the views of Quillsoft Pty Ltd. You should only deal with the material contained in this e-mail if you are authorised to do so. This notice should not be removed. -- PHP General Mailing List (http://www.php.net/)
Re: [PHP] baffled :<:
That's too easy! Chris Romulo Roberto Pereira wrote: > Even better, > > $id[] = $myrow["id"]; > > then count them: > > for ($i=0;$i < count($id);$i++) { > .. > } > > Rom > -Original Message- > From: Chris Fry [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 17, 2001 3:00 AM > To: Mark Maggelet > Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: [PHP] baffled :<:< > > This loop will only return the last record from the db as the variables are > getting overwritten each time through the loop. It would make more sense to > make each variable an array eg: > > $id[$i] = $myrow["id"]; > > or do something with each set of info inside the loop. > > Chris > > Mark Maggelet wrote: > > > On Tue, 17 Apr 2001 15:59:37 +1000, Peter Houchin > > ([EMAIL PROTECTED]) wrote: > > >can any one see a problem with this loop? > > > > > > > >$db = include"connect.inc"; > > >$foo = "SELECT * FROM 6pci WHERE card='$card' ORDER BY card"; > > > > > > $result = mysql_query($foo,$db); > > > > > > > > >while ( ($myrow = mysql_fetch_array($result) ) ) { > > > > > >$id = $myrow["id"]; > > >$card = $myrow["card"]; > > >$serial = $myrow["serial"]; > > >$avail = $myrow["avail"]; > > >$pn = $myrow["pn"]; > > >$cat = $myrow["cat"]; > > >$box = $myrow["box"]; > > >$quote = $myrow["quote"]; > > >} > > >?> > > > > > >if i call say just $card it only displays the one record (the last > > >one) > > > > if you call it after the loop you mean? thats what i would expect to > > be there. > > > > >the minute i try to call $myrow["card"]; i get nothing at > > >all... any idea's? > > > > outside the loop again? well if the last call to mysql_fetch_array() > > returns false, then that sounds right too. you probably mean to do > > something inside the loop. here's another tip, use extract: > > > > while ( ($myrow = mysql_fetch_array($result) ) ) { > > extract($myrow); > > echo $card."\n"; > > } > > > > >I have script identical to this that works perfectly .. only > > >difference is this one has different names for the values > > > > > >Peter Houchin > > >[EMAIL PROTECTED] > > >= > > > _ __ /\ > > >/_/_/_\/ |_/ \ > > > /_/_/___ __ __ __ / \ > > > \_/_/_\ /_/ /_/ /_/ /_/ \ _ / > > > ___\_\_\/ /_/_/_/ /_//\/_/\_/ \/\_/ > > > \_//_/_/ /_/_/_/ /_/ \/_/v > > > > > >/_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ > > > /_/_ _/_/ __ __ __ /_/ __ __ > > > /_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\/_//_/_/_/ > > > /_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\ > > >/_/\_\/_/_/_/ /_/ \/_/ /_/ /_/\_\/_/_/_//_/_/_/ > > >= > > >Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755 > > >* We rent the dot in .COM! ** > > > > > > > -- > > 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] > > -- > Chris Fry > Quillsoft Pty Ltd > Specialists in Secure Internet Services and E-Commerce Solutions > 10 Gray Street > Kogarah > NSW 2217 > Australia > > Phone: +61 2 9553 1691 > Fax: +61 2 9553 1692 > Mobile: 0419 414 323 > eMail: [EMAIL PROTECTED] > http://www.quillsoft.com.au > > You can download our Public CA Certificate from:- > https://ca.secureanywhere.com/htdocs/cacert.crt > > ** > > This information contains confidential information intended only for > the use of the authorised recipient. If you are not an authorised > recipient of this e-mail, please contact Quillsoft Pty Ltd by return > e-mail. > In this case, you should not read, print, re-transmit, store or act > in reliance on this e-mail or any attachments, and should destro
RE: [PHP] baffled :<:
even better: use foreach! $id = $myrow["id"]; .. foreach ($id as $loop) { .. } -Original Message- From: Chris Fry [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 17, 2001 3:00 AM To: Mark Maggelet Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] baffled :<:< This loop will only return the last record from the db as the variables are getting overwritten each time through the loop. It would make more sense to make each variable an array eg: $id[$i] = $myrow["id"]; or do something with each set of info inside the loop. Chris Mark Maggelet wrote: > On Tue, 17 Apr 2001 15:59:37 +1000, Peter Houchin > ([EMAIL PROTECTED]) wrote: > >can any one see a problem with this loop? > > > > >$db = include"connect.inc"; > >$foo = "SELECT * FROM 6pci WHERE card='$card' ORDER BY card"; > > > > $result = mysql_query($foo,$db); > > > > > >while ( ($myrow = mysql_fetch_array($result) ) ) { > > > >$id = $myrow["id"]; > >$card = $myrow["card"]; > >$serial = $myrow["serial"]; > >$avail = $myrow["avail"]; > >$pn = $myrow["pn"]; > >$cat = $myrow["cat"]; > >$box = $myrow["box"]; > >$quote = $myrow["quote"]; > >} > >?> > > > >if i call say just $card it only displays the one record (the last > >one) > > if you call it after the loop you mean? thats what i would expect to > be there. > > >the minute i try to call $myrow["card"]; i get nothing at > >all... any idea's? > > outside the loop again? well if the last call to mysql_fetch_array() > returns false, then that sounds right too. you probably mean to do > something inside the loop. here's another tip, use extract: > > while ( ($myrow = mysql_fetch_array($result) ) ) { > extract($myrow); > echo $card."\n"; > } > > >I have script identical to this that works perfectly .. only > >difference is this one has different names for the values > > > >Peter Houchin > >[EMAIL PROTECTED] > >= > > _ __ /\ > >/_/_/_\/ |_/ \ > > /_/_/___ __ __ __ / \ > > \_/_/_\ /_/ /_/ /_/ /_/ \ _ / > > ___\_\_\/ /_/_/_/ /_//\/_/\_/ \/\_/ > > \_//_/_/ /_/_/_/ /_/ \/_/v > > > >/_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ > > /_/_ _/_/ __ __ __ /_/ __ __ > > /_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\/_//_/_/_/ > > /_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\ > >/_/\_\/_/_/_/ /_/ \/_/ /_/ /_/\_\/_/_/_//_/_/_/ > >= > >Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755 > >* We rent the dot in .COM! ** > > > > -- > 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] -- Chris Fry Quillsoft Pty Ltd Specialists in Secure Internet Services and E-Commerce Solutions 10 Gray Street Kogarah NSW 2217 Australia Phone: +61 2 9553 1691 Fax: +61 2 9553 1692 Mobile: 0419 414 323 eMail: [EMAIL PROTECTED] http://www.quillsoft.com.au You can download our Public CA Certificate from:- https://ca.secureanywhere.com/htdocs/cacert.crt ** This information contains confidential information intended only for the use of the authorised recipient. If you are not an authorised recipient of this e-mail, please contact Quillsoft Pty Ltd by return e-mail. In this case, you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. This e-mail and any attachments may also contain copyright material belonging to Quillsoft Pty Ltd. The views expressed in this e-mail or attachments are the views of the author and not the views of Quillsoft Pty Ltd. You should only deal with the material contained in this e-mail if you are authorised to do so. This notice should not be removed. -- 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] baffled :<:
Even better, $id[] = $myrow["id"]; then count them: for ($i=0;$i < count($id);$i++) { .. } Rom -Original Message- From: Chris Fry [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 17, 2001 3:00 AM To: Mark Maggelet Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] baffled :<:< This loop will only return the last record from the db as the variables are getting overwritten each time through the loop. It would make more sense to make each variable an array eg: $id[$i] = $myrow["id"]; or do something with each set of info inside the loop. Chris Mark Maggelet wrote: > On Tue, 17 Apr 2001 15:59:37 +1000, Peter Houchin > ([EMAIL PROTECTED]) wrote: > >can any one see a problem with this loop? > > > > >$db = include"connect.inc"; > >$foo = "SELECT * FROM 6pci WHERE card='$card' ORDER BY card"; > > > > $result = mysql_query($foo,$db); > > > > > >while ( ($myrow = mysql_fetch_array($result) ) ) { > > > >$id = $myrow["id"]; > >$card = $myrow["card"]; > >$serial = $myrow["serial"]; > >$avail = $myrow["avail"]; > >$pn = $myrow["pn"]; > >$cat = $myrow["cat"]; > >$box = $myrow["box"]; > >$quote = $myrow["quote"]; > >} > >?> > > > >if i call say just $card it only displays the one record (the last > >one) > > if you call it after the loop you mean? thats what i would expect to > be there. > > >the minute i try to call $myrow["card"]; i get nothing at > >all... any idea's? > > outside the loop again? well if the last call to mysql_fetch_array() > returns false, then that sounds right too. you probably mean to do > something inside the loop. here's another tip, use extract: > > while ( ($myrow = mysql_fetch_array($result) ) ) { > extract($myrow); > echo $card."\n"; > } > > >I have script identical to this that works perfectly .. only > >difference is this one has different names for the values > > > >Peter Houchin > >[EMAIL PROTECTED] > >= > > _ __ /\ > >/_/_/_\/ |_/ \ > > /_/_/___ __ __ __ / \ > > \_/_/_\ /_/ /_/ /_/ /_/ \ _ / > > ___\_\_\/ /_/_/_/ /_//\/_/\_/ \/\_/ > > \_//_/_/ /_/_/_/ /_/ \/_/v > > > >/_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ > > /_/_ _/_/ __ __ __ /_/ __ __ > > /_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\/_//_/_/_/ > > /_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\ > >/_/\_\/_/_/_/ /_/ \/_/ /_/ /_/\_\/_/_/_//_/_/_/ > >= > >Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755 > >* We rent the dot in .COM! ** > > > > -- > 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] -- Chris Fry Quillsoft Pty Ltd Specialists in Secure Internet Services and E-Commerce Solutions 10 Gray Street Kogarah NSW 2217 Australia Phone: +61 2 9553 1691 Fax: +61 2 9553 1692 Mobile: 0419 414 323 eMail: [EMAIL PROTECTED] http://www.quillsoft.com.au You can download our Public CA Certificate from:- https://ca.secureanywhere.com/htdocs/cacert.crt ** This information contains confidential information intended only for the use of the authorised recipient. If you are not an authorised recipient of this e-mail, please contact Quillsoft Pty Ltd by return e-mail. In this case, you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. This e-mail and any attachments may also contain copyright material belonging to Quillsoft Pty Ltd. The views expressed in this e-mail or attachments are the views of the author and not the views of Quillsoft Pty Ltd. You should only deal with the material contained in this e-mail if you are authorised to do so. This notice should not be removed. -- 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] baffled :<:
This loop will only return the last record from the db as the variables are getting overwritten each time through the loop. It would make more sense to make each variable an array eg: $id[$i] = $myrow["id"]; or do something with each set of info inside the loop. Chris Mark Maggelet wrote: > On Tue, 17 Apr 2001 15:59:37 +1000, Peter Houchin > ([EMAIL PROTECTED]) wrote: > >can any one see a problem with this loop? > > > > >$db = include"connect.inc"; > >$foo = "SELECT * FROM 6pci WHERE card='$card' ORDER BY card"; > > > > $result = mysql_query($foo,$db); > > > > > >while ( ($myrow = mysql_fetch_array($result) ) ) { > > > >$id = $myrow["id"]; > >$card = $myrow["card"]; > >$serial = $myrow["serial"]; > >$avail = $myrow["avail"]; > >$pn = $myrow["pn"]; > >$cat = $myrow["cat"]; > >$box = $myrow["box"]; > >$quote = $myrow["quote"]; > >} > >?> > > > >if i call say just $card it only displays the one record (the last > >one) > > if you call it after the loop you mean? thats what i would expect to > be there. > > >the minute i try to call $myrow["card"]; i get nothing at > >all... any idea's? > > outside the loop again? well if the last call to mysql_fetch_array() > returns false, then that sounds right too. you probably mean to do > something inside the loop. here's another tip, use extract: > > while ( ($myrow = mysql_fetch_array($result) ) ) { > extract($myrow); > echo $card."\n"; > } > > >I have script identical to this that works perfectly .. only > >difference is this one has different names for the values > > > >Peter Houchin > >[EMAIL PROTECTED] > >= > > _ __ /\ > >/_/_/_\/ |_/ \ > > /_/_/___ __ __ __ / \ > > \_/_/_\ /_/ /_/ /_/ /_/ \ _ / > > ___\_\_\/ /_/_/_/ /_//\/_/\_/ \/\_/ > > \_//_/_/ /_/_/_/ /_/ \/_/v > > > >/_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ > > /_/_ _/_/ __ __ __ /_/ __ __ > > /_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\/_//_/_/_/ > > /_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\ > >/_/\_\/_/_/_/ /_/ \/_/ /_/ /_/\_\/_/_/_//_/_/_/ > >= > >Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755 > >* We rent the dot in .COM! ** > > > > -- > 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] -- Chris Fry Quillsoft Pty Ltd Specialists in Secure Internet Services and E-Commerce Solutions 10 Gray Street Kogarah NSW 2217 Australia Phone: +61 2 9553 1691 Fax: +61 2 9553 1692 Mobile: 0419 414 323 eMail: [EMAIL PROTECTED] http://www.quillsoft.com.au You can download our Public CA Certificate from:- https://ca.secureanywhere.com/htdocs/cacert.crt ** This information contains confidential information intended only for the use of the authorised recipient. If you are not an authorised recipient of this e-mail, please contact Quillsoft Pty Ltd by return e-mail. In this case, you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. This e-mail and any attachments may also contain copyright material belonging to Quillsoft Pty Ltd. The views expressed in this e-mail or attachments are the views of the author and not the views of Quillsoft Pty Ltd. You should only deal with the material contained in this e-mail if you are authorised to do so. This notice should not be removed. -- 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] baffled :<:
On Tue, 17 Apr 2001 15:59:37 +1000, Peter Houchin ([EMAIL PROTECTED]) wrote: >can any one see a problem with this loop? > > $db = include"connect.inc"; >$foo = "SELECT * FROM 6pci WHERE card='$card' ORDER BY card"; > > $result = mysql_query($foo,$db); > > >while ( ($myrow = mysql_fetch_array($result) ) ) { > >$id = $myrow["id"]; >$card = $myrow["card"]; >$serial = $myrow["serial"]; >$avail = $myrow["avail"]; >$pn = $myrow["pn"]; >$cat = $myrow["cat"]; >$box = $myrow["box"]; >$quote = $myrow["quote"]; >} >?> > >if i call say just $card it only displays the one record (the last >one) if you call it after the loop you mean? thats what i would expect to be there. >the minute i try to call $myrow["card"]; i get nothing at >all... any idea's? outside the loop again? well if the last call to mysql_fetch_array() returns false, then that sounds right too. you probably mean to do something inside the loop. here's another tip, use extract: while ( ($myrow = mysql_fetch_array($result) ) ) { extract($myrow); echo $card."\n"; } >I have script identical to this that works perfectly .. only >difference is this one has different names for the values > >Peter Houchin >[EMAIL PROTECTED] >= > _ __ /\ >/_/_/_\/ |_/ \ > /_/_/___ __ __ __ / \ > \_/_/_\ /_/ /_/ /_/ /_/ \ _ / > ___\_\_\/ /_/_/_/ /_//\/_/\_/ \/\_/ > \_//_/_/ /_/_/_/ /_/ \/_/v > >/_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ > /_/_ _/_/ __ __ __ /_/ __ __ > /_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\/_//_/_/_/ > /_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\ >/_/\_\/_/_/_/ /_/ \/_/ /_/ /_/\_\/_/_/_//_/_/_/ >= >Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755 >* We rent the dot in .COM! ** > -- 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] baffled :<:
You didn't really say that in your initial post :-) So, what you mean is that the db line is not what you actually have in your script? The what do you really have? Just by looking at the script you posted, the reason it doesn't work certainly seems to be the invalid database handler. If you have a function that returns a handler, the syntax would be something like: include "connect.inc"; $db = db_connect(); This is assuming you have a function called db_connect() that returns a database handler in your 'connect.inc' file. Seung-woo Nam Peter Houchin wrote: > > yes i know it was mearly there to show i had it in my script as i said in my initial >post i could get info from the db, just not in the while loop > > -Original Message- > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 17, 2001 4:08 PM > To: Peter Houchin > Cc: Php-General@Lists. Php. Net > Subject: Re: [PHP] baffled :<:< > > > $db = include"connect.inc"; > > includes do not return anything useful, so this is a bogus statement. > > > $foo = "SELECT * FROM 6pci WHERE card='$card' ORDER BY card"; > > > > $result = mysql_query($foo,$db); > > An include certainly cannot return a database handle. Included files > operate in the same variable scope as the script doing the inclusion. So > simply set $db in your connect.inc file and it will automatically be > available to you after the include. > > -Rasmus -- 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] baffled :<:
yes i know it was mearly there to show i had it in my script as i said in my initial post i could get info from the db, just not in the while loop -Original Message- From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 17, 2001 4:08 PM To: Peter Houchin Cc: Php-General@Lists. Php. Net Subject: Re: [PHP] baffled :<:< > $db = include"connect.inc"; includes do not return anything useful, so this is a bogus statement. > $foo = "SELECT * FROM 6pci WHERE card='$card' ORDER BY card"; > > $result = mysql_query($foo,$db); An include certainly cannot return a database handle. Included files operate in the same variable scope as the script doing the inclusion. So simply set $db in your connect.inc file and it will automatically be available to you after the include. -Rasmus
Re: [PHP] baffled :<:
> $db = include"connect.inc"; includes do not return anything useful, so this is a bogus statement. > $foo = "SELECT * FROM 6pci WHERE card='$card' ORDER BY card"; > > $result = mysql_query($foo,$db); An include certainly cannot return a database handle. Included files operate in the same variable scope as the script doing the inclusion. So simply set $db in your connect.inc file and it will automatically be available to you after the include. -Rasmus -- 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] baffled :<:
can any one see a problem with this loop? if i call say just $card it only displays the one record (the last one), the minute i try to call $myrow["card"]; i get nothing at all... any idea's? I have script identical to this that works perfectly .. only difference is this one has different names for the values Peter Houchin [EMAIL PROTECTED] = _ __ /\ /_/_/_\/ |_/ \ /_/_/___ __ __ __ / \ \_/_/_\ /_/ /_/ /_/ /_/ \ _ / ___\_\_\/ /_/_/_/ /_//\/_/\_/ \/\_/ \_//_/_/ /_/_/_/ /_/ \/_/v /_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ /_/_ _/_/ __ __ __ /_/ __ __ /_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\/_//_/_/_/ /_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\ /_/\_\/_/_/_/ /_/ \/_/ /_/ /_/\_\/_/_/_//_/_/_/ = Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755 * We rent the dot in .COM! **