[PHP] Re: ASP to PHP

2012-02-17 Thread Brian Smither
I've done a site from Classic ASP (no .net) to non-oop PHP.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: ASP to PHP language problems

2004-03-10 Thread Sam Masiello

Since I am assuming "Type" is a text field, you will want to enclose it
in single quotes.  Also, because I am anal retentive, I like to also use
the addslashes() function on any input coming in on the GET string or
via a POST.  Also, since all variables are preceded by a $ character,
your call to mysql_query will fail.

So, I would change your code to something like this:
$type = addslashes($_GET['type']);
$sql = "SELECT * FROM tbCategory WHERE Type ='$type' order by style";
$resultID = mysql_query($sql, $db);

HTH!

--Sam



Alistair Hayward wrote:
> This is what I have:
>  
>   $connection = mysql_connect("localhost","root","batman");
>   if (!$connection) {
>  echo "Couldn't make a connection!";
>  exit;
>  }
>   $db = mysql_select_db("sealhouse", $connection);
>   if (!$db) {
>  echo "Couldn't select database!";
>  exit;
>  }
>   $type = $_GET['type'];
>   $sql = "SELECT * FROM tbCategory WHERE Type =$type order by
style";
>   $resultID = mysql_query($sql, DB);
> 
>> 
> 
> 
> Chris W. Parker wrote:
> 
>> Alistair Hayward 
>> on Wednesday, March 10, 2004 2:46 PM said:
>> 
>> 
>>> This is what I get when I try to create the recordset
>>> 
>>> Notice: Use of undefined constant DBlink - assumed 'DBlink' in
>>> D:\Development\Completed\Sealhouse\phpSealTest\ProductSpecs.php on
>>> line 24
>> 
>> 
>> well you're going to need to do a *little* research on your own.
>> 
>> oh what the heck...
>> 
>> DBlink is the same as your cnn in your asp code. in other words you
>> still need to create a connection to a database.
>> 
>> 
>> 
>> chris.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: ASP to PHP language problems

2004-03-10 Thread Sam Masiello

Not trying to sound rude or anything, but have you looked up the mysql
functions at http://php.net/mysql in your research?  

I would start with mysql_connect(), mysql_query(), and
mysql_fetch_array()/mysql_result().

There are lots of user notes on each page as well which should be of
assistance.

HTH!

--Sam


Alistair Hayward wrote:
> Thanks Chris,
> 
> Believe me, I have been doing research non-stop for a few days now and
> this is my last resort.
> The problem is the language. I can't find what I'm looking for on the
> net because I don't know what it's called.
> 
> I have worked out how to create a connection to a mySQL server and
> database. (after spending so much time configuring and installing PHP
> and mySQL for the first time)
> I now know how to use include files.
> I can not figure out how to create a recordset and call fields from
> the record set while performing a loop.
> 
> I have done heaps of research, but have not found what I need.
> 
> Chris W. Parker wrote:
> 
>> Alistair Hayward 
>> on Wednesday, March 10, 2004 2:46 PM said:
>> 
>> 
>>> This is what I get when I try to create the recordset
>>> 
>>> Notice: Use of undefined constant DBlink - assumed 'DBlink' in
>>> D:\Development\Completed\Sealhouse\phpSealTest\ProductSpecs.php on
>>> line 24
>> 
>> 
>> well you're going to need to do a *little* research on your own.
>> 
>> oh what the heck...
>> 
>> DBlink is the same as your cnn in your asp code. in other words you
>> still need to create a connection to a database.
>> 
>> 
>> 
>> chris.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: ASP to PHP language problems

2004-03-10 Thread Alistair Hayward
This is what I have:

$connection = mysql_connect("localhost","root","batman");
if (!$connection) {
echo "Couldn't make a connection!";
exit;
}
$db = mysql_select_db("sealhouse", $connection);
if (!$db) {
echo "Couldn't select database!";
exit;
}
$type = $_GET['type'];
$sql = "SELECT * FROM tbCategory WHERE Type =$type order by style";
$resultID = mysql_query($sql, DB);

?>
Chris W. Parker wrote:

Alistair Hayward 
on Wednesday, March 10, 2004 2:46 PM said:

This is what I get when I try to create the recordset

Notice: Use of undefined constant DBlink - assumed 'DBlink' in
D:\Development\Completed\Sealhouse\phpSealTest\ProductSpecs.php on
line 24


well you're going to need to do a *little* research on your own.

oh what the heck...

DBlink is the same as your cnn in your asp code. in other words you
still need to create a connection to a database.


chris.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: ASP to PHP language problems

2004-03-10 Thread Alistair Hayward
Thanks Chris,

Believe me, I have been doing research non-stop for a few days now and 
this is my last resort.
The problem is the language. I can't find what I'm looking for on the 
net because I don't know what it's called.

I have worked out how to create a connection to a mySQL server and 
database. (after spending so much time configuring and installing PHP 
and mySQL for the first time)
I now know how to use include files.
I can not figure out how to create a recordset and call fields from the 
record set while performing a loop.

