Page 1 of 1
Please help me or I'll be fired for sure!!!
Posted: Tue Nov 16, 2004 8:03 am
by Phoenixheart
Gosh! I only coded ASP with MSSQL before, but now my new project is on a Linux server, so I have to switch to PHP and MySQL. MySQL is similar to MSSQL so I have no problems with it, but I'm busted with PHP. For now, I have a (I know) very simple problem that I cannot solve. You know, in ASP with VBScript we can retreive a value from the URL "
http://somehost.com/somefile.asp?str_sent=blahblah" by using Request.QueryString("str_sent")
But how can I do the same in PHP? I know this is a silly post, but help me please, I'm a total newbie

Posted: Tue Nov 16, 2004 8:34 am
by jl
Posted: Tue Nov 16, 2004 8:35 am
by phpScott
Code: Select all
<?php
$someString=$_REQUEST['nameOfString'];
//or $_POST['nameOfString'];
//of $_GET['nameOfString'];
?>
depending on what how your form method is used to submit the page.
$_REQUEST is neutral so easier to use but not as secure.
Posted: Wed Nov 17, 2004 3:46 am
by Phoenixheart
Thank you very much.
And by the way, could you show me how to display records from a result set by and by? In ASP, we have a moveNext() function, but I couldn't find any similiar one in PHP. Do we have to use 2 nested "FOR" loop? (Using num of columns and num of rows) or there's another way?
Posted: Wed Nov 17, 2004 3:51 am
by patrikG
PHOENIXHEART wrote:Thank you very much.
And by the way, could you show me how to display records from a result set by and by? In ASP, we have a moveNext() function, but I couldn't find any similiar one in PHP. Do we have to use 2 nested "FOR" loop? (Using num of columns and num of rows) or there's another way?
That's what the manual is there for. Read it. I suggest you start
here or google for mysql tutorials. There are plenty on zend.com
Posted: Wed Nov 17, 2004 4:04 am
by roobottom
you can use the mysql_fetch_array function in a while loop, like this...
Code: Select all
<?php
while($result = mysql_fetch_array($yourRecordset)) {
echo $result['column name'];
}
?>
But you really should read the manual. Or even better yet, het PHP 5 and MySQL bible, by Tim Converse and Joyce Park ISBN: 0-7645-5746-7 it'll answer all your questions...
Posted: Wed Nov 17, 2004 4:18 am
by ibizconsultants
Hi PHOENIXHEART,
to get it done in PHP you should use the following syntax:
<?
$mystring = $_GET['str_sent'];
echo $mystring;
?>
To access post variables in ASP you use Request.Forms("variablename"), but in PHP you need to use $_POST['variablename'];
Let me know if you have anything else that you find difficult in PHP or MySQL.
iBizConsultants
http://www.ibizconsultants.com
Posted: Wed Nov 17, 2004 4:43 am
by timvw
Posted: Wed Nov 17, 2004 1:06 pm
by Steveo31
Why did you take it/be assigned to it if you don't know anything about it? Just seems like an avoidable conundrum.
Posted: Thu Nov 18, 2004 5:49 am
by Phoenixheart
<H0>Thank you all!<H0>
And to Steveo:
Why did you take it/be assigned to it if you don't know anything about it? Just seems like an avoidable conundrum.
I'm not good in English but it seems like you're advising me to resign? Nah, I don't want to do that. Though for now I'm nothing but an extreme idiot in this brand-new PHP, but I won't let it beat me. Thanks for your advice.
To everyone! I've just install PHP4 on my WinXP following all the installation guides in the PHP manual, and configured the IIS too. But (yeah the worst word on the world "but" *_*) when I browsed the simpliest "helloworld.php" from the IIS, a HTTP 400 "The page cannot be found" appeared. In the manual there's only a HTTP 500 error solving guide. Anyone have this experience like me please help me out, or give me a link to solve it. Thank you!
Posted: Thu Nov 18, 2004 6:55 am
by CoderGoblin
Break the problem down more and tell us what steps you have taken to solve it yourself... People on this board generally try to help in spare time and will give priority to those people who show they are prepared to put some effort into solving problems themselves.
As to your error...
Can you view any web pages on your localhost. Any HTML file (.html with no PHP code) will do
If the file gets shown correctly then create a file phpinfo.php as follows
and see if that loads under localhost.... If not your php/IIS configuration is wrong.
I don't know IIS (prefering Apache) so cannot help you on that, but if that displays a page then your page code is wrong and you should post the code here.
Posted: Thu Nov 18, 2004 7:41 am
by hairyjim
The chances are that it is a permissions problem
Check you have specified iusr_*your machine name* with read & execute permissions to the php folder.
Posted: Fri Nov 19, 2004 8:08 pm
by Phoenixheart
Thanks everyone. Now my php can execute. But as I am a new bie, new problems keep coming for more. When i set up a mysql_connect('localhost','myusrnm','mypass') at line 11 in my php file and run it, I always got an error like this:
Connecting... // This is my echo()
Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in F:\Saigonartframe Website\php_test.php on line 11
Could not connect: Client does not support authentication protocol requested by server; consider upgrading MySQL client
I did almost evreything possible (check mySQL connect, my database, start the service...) but no use. So please tell me what is it now?
Posted: Sat Nov 20, 2004 1:34 am
by Steveo31
PHOENIXHEART wrote:<H0>Thank you all!<H0>
And to Steveo:
Why did you take it/be assigned to it if you don't know anything about it? Just seems like an avoidable conundrum.
I'm not good in English but it seems like you're advising me to resign? Nah, I don't want to do that. Though for now I'm nothing but an extreme idiot in this brand-new PHP, but I won't let it beat me.
Not at all... I'm not telling you to resign, I'm just asking why you would take this on if you didn't know much about the language... that's all. Very brave of you
