This topic is locked

PRIOR NEXT feature

1/20/2006 3:10:08 PM
PHPRunner General questions
D
Dale author

I am a one click developer. (well I try anyway). Any information should be no further than one click away.

When I have a list in front of me and I select an item to edit or view, which nicely takes me to the record.

I would like to be able to have a next and prior button on the form to navigate to the next item or prior item in that list with one click so I do not have to return to the list. Returning to the list to select the next record is just annoying if you want to work through a list.
Has anybody done this, is this possible currently. This is really quite an important feature.

Any help would be very much appreciated.

Sergey Kornilov admin 1/23/2006

Dale,
unfortunatelly there is no easy way to do that.
We'll add this fetaure in one of the next PHPRunner versions.

O
osluk 10/28/2007

Any progress on this.
I would like to be able to browse through records in the View format as well as the option of returning to the list.
http://www.bordeauxreport.com/db-2007/03/W...w.php?editid1=1
Would be cool to have next and prior or all records or selected records in the current search.
Cheers Chris
PHPrunner is better than ever

Sergey Kornilov admin 10/28/2007

This can be done via "Insert PHP code snippet" function in Visual Editor.
Write the code that gets IDs of both Next and Previous records and dispaly corrsponding links.

O
osluk 10/28/2007

Cool - are there are examples of this.
Cheers Chris

This can be done via "Insert PHP code snippet" function in Visual Editor.

Write the code that gets IDs of both Next and Previous records and dispaly corrsponding links.

J
Jane 10/30/2007

Hi,
here is a sample code for event with Next link:

global $conn,$strTableName;

$links = "";

$current = $_REQUEST["editid1"];

$next=0;

$strSelect = "select * from ".$strTableName;

$rs = db_query($strSelect,$conn);

while ($data = db_fetch_array($rs))

{

if ($next)

{

$links = "<a href=\"TableName_edit.php?editid1=".$data["IDField"]."\">next</a>";

$next = 0;

}

if ($current==$datag["IDField"])

$next = $current+1;
}

echo $links;

hax0r 10/31/2007

Hi,

here is a sample code for event with Next link:


Here is what I found worked for me... I added it to the events page. "EditPage: OnLoad event". "Display a message on the Web Page"

Bold Italics = needs to be replaced with information related to your project

Red = changes I made from the above comment

(Note - this only give a next link... you can design similar code for a previous link)
global $conn,$strTableName;

$links = "";

$current = $_REQUEST["editid1"];

$next=0;

$strSelect = "select * from ".$strTableName;

$rs = db_query($strSelect,$conn);

while ($data = db_fetch_array($rs))

{

if ($next) {

$links = "<a href=\"TableName_edit.php?editid1=".$data["IDField"]."\">next</a>";

$next = 0;

}

if ($current==$data["IDField"])

$next = $current+1;

}

echo $links;

O
osluk 10/31/2007

Thanks for that i will report back on my progress.

Cheers Chris



Here is what I found worked for me... I added it to the events page. "EditPage: OnLoad event". "Display a message on the Web Page"

Bold Italics = needs to be replaced with information related to your project

Red = changes I made from the above comment

(Note - this only give a next link... you can design similar code for a previous link)
global $conn,$strTableName;

$links = "";

$current = $_REQUEST["editid1"];

$next=0;

$strSelect = "select * from ".$strTableName;

$rs = db_query($strSelect,$conn);

while ($data = db_fetch_array($rs))

{

if ($next) {

$links = "<a href=\"TableName_edit.php?editid1=".$data["IDField"]."\">next</a>";

$next = 0;

}

if ($current==$data["IDField"])

$next = $current+1;

}

echo $links;

J
jomppa10 11/1/2007

