row identifier

This is a discussion on row identifier within the PHP Language forums, part of the PHP Programming Forums category; Hello! I need advice on how to identify a row with particular field value? I have a table with 3 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-01-2003
VeSn@
 
Posts: n/a
Default row identifier

Hello!

I need advice on how to identify a row with particular field
value?

I have a table with 3 fields: id, title, date.

I need to know the order number for the row where
title=sometitle.
I need it for the $start variable in next query:

Code:
# make a query on a table in your database
// $start = ???;
$query = "SELECT * FROM table LIMIT $start,1";
$query_result_handle = mysql_query ($query)
or die ('The query failed! table_name must be a valid table
name that exists in the
database specified in mysql_select_db');

# make sure that we recieved some data from our query
$num_of_rows = mysql_num_rows ($query_result_handle)
or die ("The query: '$query' did not return any data");

print "The query: '$query' returned $num_of_rows rows of
data.<br>";

# use mysql_fetch_row to retrieve the results
$row = mysql_fetch_row ($query_result_handle);
print "The name is '$row[1]'";


What i am trying to acomplish is to get the data of the next row
of current row in which title = sometitle.
Any help/advice appreciated.

--
Vesna
http://forum.moljac.hr OBAVEZNO SKOKNITE!
__________________________________________________ _______________
Implementation is the sincerest form of flattery.
Reply With Quote
  #2 (permalink)  
Old 11-01-2003
Geoff Berrow
 
Posts: n/a
Default Re: row identifier

I noticed that Message-ID: <4p97qvshs1n6l3bguhkoj0i4cn696s9a40@4ax.com>
from VeSn@ contained the following:

>I need advice on how to identify a row with particular field
>value?
>
>I have a table with 3 fields: id, title, date.
>
>I need to know the order number for the row where
>title=sometitle.

But you don't have a field called order number

>I need it for the $start variable in next query:
>
>Code:
># make a query on a table in your database
>// $start = ???;
>$query = "SELECT * FROM table LIMIT $start,1";


I don't know what that $start is doing there.

--
Geoff Berrow
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Reply With Quote
  #3 (permalink)  
Old 11-04-2003
VeSn@
 
Posts: n/a
Default Re: row identifier

Geoff Berrow <blthecat@ckdog.co.uk> u comp.lang.php:
>>I need advice on how to identify a row with particular field
>>value?
>>
>>I have a table with 3 fields: id, title, date.
>>
>>I need to know the order number for the row where
>>title=sometitle.


>But you don't have a field called order number


i do, but what when some rows are deleted?
I solved it using id>$start in query.

>>I need it for the $start variable in next query:
>>
>>Code:
>># make a query on a table in your database
>>// $start = ???;
>>$query = "SELECT * FROM table LIMIT $start,1";

>
>I don't know what that $start is doing there.


to tell the query where to start :-)

it`s ok, I solved it.

--
Vesna
http://forum.moljac.hr OBAVEZNO SKOKNITE!
__________________________________________________ _______________
I came, I saw, I deleted all your files.
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 07:04 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0