RE: [PHP] Re: Problems connecting to a MySQL database
previous page. Try putting the log in information and anything else needed in hidden fields in your form. YIKES!...hidden form fields are viewable in the html source generated. session_register() anyone? I thought you were trying to re-use the db connection? if so, use mysql_pconnect() if the mysql.allow_persistent directive is enabled. -Craig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP + MySQL looping question
The problem is I have to reset the SQL result array on each for loop. How do you do that? $myNewArrayFullofSqlResultsThatICanLoopOverAsManyTimesAsIWant = mysql_query($sql); -Craig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP + MySQL looping question
Set the new array before your for loops, then loop over the array. -Craig -Original Message- From: Mark McCulligh [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 12, 2002 4:56 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] PHP + MySQL looping question If I understand you if you use the mysql_query($sql) again won't it rerun my SQL again, not just reprint. Example: $result = mysql_query($sql); for ($i = 1; $i = 3; $i++) { while ($row = mysql_fetch_array($result)) { //Some Code echo $row['filed']; } //Reset result array $result = mysql_query($sql); } -- _ Mark McCulligh, Application Developer / Analyst Sykes Canada Corporation www.SykesCanada.com (888)225-6824 ex. 3262 [EMAIL PROTECTED] Craig Thomas [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... The problem is I have to reset the SQL result array on each for loop. How do you do that? $myNewArrayFullofSqlResultsThatICanLoopOverAsManyTimesAsIWant = mysql_query($sql); -Craig -- 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] MySQL error
$mysql_result = mysql_query($query, $mysql_link); I am not sure if this is your only problem or not, but mysql_result(); is a function in php. Using a function name as a variable seems like it will just lead to confusion to me. I'd try to avoid it. -- line 36 while($row = mysql_fetch_row($mysql_result)) Anyway, where do you define $row? HTH -Craig -Original Message- From: GWAD Mailinglist [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 12, 2002 6:01 PM To: [EMAIL PROTECTED] Subject: [PHP] MySQL error Hi, I have following problem: list.php3 ? // connect to db include(connect_db.php3); // get everything from catalog table $query = SELECT * FROM yritykset ORDER BY ynimi ASC; $mysql_result = mysql_query($query, $mysql_link); // get each row -- line 36 while($row = mysql_fetch_row($mysql_result)) { //get columns $id = $row[0]; $ynimi = $row[1]; $ylahi = $row[2]; $ypostios = $row[3]; $ypostitmp = $row[11]; print(TABLE WIDTH=\750\ BORDER=\0\\n); print(TR\n); print(TD WIDTH=\550\$ynimi, $ylahi, $ypostios $ypostitmpTD\n); print(TD WIDTH=\200\A HREF=\tarkenna.php3?id=$id\MUOKKAA/A - A HREF=\poista.php3?id=$id\POISTA/ATD); print(/TR\n); print(/TABLE\n); } // disconnect mysql_close($mysql_link); ? when run, i'll following error messages: Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /www/domains/lammidb.phnet.fi/public_html/kaikki.php3 on line 36 -- 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] MySQL error
-- line 36 while($row = mysql_fetch_row($mysql_result)) Anyway, where do you define $row? HTH -Craig DOH! it's been a long one... -Craig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Pls Help: Moving script from Win to Linux
If you do not want to re-write all your code and your web server is Apache and your host allows the use of .htaccess files you can turn register_globals = on programmatically: http://www.php.net/manual/en/configuration.directives.php#ini.register-globa ls (php_flag register_globals = ON;) i think. Just a thought, -Craig -Original Message- From: Rodney Green [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 10, 2002 11:35 AM To: Shane; [EMAIL PROTECTED] Subject: Re: [PHP] Pls Help: Moving script from Win to Linux Needs to be changed to the following if your forms are using the GET HTTP method: if(!isset($_GET[var])){ // do nothing }else{ // VAR IS SET.. DO SOMETHING } If your forms use the POST HTTP method then it needs to be changed to: if(!isset($_POST[var])){ // do nothing }else{ // VAR IS SET.. DO SOMETHING } I can pass variables till I am blue in the face, even see them in the URL but they are still showing up as (!isset) Are you accessing these variables through $var or $_GET[var]? I am accessing them as $var. Example (from memory) if(!isset($var)){ // do nothing }else{ // VAR IS SET.. DO SOMETHING } Real basic stuff, but if I echo out the value so I see if it matches what I see in the above URL I get... (SAMPLE URL) blah/my_url.php?submit=submit (SAMPLE CODE) ? echo Submit = .$submit ? (SAMPLE RESULTS) Submit = Thanks gang! I have never needed to use $_GET[var] What is the main difference? Would this be a setting difference between a WIN setup of PHP and a Linux setu of PHP? - over -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Help please: Unable to get $_POST[variable]; to work in a form.
Using $_REQUEST[] works because the vars are in the http request, but $_POST[] contains nothing as the other poster noted: mehtod=post -Original Message- From: David Scott [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 10, 2002 1:20 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: Help please: Unable to get $_POST[variable]; to work in a form. Using $_REQUEST[variable] causes the script to work. Why is this? And, why can I not use $_POST? David Scott [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am going through the introductory tutorial on http://www.php.net/ and am stuck on this page: http://www.php.net/manual/en/tutorial.forms.php I have been able to get all of the examples up to this point to work. The form is simple: it asks for a text name, a text age and has a submit button. The information is submitted to action.php. Action.php contains this code: Hi ?php echo $_POST[name]; ?. You are ?php echo $_POST[age]; ? years old. I saved action.php as a text file with only the information above. When I enter JoeBob into the name field and 27 into the age field, I get this for output: Hi Notice: Undefined index: name in c:\inetpub\wwwroot\action.php on line 1 . You are Notice: Undefined index: age in c:\inetpub\wwwroot\action.php on line 2 years old. What can I do to remedy this? -- 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] Pls Help: Moving script from Win to Linux
Can't be done at run-time. See table in manual. Perhaps programmatically was the wrong word. Using .htaccess files it can be set per directory/site. http://www.php.net/manual/en/security.registerglobals.php (read to the BOTTOM of the page). -Craig -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 10, 2002 2:04 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Pls Help: Moving script from Win to Linux On Wednesday 11 December 2002 02:38, Craig Thomas wrote: If you do not want to re-write all your code and your web server is Apache and your host allows the use of .htaccess files you can turn register_globals = on programmatically: http://www.php.net/manual/en/configuration.directives.php#ini.regi ster-glob a ls (php_flag register_globals = ON;) i think. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* A government that is big enough to give you all you want is big enough to take it all away. -- Barry Goldwater */ -- 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