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, Untitled Document "; echo "$subject[1]"; } else { $subject[0] = "Enter Subject A"; $subject[1] = "Enter Subject B"; } ?> 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 "" 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
[PHP] new to php, need help..
hi all, i've only begun learning php around 1 week ago, i'm having trouble with this code, Untitled Document "; echo "$subject[1]"; } else { $subject[0] = "Enter Subject A"; $subject[1] = "Enter Subject B"; } ?> 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 "" 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
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 "Camp Street Cafe"; > > Here is the script that is called. > > > $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
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 "Camp Street Cafe"; > >Here is the script that is called. > > >$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 "$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 "Camp Street Cafe"; Here is the script that is called. $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
[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 "Camp Street Cafe"; Here is the script that is called. $Location_Info"; ?> -- 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
[PHP] New to PHP, need help.
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