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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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. |
|
|||
|
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/ |
|
|||
|
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. |