I have done heaps of research, but have not found what I need.

Chris W. Parker wrote:

Alistair Hayward 
on Wednesday, March 10, 2004 2:46 PM said:

This is what I get when I try to create the recordset

Notice: Use of undefined constant DBlink - assumed 'DBlink' in
D:\Development\Completed\Sealhouse\phpSealTest\ProductSpecs.php on
line 24


well you're going to need to do a *little* research on your own.

oh what the heck...

DBlink is the same as your cnn in your asp code. in other words you
still need to create a connection to a database.


chris.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Re: ASP to PHP language problems

2004-03-10 Thread Chris W. Parker
Alistair Hayward 
on Wednesday, March 10, 2004 2:46 PM said:

> This is what I get when I try to create the recordset
> 
> Notice: Use of undefined constant DBlink - assumed 'DBlink' in
> D:\Development\Completed\Sealhouse\phpSealTest\ProductSpecs.php on
> line 24

well you're going to need to do a *little* research on your own.

oh what the heck...

DBlink is the same as your cnn in your asp code. in other words you
still need to create a connection to a database.



chris.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: ASP to PHP language problems

2004-03-10 Thread Alistair Hayward
This is what I get when I try to create the recordset

Notice: Use of undefined constant DBlink - assumed 'DBlink' in 
D:\Development\Completed\Sealhouse\phpSealTest\ProductSpecs.php on line 24

Warning: mysql_query(): supplied argument is not a valid MySQL-Link 
resource in 
D:\Development\Completed\Sealhouse\phpSealTest\ProductSpecs.php on line 24

Ligaya Turmelle wrote:

I don't know ASP but I think this is what you want:

$sql = "SELECT * FROM table WHERE Type = \"& type & \"  order by style;";

$resultID = mysql_query($sql, DBlink);  // send the query and returns a
pointer to the results
while ($row = mysql_fetch_assoc($resultID))   // while there are results
give them to me as an associative array
   //
results could also be returned as an array, object, or row
   //
see mysql_fetch_array, mysql_fetch_object, and mysql_fetch_row respectively
{
   Here is a loop
}
"Alistair Hayward" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi ,

What is the equavilant in PHP to creating a recordset in ASP using a
query?

This is what I do in PHP:
..
dim Type
Type = CStr(Request.QueryString("action")) (getting parameter from URL)
Dim cnn  ' ADO connection
Dim rst  ' ADO recordset
Dim strDBPath  ' path to my Access database (*.mdb) file
strDBPath = Server.MapPath("/_database/database.mdb")
Set cnn = Server.CreateObject("ADODB.Connection")
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"
Set rst = cnn.Execute("SELECT * FROM table WHERE Type ='" & type & "'
order by style")
..
I can then call any field and display it in the html by using :
<%=rst.fields("whatever").value%>
..
I can also create a loop:
<%Do While Not rstSimple.EOF%>
do something
<%
rstSimple.MoveNext
Loop
%>

Please can someone show me how to do the same thing in PHP?

Alistair
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: ASP to PHP language problems

2004-03-10 Thread Ligaya Turmelle
I don't know ASP but I think this is what you want:

$sql = "SELECT * FROM table WHERE Type = \"& type & \"  order by style;";

$resultID = mysql_query($sql, DBlink);  // send the query and returns a
pointer to the results
while ($row = mysql_fetch_assoc($resultID))   // while there are results
give them to me as an associative array
   //
results could also be returned as an array, object, or row
   //
see mysql_fetch_array, mysql_fetch_object, and mysql_fetch_row respectively
{
   Here is a loop
}

"Alistair Hayward" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi ,
>
> What is the equavilant in PHP to creating a recordset in ASP using a
query?
> This is what I do in PHP:
> ..
>
> dim Type
> Type = CStr(Request.QueryString("action")) (getting parameter from URL)
>
> Dim cnn  ' ADO connection
> Dim rst  ' ADO recordset
> Dim strDBPath  ' path to my Access database (*.mdb) file
>
> strDBPath = Server.MapPath("/_database/database.mdb")
> Set cnn = Server.CreateObject("ADODB.Connection")
> cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"
>
> Set rst = cnn.Execute("SELECT * FROM table WHERE Type ='" & type & "'
> order by style")
> ..
> I can then call any field and display it in the html by using :
> <%=rst.fields("whatever").value%>
> ..
> I can also create a loop:
> <%Do While Not rstSimple.EOF%>
> do something
> <%
> rstSimple.MoveNext
> Loop
> %>
> 
>
> Please can someone show me how to do the same thing in PHP?
>
> Alistair

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: ASP to PHP ...

2001-12-04 Thread lallous

Never done that...
perhaps this link could help:

http://asp2php.naken.cc/

"John Meadows" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have been asked to convert an ASP/MS Access system to PHP. I would be
> interested in hearing the thoughts of anyone with exp. of  this. Thanks.
>
>



-- 
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]