Hi all,
My DB has the following columns: id, name ,cat. I want to select a cat i.e.
cat=zzz when the query is finished I should see a specific record within this
cat which is defined by id, like id=yyy
Any idea how to do this? Is there a function or something like record pointer
i
If I understand what you're asking, just write a simple query.
$picked = ;
$sql = "SELECT * FROM WHERE cat = '$picked'";
$result = mssql_query($sql) or die ("My_Error_Message");
$row = mssql_fetch_assoc($result);
$id = $row['id'];
$name = $row['name'];
$cat = $row['cat'];
echo $id; // shows y
O.K. the id column is primary key and it is auto_incerment .I think my
explanation was not clear enough :
this is my query : SELECT * FROM table WHERE ID=$ID
this will find the record with the specified ID and I will be able to see it,
now I want to be able to scroll up and down to all the
Okay, in your first post you said you were selecting by category, now you're
saying you are selecting by ID and want all corresponding records that have
the same category as the selected ID.
Which way are you trying to do this??
On 7/5/07, elk dolk <[EMAIL PROTECTED]> wrote:
O.K. the id colum
I am selecting by id
Dan Shirah <[EMAIL PROTECTED]> wrote: Date: Thu, 5 Jul 2007 15:51:56 -0400
From: "Dan Shirah" <[EMAIL PROTECTED]>
To: "elk dolk" <[EMAIL PROTECTED]>
CC: [email protected]
Subject: Re: [PHP-DB] Re: record pointer
Okay, in your first post you said you were selecting by cate
Hi
> O.K. the id column is primary key and it is auto_incerment .I think my
> explanation was not clear enough :
>
> this is my query : SELECT * FROM table WHERE ID=$ID
> this will find the record with the specified ID and I will be able to see
> it, now I want to be able to scroll up and
I'm using PHP 5.1. The documentation for PDO doesn't list MS Sql server as one
of the drivers that support PDO but there is a php_pdo_mssql.dll which seems to
work so I'm using that.
I need to get the id of a new record just inserted. I can't use lastInsertId()
as I get a message saying it's
Bruce Cowin wrote:
I'm using PHP 5.1. The documentation for PDO doesn't list MS Sql server as one
of the drivers that support PDO but there is a php_pdo_mssql.dll which seems to
work so I'm using that.
I need to get the id of a new record just inserted. I can't use lastInsertId()
as I get a
Thanks for replying. According to the PDO doco: "If the database driver
supports it, you may also bind parameters for output as well as input." So
maybe this driver doesn't support it? I don't know. I'll try and get the
stored proc to return the value, but not sure how I'll capture that yet.
Bruce Cowin wrote:
Thanks for replying. According to the PDO doco: "If the database driver supports it, you may
also bind parameters for output as well as input." So maybe this driver doesn't support it?
I don't know. I'll try and get the stored proc to return the value, but not sure how I'
Hi All,
I am using subquery to fetch data from mysql and display
on html page . But client like to display data in excel and they can also save
or download it.
I have visited spreadsheet_excel_writer on pear.php.net.
and decided to use CSV file.
Please suggest me more to do how csv file can
Thank you Niel
I am very close now have a look :
mysql> select id,cat from table where cat=(select cat from table where id=49);
+-+--+
| id | cat |
+-+--+
| 40 | FLK |
| 41 | FLK |
| 42 | FLK |
| 44 | FLK |
| 45 | FLK |
| 46 | FLK |
Hi
> mysql> select id,cat from table where cat=(select cat from table where id=51);
> +-+--+
> | id | cat |
> +-+--+
> | 40 | FLK |
> | 41 | FLK |
> | 42 | FLK |
> | 44 | FLK |
> | 45 | FLK |
> | 46 | FLK |
> | 47 | FLK |
> |
If I understand that correctly, you only need to add the extra condition
to the WHERE clause of the main query. So:
SELECT id, name, cat FROM table
WHERE cat = (SELECT cat FROM table WHERE id = $ID) AND id <= $ID;
This should display all rows, before and including the row with the same
'c
elk dolk wrote:
If I understand that correctly, you only need to add the extra condition
to the WHERE clause of the main query. So:
SELECT id, name, cat FROM table
WHERE cat = (SELECT cat FROM table WHERE id = $ID) AND id <= $ID;
This should display all rows, before and including the ro
Chris <[EMAIL PROTECTED]> wrote:
Huh? You want before, after and including? So everything?
Maybe give us an example of what you want to get out of the query rather
than us guessing.
I keep the path to my photos in this DB so it is a photo Gallery , when I click
on a thumbnail I want to see t
elk dolk wrote:
Chris <[EMAIL PROTECTED]> wrote:
Huh? You want before, after and including? So everything?
Maybe give us an example of what you want to get out of the query rather
than us guessing.
I keep the path to my photos in this DB so it is a photo Gallery , when I click
on a thumbnai
17 matches
Mail list logo