Hi,
I have hundreds of check lists in my project and this prev<-->next feature is very handy. I have implemented the a.m. event for a next link but .
( by setting [color=#FF0000]$current = $_REQUEST["editid1"] - 2 I was able to browse some prior records)
best regards
Jouni I

hax0r 11/1/2007

Hi,

I have hundreds of check lists in my project and this prev<-->next feature is very handy. I have implemented the a.m. event for a next link but .
( by setting [color=#FF0000]$current = $_REQUEST["editid1"] - 2 I was able to browse some prior records)
best regards
Jouni I


The following changes, which I've highlighted in red, will allow you to have a prev and next link.

Once again, replace anything in bold italics with information related to your project. Add the code to the OnLoad event of the correct page, using the "Display a message on the web page" option.
Finally, note this code works on the edit page. To add it to the view page, change TableName_edit to TableName_view. Oh, and of course the "prev" link will not show up if it's the first record... so to check if they both work, please use a record that is in the middle of your table.
global $conn,$strTableName;

$links = "";
$current = $_REQUEST["editid1"];

$next=0;

$strSelect = "select * from ".$strTableName;

$rs = db_query($strSelect,$conn);

while ($data = db_fetch_array($rs))

{

if ($next) {

$links [color=#FF0000].= " <a href=\"TableName_edit.php?editid1=".$data["IDField"]."\">next</a>";

$next = 0;

}
if ($current==$data["IDField"])

$next = $current+1;

[color=#FF0000]$links = $prevLink;

}

else {

$prevLink = "<a href=\"TableName_edit.php?editid1=".$data["IDField"]."\">prev</a>";

}

}

echo $links;

J
jomppa10 11/1/2007

Thanks a million Hax0r,
the code snippet works just great and makes things much easier for me and my clients.
best regards from Finland
Jouni I

O
osluk 11/2/2007

Cool I have added the code as follows

screen grab below code below that
OnLoad event

using the "Display a message on the web page"

For page: http://www.bordeauxreport.com/db-2007/view...w.php?editid1=1


global $conn,$strTableName;

$links = "";

$prevLink = "";

$current = $_REQUEST["editid1"];

$next=0;

$strSelect = "select * from ".$strTableName;

$rs = db_query($strSelect,$conn);

while ($data = db_fetch_array($rs))

{

if ($next) {

$links .= " <a href=\"Wine_Data_edit.php?editid1=".$data["Ref"]."\">next</a>";

$next = 0;

}
if ($current==$data["id"]) {

$next = $current+1;

$links = $prevLink;

}

else {

$prevLink = "<a href=\"Wine_Data_edit.php?editid1=".$data["Ref"]."\">prev</a>";

}

}

echo $links;


I dont get an error mesage but no sign of the links either.

Do I neeed to create the button and link them in some way?
Cheers Chris

J
jomppa10 11/2/2007

Cool I have added the code as follows

screen grab below code below that
OnLoad event

using the "Display a message on the web page"

For page: http://www.bordeauxreport.com/db-2007/view...w.php?editid1=1

global $conn,$strTableName;

$links = "";

$prevLink = "";

$current = $_REQUEST["editid1"];

$next=0;

$strSelect = "select * from ".$strTableName;

$rs = db_query($strSelect,$conn);

while ($data = db_fetch_array($rs))

{

if ($next) {

$links .= " <a href=\"Wine_Data_edit.php?editid1=".$data["Ref"]."\">next</a>";

$next = 0;

}
if ($current==$data["id"]) {

$next = $current+1;

$links = $prevLink;

}

else {

$prevLink = "<a href=\"Wine_Data_edit.php?editid1=".$data["Ref"]."\">prev</a>";

}

}

echo $links;


I dont get an error mesage but no sign of the links either.

Do I neeed to create the button and link them in some way?
Cheers Chris


Hi,
try this
if ($current==$data["Ref"]) {
regards
Jouni I

hax0r 11/2/2007

Thanks Jouni. I forgot to bold italics that one.
Also, Chris... since you want the links on the view page, you should change "Wine_Data_edit.php" to "Wine_Data_view.php"

O
osluk 11/2/2007

I changed then forgot the edit view page thing

I didnt know to change the id!
So here it is again - I must be close now! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=22925&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' />


Can anyone post a screen grab or this working?
Cheers Chris

J
jomppa10 11/2/2007

I changed then forgot the edit view page thing

I didnt know to change the id!
So here it is again - I must be close now! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=22933&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' />

Can anyone post a screen grab or this working?
Cheers Chris


Here is a code with navigation buttons (note del is a field in a table that checks deleted records ):
[codebox]global $conn,$strTableName;

$links = "";

$prevLink = "";

$current = $_REQUEST["editid1"];

$next=0;

$strSelect = "select * from ".$strTableName." where del='0'";

$rs = db_query($strSelect,$conn);

while ($data = db_fetch_array($rs))

{

if ($next) {

$links .= " <a href=\"riski_edit.php?editid1=".$data["id_riski"]."\"><img border=0 src='images/nav_right.png'></a>";//

$next = 0;

}
if ($current==$data["id_riski"]) {

$next = $current+1;

$links = $prevLink;

}

else {

$prevLink = "<a href=\"riski_edit.php?editid1=".$data["id_riski"]."\"><img border=0 src='images/nav_left.png'></a>";

}

}

echo "<table width=40% ><tr><td style= 'border-color: #f1f1f1;' align=center>".$links."</td></tr></table>";//table aligns navigation buttons[/codebox]
Works well for me.
regards
Jouni I

O
osluk 11/5/2007

Jouni,
What is displaying the message in your target page?
Can you post that part of the page - is it the $message?
I think i must have altered the template and removed whatever is used to display the data.
Thanks for your help
Cheers Chris

J
jomppa10 11/5/2007

Jouni,

What is displaying the message in your target page?
Can you post that part of the page - is it the $message?
I think i must have altered the template and removed whatever is used to display the data.
Thanks for your help
Cheers Chris


Hi Chris
Your code seems to be ok but can you post the code in text format so I can copy and test it in my project.
regards Jouni I

O
osluk 11/7/2007

My code

global $conn,$strTableName;

$links = "";

$prevLink = "";

$current = $_REQUEST["editid1"];

$next=0;

$strSelect = "select * from ".$strTableName;

$rs = db_query($strSelect,$conn);

while ($data = db_fetch_array($rs))

{

if ($next) {

$links .= " <a href=\"Wine_Data_view.php?editid1=".$data["Ref"]."\">next</a>";

$next = 0;

}
if ($current==$data["Ref"]) {

$next = $current+1;

$links = $prevLink;

}

else {

$prevLink = "<a href=\"Wine_Data_view.php?editid1=".$data["Ref"]."\">prev</a>";

}

}

echo $links;


Page to display it in!

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD><TITLE>Wine Data</TITLE>

<META http-equiv=Content-Type content="text/html; charset=windows-1252"><LINK

href="include/style.css" type=text/css rel=stylesheet>

<META content="MSHTML 6.00.6000.16544" name=GENERATOR></HEAD>

<BODY bottomMargin=0 leftMargin=0 topMargin=0

rightMargin=0>

<TABLE height="100%" width="100%" border=0>

<TBODY>

<TR>

<TD>

<P align=center>{include_if_exists file="include/header.php"}&nbsp; <A

href="http://bordeauxreport.com/db-2007/frame/"; target=_top>Back

to&nbsp;Index</A>{$message}</P></TD>

<TR>

<TD>

<DIV align=center>

<TABLE class=main_table id=table4 style="WIDTH: 90%" height=0

cellPadding=2 rules=none border=1>

<TBODY>

<TR>

<TD align=middle bgColor=#e8e8e8 height=35>Wine Data, View record [

Ref: {$show_key1}] </TD>

<TR>

<TD align=middle height=0>

<DIV align=center>

<TABLE id=table5 width="97%" border=0>

<TBODY>

<TR>

<TD width=9 height=32></TD>

<TD align=right height=32>

<P align=center><STRONG><FONT face=Arial size=3>{$show_Chateau___Wine__Alpha_format_}&nbsp;{$show_Vintage}</FONT></P></STRONG></TD>

<TD width=10 height=32>&nbsp;</TD>

<TR>

<TD width=9 height=37>&nbsp;</TD>

<TD align=right>

<TABLE id=table13 cellSpacing=0 cellPadding=0 width="100%"

border=0>

<TBODY>

<TR>

<TD>

<DIV align=center>

<TABLE id=table14 width="100%" border=0>

<TBODY>

<TR>

<TD align=right width=168><B><FONT face=Arial

size=2>Current Price<BR><FONT size=1>(Nov

2007)</FONT> </FONT></B></TD>

<TD width=6>&nbsp;</TD>

<TD width=211><FONT face=Arial size=2>{$show_Price_Oct_2007GBP}</FONT></TD>

<TR>

<TD align=right width=168><B><FONT face=Arial

size=2>Price Change</FONT></B></TD>

<TD width=6>&nbsp;</TD>

<TD width=211><FONT face=Arial size=2>{$show_07_change_release}</FONT></TD>

<TR>

<TD align=right width=168><B><FONT face=Arial

size=2>Chateau </FONT></B></TD>

<TD width=6>&nbsp;</TD>

<TD width=211><FONT face=Arial size=2>{$show_Chateau__Alpha_format_}</FONT></TD>

<TR>

<TD align=right width=168><B><FONT face=Arial

size=2>Appellation</FONT></B></TD>

<TD width=6>&nbsp;</TD>

<TD width=211><FONT face=Arial size=2>{$show_Appellation}&nbsp;

</FONT></TD>

<TR>

<TD align=right width=168 height=23><B><FONT

face=Arial size=2>In bottle maturity</FONT></B></TD>

<TD width=6 height=23>&nbsp;</TD>

<TD width=211 height=23><FONT face=Arial

size=2>{$show_In_bottle_maturity_1}</FONT></TD>

<TR>

<TD align=right width=168><B><FONT face=Arial

size=2>Tasted at&nbsp; </FONT></B></TD>

<TD width=6>&nbsp;</TD>

<TD width=211><FONT face=Arial size=2>{$show_In_bottle_tasting_location}&nbsp;

</FONT></TD></TR></TBODY></TABLE></DIV></TD>

<TD>&nbsp;</TD>

<TD>

<DIV align=center>

<TABLE id=table15 width="100%" border=0>

<TBODY>

<TR>

<TD align=right width=158>

<P><B><FONT face=Arial size=2>Release

Price<BR><FONT size=1>(Apr

2006)</FONT></FONT></B></P></TD>

<TD width=5>&nbsp;</TD>

<TD width=233><FONT face=Arial size=2>{$show_Release_Price_in_2006_GBP}</FONT></TD>

<TR>

<TD align=right width=158><B><FONT face=Arial

size=2>% Change</FONT></B></TD>

<TD width=5>&nbsp;</TD>

<TD width=233><FONT face=Arial size=2>{$show_07_change_percent}</FONT></TD>

<TR>

<TD align=right width=158><B><FONT face=Arial

size=2>First Second Wine</FONT></B></TD>

<TD width=5>&nbsp;</TD>

<TD width=233><FONT face=Arial size=2>{$show_First_Second_Third_Wines}</FONT></TD>

<TR>

<TD align=right width=158>&nbsp;</TD>

<TD width=5>&nbsp;</TD>

<TD width=233>&nbsp;</TD>

<TR>

<TD align=right width=158><B><FONT face=Arial

size=2>Number of cases</FONT></B></TD>

<TD width=5>&nbsp;</TD>

<TD width=233><FONT face=Arial size=2>{$show_Number_of_cases}</FONT></TD>

<TR>

<TD align=right width=158><FONT face=Arial

size=2><STRONG>Date&nbsp;tasted</STRONG></FONT></TD>

<TD width=5>&nbsp;</TD>

<TD width=233><FONT face=Arial size=2>{$show_In_bottle_tasting_date}</FONT></TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE>

<P align=center></P>

<HR width="85%" color=#c0c0c0 SIZE=1>

</TD>

<TD width=10 height=37>&nbsp;</TD>{if $show_In_Bottle_Note_BR}

<TR>

<TD width=9>&nbsp;</TD>

<TD align=right width=168>

<P align=left><STRONG><FONT face=Arial size=2>Tasting

Notes:</FONT></STRONG>&nbsp;</P></TD>

<TD width=10>&nbsp;</TD>

<TR>

<TD width=9>&nbsp;</TD>

<TD align=right>

<P align=left><FONT face=Arial size=2>{$show_In_Bottle_Note_BR}</FONT></P></TD>

<TD width=10></TD>{/if}</TR></TBODY></TABLE></DIV></TD>

<TR>

<TD align=middle height=78>

<DIV align=center>

<TABLE cellSpacing=0 cellPadding=0 border=0>

<TBODY>

<TR>

<TD>

<DIV align=center>

<DIV align=right>

<TABLE id=table10 borderColor=#c0c0c0 height=76 cellSpacing=0

cellPadding=0 rules=all width=0 border=1>

<TBODY>

<TR>

<TD align=middle bgColor=#e0e0e0 rowSpan=2>

<P align=center><B><FONT face=Arial size=2>&nbsp;GQ in

Bottle Score&nbsp;</FONT></B></P></TD>

<TD align=middle bgColor=#e0e0e0 colSpan=3><B><FONT

face=Arial size=2>&nbsp;Gavin Quinney choices for&nbsp;

</FONT></B></TD>

<TR>

<TD align=middle bgColor=#e0e0e0>

<P align=center><B><FONT face=Arial

size=2>&nbsp;Investors&nbsp;</FONT></B></P></TD>

<TD align=middle bgColor=#e0e0e0>

<P align=center><B><FONT face=Arial

size=2>&nbsp;Insiders&nbsp;</FONT></B></P></TD>

<TD align=middle bgColor=#e0e0e0>

<P align=center><B><FONT face=Arial

size=2>&nbsp;Imbibers&nbsp;</FONT></B></P></TD>

<TR height=24>

<TD align=middle height=33>

<P align=center><B><FONT face=Arial size=2>{$show_In_bottle_score_1}</FONT></B></P></TD>

<TD align=middle height=33>

<P align=center><B><FONT face=Arial size=2>{$show_Collectable}</FONT></B></P></TD>

<TD align=middle height=33>

<P align=center><B><FONT face=Arial size=2>{$show_Smart_buy}</FONT></B></P></TD>

<TD align=middle height=33>

<P align=center><B><FONT face=Arial size=2>{$show_Great_value}</FONT></B></P></TD></TR></TBODY></TABLE></DIV></DIV></TD>

<TD width=40>&nbsp;</TD>

<TD>

<DIV align=left>

<TABLE borderColor=#c0c0c0 height=0 cellSpacing=0 rules=all

border=1>

<TBODY>

<TR>

<TD align=middle bgColor=#e0e0e0 colSpan=3

height=27><I><B><FONT face=Arial size=2>En Primeur

Scores Apr 2006</FONT></B></I></TD>

<TR>

<TD align=middle width=77 bgColor=#e0e0e0 height=22>

<P align=center><B><FONT face=Arial

size=2>&nbsp;GQ</FONT></B></P></TD>

<TD align=middle width=75 bgColor=#e0e0e0 height=22>

<P align=center><B><FONT face=Arial

size=2>&nbsp;RP</FONT></B></P></TD>

<TD align=middle width=85 bgColor=#e0e0e0 height=22>

<P align=center><B><FONT face=Arial

size=2>&nbsp;JR</FONT></B></P></TD>

<TR height=24>

<TD align=middle width=77 height=22>

<P align=center><B><FONT face=Arial size=2>{$show_GQ}</FONT></B></P></TD>

<TD align=middle width=75 height=22>

<P align=center><B><FONT face=Arial size=2>{$show_RP}</FONT></B></P></TD>

<TD align=middle width=85 height=22>

<P align=center><B><FONT face=Arial size=2>{$show_JR}</FONT></B></P></TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE></DIV></TD>

<TR height=00>

<TD align=middle height=5>

<P align=center><IMG height=3 src="3x10.gif" width=10

border=0></P></TD>

<TR height=00>{$show_Links}&nbsp;

<TD align=middle bgColor=#e8e8e8

height=32>{$message}&nbsp;&nbsp;<SPAN class=buttonborder><INPUT class=button onclick="window.location.href='Wine_Data_list.php?a=return'" type=reset value="Back to list"></SPAN></TD></TR></TBODY></TABLE></DIV></TD>

<TR>

<TD>

<P align=center>{include_if_exists file="include/footer.php"}</P></TD></TR></TBODY></TABLE></BODY></HTML>


Cheers Chris

J
jomppa10 11/7/2007

My code

global $conn,$strTableName;

$links = "";

$prevLink = "";

$current = $_REQUEST["editid1"];

$next=0;

$strSelect = "select * from ".$strTableName;

$rs = db_query($strSelect,$conn);

while ($data = db_fetch_array($rs))

{

if ($next) {

$links .= " <a href=\"Wine_Data_view.php?editid1=".$data["Ref"]."\">next</a>";

$next = 0;

}
if ($current==$data["Ref"]) {

$next = $current+1;

$links = $prevLink;

}

else {

$prevLink = "<a href=\"Wine_Data_view.php?editid1=".$data["Ref"]."\">prev</a>";

}

}

echo $links;


Page to display it in!

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD><TITLE>Wine Data</TITLE>

<META http-equiv=Content-Type content="text/html; charset=windows-1252"><LINK

href="include/style.css" type=text/css rel=stylesheet>

<META content="MSHTML 6.00.6000.16544" name=GENERATOR></HEAD>

<BODY bottomMargin=0 leftMargin=0 topMargin=0

rightMargin=0>

<TABLE height="100%" width="100%" border=0>

<TBODY>

<TR>

<TD>

<P align=center>{include_if_exists file="include/header.php"}&nbsp; <A

href="http://bordeauxreport.com/db-2007/frame/"; target=_top>Back

to&nbsp;Index</A>{$message}</P></TD>

<TR>

<TD>

<DIV align=center>

<TABLE class=main_table id=table4 style="WIDTH: 90%" height=0

cellPadding=2 rules=none border=1>

<TBODY>

<TR>

<TD align=middle bgColor=#e8e8e8 height=35>Wine Data, View record [

Ref: {$show_key1}] </TD>

<TR>

<TD align=middle height=0>

<DIV align=center>

<TABLE id=table5 width="97%" border=0>

<TBODY>

<TR>

<TD width=9 height=32></TD>

<TD align=right height=32>

<P align=center><STRONG><FONT face=Arial size=3>{$show_Chateau___Wine__Alpha_format_}&nbsp;{$show_Vintage}</FONT></P></STRONG></TD>

<TD width=10 height=32>&nbsp;</TD>

<TR>

<TD width=9 height=37>&nbsp;</TD>

<TD align=right>

<TABLE id=table13 cellSpacing=0 cellPadding=0 width="100%"

border=0>

<TBODY>

<TR>

<TD>

<DIV align=center>

<TABLE id=table14 width="100%" border=0>

<TBODY>

<TR>

<TD align=right width=168><B><FONT face=Arial

size=2>Current Price<BR><FONT size=1>(Nov

2007)</FONT> </FONT></B></TD>

<TD width=6>&nbsp;</TD>

<TD width=211><FONT face=Arial size=2>{$show_Price_Oct_2007GBP}</FONT></TD>

<TR>

<TD align=right width=168><B><FONT face=Arial

size=2>Price Change</FONT></B></TD>

<TD width=6>&nbsp;</TD>

<TD width=211><FONT face=Arial size=2>{$show_07_change_release}</FONT></TD>

<TR>

<TD align=right width=168><B><FONT face=Arial

size=2>Chateau </FONT></B></TD>

<TD width=6>&nbsp;</TD>

<TD width=211><FONT face=Arial size=2>{$show_Chateau__Alpha_format_}</FONT></TD>

<TR>

<TD align=right width=168><B><FONT face=Arial

size=2>Appellation</FONT></B></TD>

<TD width=6>&nbsp;</TD>

<TD width=211><FONT face=Arial size=2>{$show_Appellation}&nbsp;

</FONT></TD>

<TR>

<TD align=right width=168 height=23><B><FONT

face=Arial size=2>In bottle maturity</FONT></B></TD>

<TD width=6 height=23>&nbsp;</TD>

<TD width=211 height=23><FONT face=Arial

size=2>{$show_In_bottle_maturity_1}</FONT></TD>

<TR>

<TD align=right width=168><B><FONT face=Arial

size=2>Tasted at&nbsp; </FONT></B></TD>

<TD width=6>&nbsp;</TD>

<TD width=211><FONT face=Arial size=2>{$show_In_bottle_tasting_location}&nbsp;

</FONT></TD></TR></TBODY></TABLE></DIV></TD>

<TD>&nbsp;</TD>

<TD>

<DIV align=center>

<TABLE id=table15 width="100%" border=0>

<TBODY>

<TR>

<TD align=right width=158>

<P><B><FONT face=Arial size=2>Release

Price<BR><FONT size=1>(Apr

2006)</FONT></FONT></B></P></TD>

<TD width=5>&nbsp;</TD>

<TD width=233><FONT face=Arial size=2>{$show_Release_Price_in_2006_GBP}</FONT></TD>

<TR>

<TD align=right width=158><B><FONT face=Arial

size=2>% Change</FONT></B></TD>

<TD width=5>&nbsp;</TD>

<TD width=233><FONT face=Arial size=2>{$show_07_change_percent}</FONT></TD>

<TR>

<TD align=right width=158><B><FONT face=Arial

size=2>First Second Wine</FONT></B></TD>

<TD width=5>&nbsp;</TD>

<TD width=233><FONT face=Arial size=2>{$show_First_Second_Third_Wines}</FONT></TD>

<TR>

<TD align=right width=158>&nbsp;</TD>

<TD width=5>&nbsp;</TD>

<TD width=233>&nbsp;</TD>

<TR>

<TD align=right width=158><B><FONT face=Arial

size=2>Number of cases</FONT></B></TD>

<TD width=5>&nbsp;</TD>

<TD width=233><FONT face=Arial size=2>{$show_Number_of_cases}</FONT></TD>

<TR>

<TD align=right width=158><FONT face=Arial

size=2><STRONG>Date&nbsp;tasted</STRONG></FONT></TD>

<TD width=5>&nbsp;</TD>

<TD width=233><FONT face=Arial size=2>{$show_In_bottle_tasting_date}</FONT></TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE>

<P align=center></P>

<HR width="85%" color=#c0c0c0 SIZE=1>

</TD>

<TD width=10 height=37>&nbsp;</TD>{if $show_In_Bottle_Note_BR}

<TR>

<TD width=9>&nbsp;</TD>

<TD align=right width=168>

<P align=left><STRONG><FONT face=Arial size=2>Tasting

Notes:</FONT></STRONG>&nbsp;</P></TD>

<TD width=10>&nbsp;</TD>

<TR>

<TD width=9>&nbsp;</TD>

<TD align=right>

<P align=left><FONT face=Arial size=2>{$show_In_Bottle_Note_BR}</FONT></P></TD>

<TD width=10></TD>{/if}</TR></TBODY></TABLE></DIV></TD>

<TR>

<TD align=middle height=78>

<DIV align=center>

<TABLE cellSpacing=0 cellPadding=0 border=0>

<TBODY>

<TR>

<TD>

<DIV align=center>

<DIV align=right>

<TABLE id=table10 borderColor=#c0c0c0 height=76 cellSpacing=0

cellPadding=0 rules=all width=0 border=1>

<TBODY>

<TR>

<TD align=middle bgColor=#e0e0e0 rowSpan=2>

<P align=center><B><FONT face=Arial size=2>&nbsp;GQ in

Bottle Score&nbsp;</FONT></B></P></TD>

<TD align=middle bgColor=#e0e0e0 colSpan=3><B><FONT

face=Arial size=2>&nbsp;Gavin Quinney choices for&nbsp;

</FONT></B></TD>

<TR>

<TD align=middle bgColor=#e0e0e0>

<P align=center><B><FONT face=Arial

size=2>&nbsp;Investors&nbsp;</FONT></B></P></TD>

<TD align=middle bgColor=#e0e0e0>

<P align=center><B><FONT face=Arial

size=2>&nbsp;Insiders&nbsp;</FONT></B></P></TD>

<TD align=middle bgColor=#e0e0e0>

<P align=center><B><FONT face=Arial

size=2>&nbsp;Imbibers&nbsp;</FONT></B></P></TD>

<TR height=24>

<TD align=middle height=33>

<P align=center><B><FONT face=Arial size=2>{$show_In_bottle_score_1}</FONT></B></P></TD>

<TD align=middle height=33>

<P align=center><B><FONT face=Arial size=2>{$show_Collectable}</FONT></B></P></TD>

<TD align=middle height=33>

<P align=center><B><FONT face=Arial size=2>{$show_Smart_buy}</FONT></B></P></TD>

<TD align=middle height=33>

<P align=center><B><FONT face=Arial size=2>{$show_Great_value}</FONT></B></P></TD></TR></TBODY></TABLE></DIV></DIV></TD>

<TD width=40>&nbsp;</TD>

<TD>

<DIV align=left>

<TABLE borderColor=#c0c0c0 height=0 cellSpacing=0 rules=all

border=1>

<TBODY>

<TR>

<TD align=middle bgColor=#e0e0e0 colSpan=3

height=27><I><B><FONT face=Arial size=2>En Primeur

Scores Apr 2006</FONT></B></I></TD>

<TR>

<TD align=middle width=77 bgColor=#e0e0e0 height=22>

<P align=center><B><FONT face=Arial

size=2>&nbsp;GQ</FONT></B></P></TD>

<TD align=middle width=75 bgColor=#e0e0e0 height=22>

<P align=center><B><FONT face=Arial

size=2>&nbsp;RP</FONT></B></P></TD>

<TD align=middle width=85 bgColor=#e0e0e0 height=22>

<P align=center><B><FONT face=Arial

size=2>&nbsp;JR</FONT></B></P></TD>

<TR height=24>

<TD align=middle width=77 height=22>

<P align=center><B><FONT face=Arial size=2>{$show_GQ}</FONT></B></P></TD>

<TD align=middle width=75 height=22>

<P align=center><B><FONT face=Arial size=2>{$show_RP}</FONT></B></P></TD>

<TD align=middle width=85 height=22>

<P align=center><B><FONT face=Arial size=2>{$show_JR}</FONT></B></P></TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE></DIV></TD>

<TR height=00>

<TD align=middle height=5>

<P align=center><IMG height=3 src="3x10.gif" width=10

border=0></P></TD>

<TR height=00>{$show_Links}&nbsp;

<TD align=middle bgColor=#e8e8e8

height=32>{$message}&nbsp;&nbsp;<SPAN class=buttonborder><INPUT class=button onclick="window.location.href='Wine_Data_list.php?a=return'" type=reset value="Back to list"></SPAN></TD></TR></TBODY></TABLE></DIV></TD>

<TR>

<TD>

<P align=center>{include_if_exists file="include/footer.php"}</P></TD></TR></TBODY></TABLE></BODY></HTML>


Cheers Chris


Hi Chris,
Your code is correct. If this is your view page the viewonload event is missing. So insert this code snippet {doevent name="ViewOnLoad"} right after the first body tag.
best regards
Jouni I

O
osluk 11/7/2007

Thanks guys but now I get this error!
Cheers Chris


PHP error happened
Technical information

Error type 256

Error description Table 'Bauduc-_GQ0701.Wine' doesn't exist

URL bordeauxreport.com/db-2007/view/Wine_Data_view.php?editid1=60

Error file /hsphere/local/home/bauduc-dev/bordeauxreport.com/db-2007/view/include/dbconnection.php

Error line 26

SQL query select `Article Number`, `Article Type`, `Author`, `Authored for`, `Type`, `Ref`, `GQ ref`, `Wine Full Name`, `File Name`, `Chateau - Wine (Alpha format)`, `Chateau (Alpha format)`, `First Second Third Wines`, `Appellation`, `Location`, `Category`, `Subcategory`, `SubSubCategory`, `GQ top pick YN`, `GQ top picks`, `Summary`, `Tasting Notes Present`, `Notes`, `Notes Updated`, `Country`, `Region`, `Vintage`, `Maturity EP`, `Release Price Added`, `Release Price in 2006 GBP`, `Estimated Price GBP`, `Estimated Low GBP`, `Estimated High GBP`, `Estimate Sort by Mid Est`, `Collectable`, `Smart buy`, `Great value`, `GQ`, `RP`, `JR`, `Featured`, `Article edit link`, `Article Link`, `Label`, `Image Present`, `Estimated Price Present`, `See Notes`, `F 1`, `Flag 1 Notes`, `F 2`, `Flag 2 Notes`, `White Dry Graves`, `White Dry Pessac-Leognan`, `Release price added date`, `Record added`, `Record modified`, `2004 prim


I dont know what causes this error but when code is removed the view pages display fine.

When added the PHP error occurs.
2 changed files are:
Upload file templates\Wine_Data_view.htm ...ok

Upload file include\Wine_Data_events.php ...ok

Upload finished OK. 2 of 2 files uploaded
Slightly odd that Wine_Data_events.php has so many blank lines

<?php
function ViewOnLoad(&$params)

{

global $conn,$strTableName;

$links = "";

$prevLink = "";

$current = $_REQUEST["editid1"];

$next=0;

$strSelect = "select * from ".$strTableName;

$rs = db_query($strSelect,$conn);

while ($data = db_fetch_array($rs))

{

if ($next) {

$links .= " <a href=\"Wine_Data_view.php?editid1=".$data["Ref"]."\">next</a>";

$next = 0;

}
if ($current==$data["Ref"]) {

$next = $current+1;

$links = $prevLink;

}

else {

$prevLink = "<a href=\"Wine_Data_view.php?editid1=".$data["Ref"]."\">prev</a>";

}

}

echo $links;
}
?>


Current Wine_Data_view.htm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD><TITLE>Wine Data</TITLE>

<META http-equiv=Content-Type content="text/html; charset=windows-1252"><LINK

href="include/style.css" type=text/css rel=stylesheet>

<META content="MSHTML 6.00.6000.16544" name=GENERATOR></HEAD

<BODY bottomMargin=0 leftMargin=0 topMargin=0 rightMargin=0>

{doevent name="ViewOnLoad"}

{include_if_exists file="include/header.php"}{$message}

<TABLE height="100%" width="100%" border=0>

<TBODY>

<TR>

<TD>

<P align=center>

</P></TD>

<TR>

<TD>

<DIV align=center>

<TABLE class=main_table id=table4 style="WIDTH: 90%" height=0

cellPadding=2 rules=none border=1>

<TBODY>

<TR>

<TD align=middle bgColor=#e8e8e8 height=35>Wine Data, View record [

Ref: {$show_key1} ]&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;<a target="_top" href="http://bordeauxreport.com/db-2007/frame/">Back to Index Page</A></TD>

<TR>

<TD align=middle height=0>

<DIV align=center>

<TABLE id=table5 width="97%" border=0>

<TBODY>

<TR>

<TD width=9 height=32></TD>

<TD align=right height=32>

<P align=center><STRONG><FONT face=Arial size=3>{$show_Chateau___Wine__Alpha_format_}&nbsp;{$show_Vintage}</FONT></P></STRONG></TD>

<TD width=10 height=32>&nbsp;</TD>

<TR>

<TD width=9 height=37>&nbsp;</TD>

<TD align=right>

<TABLE id=table13 cellSpacing=0 cellPadding=0 width="100%"

border=0>

<TBODY>

<TR>

<TD>

<DIV align=center>

<TABLE id=table14 width="100%" border=0>

<TBODY>

<TR>

<TD align=right width=168><B><FONT face=Arial

size=2>Current Price<BR><FONT size=1>(Nov

2007)</FONT> </FONT></B></TD>

<TD width=6>&nbsp;</TD>

<TD width=211><FONT face=Arial size=2>{$show_Price_Oct_2007GBP}</FONT></TD>

<TR>

<TD align=right width=168><B><FONT face=Arial

size=2>Price Change</FONT></B></TD>

<TD width=6>&nbsp;</TD>

<TD width=211><FONT face=Arial size=2>{$show_07_change_release}</FONT></TD>

<TR>

<TD align=right width=168><B><FONT face=Arial

size=2>Chateau </FONT></B></TD>

<TD width=6>&nbsp;</TD>

<TD width=211><FONT face=Arial size=2>{$show_Chateau__Alpha_format_}</FONT></TD>

<TR>

<TD align=right width=168><B><FONT face=Arial

size=2>Appellation</FONT></B></TD>

<TD width=6>&nbsp;</TD>

<TD width=211><FONT face=Arial size=2>{$show_Appellation}&nbsp;

</FONT></TD>

<TR>

<TD align=right width=168 height=23><B><FONT

face=Arial size=2>In bottle maturity</FONT></B></TD>

<TD width=6 height=23>&nbsp;</TD>

<TD width=211 height=23><FONT face=Arial

size=2>{$show_In_bottle_maturity_1}</FONT></TD>

<TR>

<TD align=right width=168><B><FONT face=Arial

size=2>Tasted at&nbsp; </FONT></B></TD>

<TD width=6>&nbsp;</TD>

<TD width=211><FONT face=Arial size=2>{$show_In_bottle_tasting_location}&nbsp;

</FONT></TD></TR></TBODY></TABLE></DIV></TD>

<TD>&nbsp;</TD>

<TD>

<DIV align=center>

<TABLE id=table15 width="100%" border=0>

<TBODY>

<TR>

<TD align=right width=158>

<P><B><FONT face=Arial size=2>Release

Price<BR><FONT size=1>(Apr

2006)</FONT></FONT></B></P></TD>

<TD width=5>&nbsp;</TD>

<TD width=233><FONT face=Arial size=2>{$show_Release_Price_in_2006_GBP}</FONT></TD>

<TR>

<TD align=right width=158><B><FONT face=Arial

size=2>% Change</FONT></B></TD>

<TD width=5>&nbsp;</TD>

<TD width=233><FONT face=Arial size=2>{$show_07_change_percent}</FONT></TD>

<TR>

<TD align=right width=158><B><FONT face=Arial

size=2>First Second Wine</FONT></B></TD>

<TD width=5>&nbsp;</TD>

<TD width=233><FONT face=Arial size=2>{$show_First_Second_Third_Wines}</FONT></TD>

<TR>

<TD align=right width=158>&nbsp;</TD>

<TD width=5>&nbsp;</TD>

<TD width=233>&nbsp;</TD>

<TR>

<TD align=right width=158><B><FONT face=Arial

size=2>Number of cases</FONT></B></TD>

<TD width=5>&nbsp;</TD>

<TD width=233><FONT face=Arial size=2>{$show_Number_of_cases}</FONT></TD>

<TR>

<TD align=right width=158><FONT face=Arial

size=2><STRONG>Date&nbsp;tasted</STRONG></FONT></TD>

<TD width=5>&nbsp;</TD>

<TD width=233><FONT face=Arial size=2>{$show_In_bottle_tasting_date}</FONT></TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE>

<P align=center></P>

<HR width="85%" color=#c0c0c0 SIZE=1>

</TD>

<TD width=10 height=37>&nbsp;</TD>{if $show_In_Bottle_Note_BR}

<TR>

<TD width=9>&nbsp;</TD>

<TD align=right width=168>

<P align=left><STRONG><FONT face=Arial size=2>Tasting

Notes:</FONT></STRONG>&nbsp;</P></TD>

<TD width=10>&nbsp;</TD>

<TR>

<TD width=9>&nbsp;</TD>

<TD align=right>

<P align=left><FONT face=Arial size=2>{$show_In_Bottle_Note_BR}</FONT></P></TD>

<TD width=10></TD>{/if}</TR></TBODY></TABLE></DIV></TD>

<TR>

<TD align=middle height=78>

<DIV align=center>

<TABLE cellSpacing=0 cellPadding=0 border=0>

<TBODY>

<TR>

<TD>

<DIV align=center>

<DIV align=right>

<TABLE id=table10 borderColor=#c0c0c0 height=76 cellSpacing=0

cellPadding=0 rules=all width=0 border=1>

<TBODY>

<TR>

<TD align=middle bgColor=#e0e0e0 rowSpan=2>

<P align=center><B><FONT face=Arial size=2>&nbsp;GQ in

Bottle Score&nbsp;</FONT></B></P></TD>

<TD align=middle bgColor=#e0e0e0 colSpan=3><B><FONT

face=Arial size=2>&nbsp;Gavin Quinney choices for&nbsp;

</FONT></B></TD>

<TR>

<TD align=middle bgColor=#e0e0e0>

<P align=center><B><FONT face=Arial

size=2>&nbsp;Investors&nbsp;</FONT></B></P></TD>

<TD align=middle bgColor=#e0e0e0>

<P align=center><B><FONT face=Arial

size=2>&nbsp;Insiders&nbsp;</FONT></B></P></TD>

<TD align=middle bgColor=#e0e0e0>

<P align=center><B><FONT face=Arial

size=2>&nbsp;Imbibers&nbsp;</FONT></B></P></TD>

<TR height=24>

<TD align=middle height=33>

<P align=center><B><FONT face=Arial size=2>{$show_In_bottle_score_1}</FONT></B></P></TD>

<TD align=middle height=33>

<P align=center><B><FONT face=Arial size=2>{$show_Collectable}</FONT></B></P></TD>

<TD align=middle height=33>

<P align=center><B><FONT face=Arial size=2>{$show_Smart_buy}</FONT></B></P></TD>

<TD align=middle height=33>

<P align=center><B><FONT face=Arial size=2>{$show_Great_value}</FONT></B></P></TD></TR></TBODY></TABLE></DIV></DIV></TD>

<TD width=40>&nbsp;</TD>

<TD>

<DIV align=left>

<TABLE borderColor=#c0c0c0 height=0 cellSpacing=0 rules=all

border=1>

<TBODY>

<TR>

<TD align=middle bgColor=#e0e0e0 colSpan=3

height=27><I><B><FONT face=Arial size=2>En Primeur

Scores Apr 2006</FONT></B></I></TD>

<TR>

<TD align=middle width=77 bgColor=#e0e0e0 height=22>

<P align=center><B><FONT face=Arial

size=2>&nbsp;GQ</FONT></B></P></TD>

<TD align=middle width=75 bgColor=#e0e0e0 height=22>

<P align=center><B><FONT face=Arial

size=2>&nbsp;RP</FONT></B></P></TD>

<TD align=middle width=85 bgColor=#e0e0e0 height=22>

<P align=center><B><FONT face=Arial

size=2>&nbsp;JR</FONT></B></P></TD>

<TR height=24>

<TD align=middle width=77 height=22>

<P align=center><B><FONT face=Arial size=2>{$show_GQ}</FONT></B></P></TD>

<TD align=middle width=75 height=22>

<P align=center><B><FONT face=Arial size=2>{$show_RP}</FONT></B></P></TD>

<TD align=middle width=85 height=22>

<P align=center><B><FONT face=Arial size=2>{$show_JR}</FONT></B></P></TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE></DIV></TD>

<TR height=00>

<TD align=middle height=5>

<P align=center><IMG height=3 src="3x10.gif" width=10

border=0></P></TD>

<TR height=00>{$show_Links}&nbsp;

<TD align=middle bgColor=#e8e8e8

height=32>{$message}&nbsp;&nbsp;<SPAN class=buttonborder><INPUT class=button onclick="window.location.href='Wine_Data_list.php?a=return'" type=reset value="Back to list"></SPAN></TD></TR></TBODY></TABLE></DIV></TD>

<TR>

<TD>

<P align=center>{include_if_exists file="include/footer.php"}</P></TD></TR></TBODY></TABLE></BODY></HTML>
J
jomppa10 11/8/2007

Hi,

try to change .
regards Jouni I

O
osluk 11/9/2007

the table is `Wine Data`
Is there a problem with the space in the table name?
Looks like $conn $strTableName should find the connection and table name.
Seems it is looking for

Table 'Bauduc-_GQ0701.Wine'

Not

Table 'Bauduc-_GQ0701.Wine Data'
Error description Table 'Bauduc-_GQ0701.Wine' doesn't exist

URL bordeauxreport.com/db-2007/view/Wine_Data_view.php?editid1=60
global $conn,$strTableName;

Should this be line become

global $conn,`Wine Data`;
Thanks again to everyone for there help.
Cheers Chris