Re: [PHP] new to php, need help..
Try naming the file with a .php extension. It is also possible your server does not support php. Good luck, Chris From: Jonathan [EMAIL PROTECTED] Reply-To: Jonathan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP] new to php, need help.. Date: Thu, 20 Feb 2003 01:34:12 -0600 hi all, i've only begun learning php around 1 week ago, i'm having trouble with this code, html head titleUntitled Document/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body ? if (isset($subject)) { echo $subject[0]br /; echo $subject[1]p /; } else { $subject[0] = Enter Subject A; $subject[1] = Enter Subject B; } ? FORM ACTION=? echo $PHP_SELF; ? input type=text NAME=subject[0] value=? echo $subject[0]; ? / input type=text NAME=subject[1] value=? echo $subject[1]; ? / input type=submit value=Submit! / input type=reset value=Reset / /FORM /body /html i got the body code from www.linuxguruz.org but i can't seem to get my input value correct, rather then parsing the variable subject[0] it passes the words ? echo $subject[0]; ? as the value instead, i'm using macromedia dreamweaver MX as my html text editor pls help... thanks! Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New to PHP Need Help
Hello, The result $Location_info is an array.So you've got the answer 'Array'. Consider that you requested MySQL to fetch several columns through SQL Select * from So the result was an array. You can get the content of the result like $Location_info[0],$Location_ info[2],and so on. Hiroshi Ayukawa http://hoover.ktplan.ne.jp/kaihatsu/php_en/index.php I am trying to define variables through an anchor tag to retrive data from MySQL, When the script runs it displays Array. I am running WIN2K and IIS 5 echo a href=location.php?location=2Camp Street Cafe/a; Here is the script that is called. ?php $db = mysql_connect(localhost, , ) or die (Could not connect to Localhost); mysql_select_db (ETM, $db) or die (Could not connect to the Database); $table = locations; $location = ($_REQUEST[location]); $query = Select * from $table where Location_ID = $location; $result= mysql_query($query); $Location_Info = mysql_fetch_row($result); echo p$Location_Info; ? -- 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] New to PHP Need Help
change: $Location_Info = mysql_fetch_row($result); to: $row = mysql_fetch_array($result); $Location_Info = $row['fieldname']; replace fieldname with the real name of your database field -Original Message- From: Jason Tobias [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 9:29 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP] New to PHP Need Help I am trying to define variables through an anchor tag to retrive data from MySQL, When the script runs it displays Array. I am running WIN2K and IIS 5 echo a href=location.php?location=2Camp Street Cafe/a; Here is the script that is called. ?php $db = mysql_connect(localhost, , ) or die (Could not connect to Localhost); mysql_select_db (ETM, $db) or die (Could not connect to the Database); $table = locations; $location = ($_REQUEST[location]); $query = Select * from $table where Location_ID = $location; $result= mysql_query($query); $Location_Info = mysql_fetch_row($result); echo p$Location_Info; ? -- 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] New to PHP Need Help
Firstly, cross-posting like this is a huge no-no, please don't do that again. When the script runs it displays Array. Printing arrays directly will do that. Logically speaking, how do you expect PHP to know what value to get here? You are SELECTing many. I am running WIN2K and IIS 5 I'm sorry ;) echo a href=location.php?location=2Camp Street Cafe/a; Here is the script that is called. ?php $db = mysql_connect(localhost, , ) or die (Could not connect to Localhost); mysql_select_db (ETM, $db) or die (Could not connect to the Database); If you start running into problems, please consider mysql_error() $table = locations; $location = ($_REQUEST[location]); No need for the () here. $query = Select * from $table where Location_ID = $location; Notice how you're selecting many columns here, not just one. $result= mysql_query($query); $Location_Info = mysql_fetch_row($result); Looking in the manual, the entry for mysql_fetch_row tells us: mysql_fetch_row -- Get a result row as an enumerated array array mysql_fetch_row ( resource result) So it returns an array. If you prefer the _row format then continue to use it, for example using list(): list($id, $name, $email) = mysql_fetch_row($result); Or just: $row = mysql_fetch_row($result); print $row[0]; // This is an enumerated array (numerical) print $row[1]; Or use a function like mysql_fetch_assoc instead: $row = mysql_fetch_assoc($result); print $row['id']; // with id being a column name // selected via the query print $row['name']; And lastly, if you're not going to use all the data, don't SELECT * of it. Good start, keep it going :) Regards, Philip Olson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New to PHP, need help.
Michele, Possible a dumb question, but does the machine you are running it on have PHP installed and configured to work with the server software? If so, did you name the file correctly? It may need to be called page.php rather than page.html... M On Thu, 7 Mar 2002, Michele wrote: I currently working with some free source from CyberGl and am having a problem with the membership module. I've inserted the php into the beginning of the page but when I go to test the page, nothing appears. I don't get a 404 error or any error, the page just doesn't display. Any ideas? Thanks, Michele -- 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] New on PHP, need help with sessions
on 7/3/01 12:19 AM, Victor SpÄng Arthursson at [EMAIL PROTECTED] wrote: Hi! I'm converting from ASP/VBScript, and need to know how to declare a session variable. i feel your pain. i just finished moving a site from ASP/VBScript to PHP/Javascript, learning ASP/VBScript and Javascript along the way :) In VBScript I just type in: % session(any) = victor % Then I can print that variable on any page on the same webpage using: % response.write session(any) % as long as I don't close the browser or the variable times out. Question: How do I achieve the same thing in PHP..? you'll want to take a look at http://www.php.net/manual/en/ref.session.php you can start a session by starting it or by registering a variable. session_start() session_register(variablename) once set, the variables are available as $HTTP_SESSION_VARS[variablename] or (depending on how php is configured) $variablename. on my macos x box, $variablename does work. Thanks in advance, Sincerely Victor PS Using PHP 4 on Mac OS X DS -- mike cullerton -- 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] New on PHP, need help with sessions
i believe this is track_vars, but as of php 4.0.3, this is always on. on 7/3/01 9:21 AM, Kurt Lieber at [EMAIL PROTECTED] wrote: Hi Mike -- a related question to your post below. Specifically $HTTP_SESSION_VARS[variablename] or (depending on how php is configured) $variablename. I've run into this problem myself and it's very annoying -- any idea the setting in php.ini that controls this? Thanks. --kurt -- mike cullerton [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]