RE: [PHP] Looking for pointers to mysql functions
| From: | Stuart Felenstein | Date: | Thu, 11 Nov 2004 12:26:56 +0000 |
| Subject: | RE: [PHP] Looking for pointers to mysql functions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-201753@lists.php.net to get a copy of this message | ||
--- Graham Cossey <graham@cossey.plus.com> wrote:
> Is this something like what you are after:
>
> <?php
> $sql = "SELECT col1, col2, col3, col4 as colx, col5
> FROM my_table
> WHERE col2 LIKE '%$search%'
> ORDER BY col3
> LIMIT $from, $max_results";
>
> $result = mysql_query($sql) or die ("Query failed: "
> . mysql_error());
> while($row = mysql_fetch_assoc($result))
> {
> ?>
> <tr>
> <td><?php echo $row['col2'] ?></td>
> <td><?php echo $row['colx'] ?></td>
> </tr>
> <?php
> }
> ?>
>
> For details on how to do the x rows per page with
> previous and next see
>
> http://www.phpfreaks.com/tutorials/43/0.php
> or
> http://www.phpfreaks.com/tutorials/73/0.php
>
> HTH
> Graham
>
Yes, I think this is it. I appreciate the link to the
rows per page thing!
Very helpful as always!
Stuart