Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-06-2005, 05:12 AM   #1
LQ Newbie
Registered: Mar 2005
Location: south-Africa
Distribution: red hat 9.0
Posts: 12

Rep: Reputation: 0
Question help with mySQL and PHP

Hi everyone

I'm trying to learn PHP.
I need help.
Or i'll lose all my hair.

I'm trying to connect to a MYSQL database from a PHP page.
Now displaying all the rows from a query in a table is easy, got it covered.
But I want to should show the first row's info and by clicking on a next or previous button I want the page to display either the next or the previous row's info.

Is it at all possible?
Any clue as to how to do it?

Old 05-06-2005, 05:39 AM   #2
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 6,230

Rep: Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714
Of course it is possible, with more than one way

I would use GET variables so that should work when user click on the web
browser back and forward buttons as well

The link could be :

The part of the script that get "From" value (put it near the top):
PHP Code:
$FROM 1// default to 1

if(isset($_GET["From"])) {
$FROM intval($_GET["From"]);
$FROM) { $FROM 1; }

Now that you have a "From" value, you could display the row you want
with a query like :
PHP Code:
$query "SELECT * FROM table LIMIT ".($FROM -1).", 1"


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql-server4.1 and mod php-mysql conflig kernelvn *BSD 0 06-18-2005 12:52 PM
Problem getting PHP to recognize MySQL, Using PHP 4.0 and MySQL 4.0.20 d2army Programming 4 06-27-2004 09:54 PM
php4 mysql, installation, php-pages with mysql info stay empty dnla Linux - Software 2 03-14-2004 03:54 PM
Installing MySQL.4.0.17 and php support for Mysql on RedHat 9.0 Neha Linux - Software 13 12-29-2003 01:06 AM
Apache Mysql Php: mysql with php doesn't work breakerfall Linux - Networking 6 12-27-2003 09:59 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:49 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration