Help: How to have script for Next Button

General discussions related to php

Moderators: macek, egami, gesf

prinzz
New php-forum User
New php-forum User
Posts: 2
Joined: Tue Apr 09, 2013 5:59 pm

Help: How to have script for Next Button

Postby prinzz » Tue Apr 09, 2013 10:35 pm

Hi I Am Newbie,

I created Mysql Database Conenction with simple fetch data

Code: Select all

<?php
$username = "root";
$password = "test";
$hostname = "localhost";

//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
  or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";

//select database to work with
$selected = mysql_select_db("db_dwebsticker",$dbhandle)
  or die("Could not select database name");

//execute the SQL query and return records
$result = mysql_query("SELECT d_id, d_prtno, d_inch FROM d_tblsticker");
//fetch the data from the database
while ($row = mysql_fetch_array($result)) {
   echo "ID:".$row{'d_id'}."<br>";
   echo "Part Number:".$row{'d_prtno'}."<br>";
   echo "Size by Inches:".$row{'d_inch'}."<br>";
 
}

?>



Output
    Connected to MySQL
    ID:1
    Part Number:01
    Size by Inches:12"
    ID:2
    Part Number:02
    Size by Inches:4"


is there someone who can able to guide or give some script that can able to next to the ID 2
instead of showing in one page just like ID 1 and ID 2


please help

Thanks

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: Help: How to have script for Next Button

Postby seandisanti » Tue Apr 09, 2013 11:19 pm

1) mysql_ functions are deprecated and will be going away. PDO is faster and more secure. learn here: http://jream.com/learning/videos/php-oo ... o-examples

2) if you're going to be jumping page to page, you either need to persist your results from page to page (best done with a session), or you're going to be querying on each page, and displaying one each so passing the next and previous with a GET variable would be the best way to go with that approach.

3) Jream has a couple of good videos on communicating between pages.
http://jream.com/learning/videos/php-ba ... et-request
http://jream.com/learning/videos/php-ba ... e-security

prinzz
New php-forum User
New php-forum User
Posts: 2
Joined: Tue Apr 09, 2013 5:59 pm

Re: Help: How to have script for Next Button

Postby prinzz » Tue Apr 09, 2013 11:38 pm

Hi seandisanti

I will watch it first.
I will make new post topic.


Thanks and best regards


Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 2 guests

cron