mysql functions
Moderator: General Moderators
mysql functions
is there a function that gives the row number where a certain item is located at??
Row number? The whole point ot a relational database is that you don't need to worry about rows and stuff, only primary keys.
Or better yet, use PEAR::DB_DatabaseObjects:
http://pear.php.net/manual/en/packages. ... object.php
Hope this helps.
Code: Select all
$result = mysql_query("SELECT id FROM mytable WHERE mydata=$blahblahblah");
$obj = mysql_fetch_object( $result );
mysql_free_result( $result );
$rownumber = $obj->id;http://pear.php.net/manual/en/packages. ... object.php
Hope this helps.
can u give the syntax to getting an item using primary keys? i was tinking like
but thats the wrong syntax for it, can some one tell me the right way of using it.Thnx
Code: Select all
$result = mysql_query("SELECT $field * FROM $table WHERE id=1");-
fractalvibes
- Forum Contributor
- Posts: 335
- Joined: Thu Sep 26, 2002 6:14 pm
- Location: Waco, Texas
The $result is just a "pointer" the real data. To fetch it you have to do a
Then the $row is an array. You can reach the data by
Hope this helps. And please, read a database tutorial, before asking.
Code: Select all
$row = mysql_fetch_row($result);Code: Select all
echo $rowї"fieldname"];
or
echo $rowї0]; // field no. 0