RE: [PHP] Re: Print ONCE ONLY?????
I think this is actually the problem The first time you do $row = mysql_fetch_array($result); it reads the first row. Then you don't do anything with that data, but move on to the next one right away in the while: while ($row = mysql_fetch_array($result)) and only then you print out the data. So you are always skipping the first record. Sincerely, Pavel Kharitonov Project Manager Intechnic Corporation http://www.intechnic.com Phone: (847) 816-1231 -Original Message- From: Michael Kimsal [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 12, 2002 5:14 PM To: Dani Cc: PHP LIST Subject: [PHP] Re: Print ONCE ONLY? Dani wrote: Hi Again! Why does this print only one record? 1. I have checked on the table on MYSQL and I have 2 records with this data. 2. Can I actually use the word and twice or three times for filtering the data that I need during query?? (example: $query = select * from main_table where item_type = 'hotel' and class = 'melati' and price = '200' and facilities = 'swimming pool' #2 - yes. that's what SQL is all about... #1 - Why do the $row=, then also do it in a while loop? Why not just do it in a while loop? I'm not sure that'd necessarily help in this case (most likely won't) but it would certainly be less typing in the future. Are you postive 2 rows match the 'hotel' and 'melati'? Could some body help please??? here is my code ... $query = select * from main_table where item_type = 'hotel' and class = 'melati'; $result = mysql_query($query); $row = mysql_fetch_array($result); echo $row[item_id],BR; while ($row = mysql_fetch_array($result)) { echo WHILE RESULT,$row[item_type],BR,$row[class]; } Michael Kimsal PHP Training Courses http://www.tapinternet.com/php/ 734-480-9961 -- 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]
[PHP] Problem input in flex scanner failed
Hi, Has anybody encountered the following error: Fatal error: input in flex scanner failed in /***path***/info on line 1 The code that is most likely causing this is: ?php $my_cat_cust1=index.htm; ? !-- Some HTML HERE -- ?php if(file_exists(/***path***/info/$my_cat_cust1)) include(/***path***/info/$my_cat_cust1); ? I'm running 4.0.6 on a Redhat 6.2 I'm completely stumped, this looks like a completely innocent code. Any help or hits would be really appreciated!! Sincerely, Pavel Kharitonov Project Manager Intechnic Corporation http://www.intechnic.com Phone: (847) 816-1231 -- 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] Newbie question
The problem is here: $nfl_player_id = mysql_query(SELECT player_id FROM nfl_players WHERE first_name='$aqfl_player_first' AND last_name='$aqfl_player_last' AND position='$aqfl_player_position' AND nfl_team='$aqfl_player_nfl_team'); mysql_query does not return the ID, but the handle of the connection. What you need to do is fetch the results that the query has generated. You can replace the above code with this one: //start $result = mysql_query(SELECT player_id FROM nfl_players WHERE first_name='$aqfl_player_first' AND last_name='$aqfl_player_last' AND position='$aqfl_player_position' AND nfl_team='$aqfl_player_nfl_team'); $row_id=mysql_fetch_array($result); $nfl_player_id = $row_id[0]; //end This will get you the right ID and should allow to do the update, unless there are other pbs :) Sincerely, Pavel Kharitonov Project Manager Intechnic Corporation http://www.intechnic.com Phone: (847) 816-1231 -Original Message- From: Bob Eldred [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 09, 2002 1:54 PM To: [EMAIL PROTECTED] Subject: [PHP] Newbie question Hi there, I'm really really new to both PHP and MySQL, so this is probably going to turn out to be an easy fix. The basis is this: I have a MySQL database with two tables in it. I'm trying to update 1 of the fields (aqfl_team) in the first table (nfl_players) with a value from a field (aqfl_team) from the second table (temp_aqfl_rosters). The PHP document looks like this: html body ?php $db = mysql_connect(localhost,root,password); mysql_select_db(aqfl,$db); $aqfl_result = mysql_query(SELECT * FROM temp_aqfl_rosters); echo Updating rosters.; $myrow = mysql_fetch_array($aqfl_result); do { $aqfl_player_first = $myrow[first_name]; $aqfl_player_last = $myrow[last_name]; $aqfl_player_position = $myrow[position]; $aqfl_player_nfl_team = $myrow[nfl_team]; $aqfl_player_aqfl_team = $myrow[aqfl_team]; $nfl_player_id = mysql_query(SELECT player_id FROM nfl_players WHERE first_name='$aqfl_player_first' AND last_name='$aqfl_player_last' AND position='$aqfl_player_position' AND nfl_team='$aqfl_player_nfl_team'); $result = mysql_query(UPDATE nfl_players SET aqfl_team='$aqfl_player_aqfl_team' WHERE player_id='$nfl_player_id'); echo $aqfl_player_first $aqfl_player_last updated ($aqfl_player_position, $aqfl_player_nfl_team, $aqfl_player_aqfl_team); } while ($myrow = mysql_fetch_array($aqfl_result)); ? /body /html The end result is that I get a screenful of data (every player, NFL team, and AQFL team is correct) stating that the various players are updated, but but the field update in nfl_players is not actually done. I'm sure it's a syntax issue, but I don't know what's the actual problem. Any help? Thanks, Bob -- 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] Form Problem
I had the same problem happen to me a couple of days ago. A form that has been working has stopped working all of a sudden - all fields would be submitting as blank (undefined). Unfortunately, I was not able figure out what the problem was :-( I got it down to the line that was causing my form to stop submitting - a BASE tag. I still do not understand why. I ended up deleting the entire directory, re-uploading the files and they started working all of a sudden. I know it's not much help, just my 2 cents. Sincerely, Pavel Kharitonov Project Manager Intechnic Corporation http://www.intechnic.com Phone: (847) 816-1231 -Original Message- From: Chris Kwasneski [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 09, 2002 1:30 PM To: [EMAIL PROTECTED] Subject: [PHP] Form Problem I'm having a problem with a HTML form. When it gets submitted, I keep getting an undefined variable error message. And a blank page (aside from a 'Hi' written on it...). I don't think its a problem with my install of PHP as other PHP code is running fine, but can't get it to print out this name. I'm probably missing something simple, but I just can't figure it out. Any help would be appreciated. the form: html head titleMy Form/title /head body form action=test2.php method=GET My name is: br input type=text name=YourName input type=submit name=submit value=Submit / /form /body /html Test2.php file: html head titleForm test.../title /head body Hi ?php echo $YourName; ? /body /html The url that is getting passed to the file: http://localhost/test2.php?YourName=Chrissubmit=Submit The error message I'm getting: [Wed Jan 09 14:24:47 2002] [error] [client 127.0.0.1] PHP Warning: Undefined variable: YourName in c:\program files\apache group\apache\htdocs\test2.php on line 10 -- 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]
[PHP] Warning: offset not contained in string
Hi everybody, I'm very new to this list, so please bear with me if I break the unspoken rules of the list (and let me know, of course:) I have a question: did somebody encounter this warning before: Warning: offset not contained in string ***myscript.php on line xxx line xxx contains the following code: $query.= WHERE ses_id=$sid; This warning started happening after I added some ' (single quotes) to the string $query somewhere else at the top. At least that's the best reason I can come up with. TIA Sincerely, Pavel Kharitonov Project Manager Intechnic Corporation http://www.intechnic.com Phone: (847) 816-1231 -- 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]