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