close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Colname not working

Thread began 12/28/2018 3:51 am by john70964 | Last modified 1/04/2019 2:25 pm by Ray Borduin | 1337 views | 8 replies |

john70964

Colname not working

Hello Ray
I have a simple list and details page.
The list seems OK and when I hover over a record number the url shows
correctly at the bottom right hand of the page.
However when I click the link to the details page
I get the correct url http://localhost/boatsforsalenow_mysqli/categories/details.php?11791=11791 but the page remains blank.
Have you an idea why this could be?
Thanks
John

List.php
========

<?php require_once('../Connections/conn1_i.php'); ?>
<?php require_once('../webassist/mysqli/rsobj.php'); ?>
<?php
$rsCanalBoatList = new WA_MySQLi_RS("rsCanalBoatList",$conn1_i,0);
$rsCanalBoatList->setQuery("SELECT RecNo, Manufacturer, Model, Image1_250 FROM boats WHERE Category1 = 'Canal Boats'");
$rsCanalBoatList->execute();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<p>List Canal Boats </p>
<?php
$wa_startindex = 0;
while(!$rsCanalBoatList->atEnd()) {
$wa_startindex = $rsCanalBoatList->Index;
?>
<p><a href="details.php?<?php echo($rsCanalBoatList->getColumnVal("RecNo")); ?>=<?php echo($rsCanalBoatList->getColumnVal("RecNo")); ?>"><?php echo($rsCanalBoatList->getColumnVal("RecNo")); ?></a><?php echo($rsCanalBoatList->getColumnVal("Manufacturer")); ?><?php echo($rsCanalBoatList->getColumnVal("Model")); ?><a href="details.php"><img src="../BoatImages/<?php echo($rsCanalBoatList->getColumnVal("Image1_250")); ?>" alt="Canal Boats" /></a></p>
<?php
$rsCanalBoatList->moveNext();
}
$rsCanalBoatList->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
?>
</body>
</html>
==================
Details.php
===========

<?php require_once('../Connections/conn1_i.php'); ?>
<?php require_once('../webassist/mysqli/rsobj.php'); ?>
<?php
$rsCanalBoatDetails = new WA_MySQLi_RS("rsCanalBoatDetails",$conn1_i,100);
$rsCanalBoatDetails->setQuery("SELECT boats.RecNo, boats.RegDate, boats.Company, boats.Manufacturer, boats.Model, boats.BuildDate, boats.NeworUsed, boats.Category1, boats.HullMaterial, boats.`Engines`, boats.LOA, boats.image1_900 FROM boats WHERE boats.RecNo = ?");
$rsCanalBoatDetails->bindParam("i", "".($rsCanalBoatDetails->getColumnVal("RecNo")) ."", "-1"); //WAQB_Param1
$rsCanalBoatDetails->execute();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<p>Details <br />
<?php echo($rsCanalBoatDetails->getColumnVal("RecNo")); ?><br />
<?php echo($rsCanalBoatDetails->getColumnVal("Manufacturer")); ?><br />
<?php echo($rsCanalBoatDetails->getColumnVal("Model")); ?><br />
<?php echo($rsCanalBoatDetails->getColumnVal("BuildDate")); ?></p>
</body>
</html>

Sign in to reply to this post

Ray BorduinWebAssist

The URL should probably be something like:

http://localhost/boatsforsalenow_mysqli/categories/details.php?RecNo=11791

Then on the details page this line:

$rsCanalBoatDetails->bindParam("i", "".($rsCanalBoatDetails->getColumnVal("RecNo")) ."", "-1"); //WAQB_Param1

should probably be:

$rsCanalBoatDetails->bindParam("i", "".($_GET("RecNo")) ."", "-1"); //WAQB_Param1

You can't refer to a recordset value in a parameter for the recordset that you are creating. I think you want to use the passed in value from the url instead.

Sign in to reply to this post
Did this help? Tips are appreciated...

john70964

Hello Ray
In the past i have created many links but at the moment I do not seem able.
This seems to have occoured after updating to DB 234, I must now be making some basic mistakes.
Is ther a tutorial anywhere for this. I found one of JB's but it was many yearsold now and out of date.

To try to understand where I am going wrong I copied my steps.


I create a link on the list.php named Details
Link box shows details.php
On the right hand side Of the link box there is a folder.
I select the folder and use the Data Sources tab to select RecNo
This produces code on the list.php page of
<a href="<?php echo($rsCanalBoatList->getColumnVal("RecNo")); ?>">Details</a>
It appears the target of page Details.php is missing.

When I hover over the link I see http://localhost/boatsforsalenow_mysqli/categories/119898
I can correct this by inserting detail.php
reating <a href="details.php<?php echo($rsCanalBoatList->getColumnVal("RecNo")); ?>">Details</a>
which arrives at the correct page.

On the details.php page I deleted the recordset to insert a new one.
I selected Query builder (which seems very slow) and dragged the boats table
I select the few column names required.
After this I selected Advanced Builder
I selected Where RecNo comparison value is set to URL Parameter and I entered RecNo in the box and OK.

On the page this brought up a syntax error on line 4

I deleted the recordset and reset the page
I created a new recordset rsDetails in Simple format
with RecNo Url Parameter and RecNo
I then selected Advanced
I selected Edit in the Variables Column whci showed
Colname Interger -1 $_GET['RecNo'] I selected OK and OK again
==================================================================
When I ran the pages
The url shows on the List page appears to be correct and when I press the link
the url shows as http://localhost/boatsforsalenow_mysqli/categories/details.php11898
which is also correct
But I get the error
Object not found!
========================
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated.
Please inform the author of that page about the error.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.29 (Win32) OpenSSL/1.0.2l PHP/5.6.32
============================
I have placed the files at

http://net100test.co.uk/WA_DB234/BFSN_full/categories/list.php
ftp detail
Ftp Detail
Server: home415519235.1and1-data.host
Port: 22
Protocol: SFTP
User name u68925687-Mysqli_tes
Password P0lyg0n&20*&

I think when I get clear on the system of getting the links to work
I will publish the method on the forum to help me if ever I get into a pckle again.
(If that is Ok)

Sign in to reply to this post

Ray BorduinWebAssist

Instead of:
<a href="details.php<?php echo($rsCanalBoatList->getColumnVal("RecNo")); ?>">Details</a>

it should be:
<a href="details.php?RecNo=<?php echo($rsCanalBoatList->getColumnVal("RecNo")); ?>">Details</a>

Sign in to reply to this post
Did this help? Tips are appreciated...

john70964

Hello Ray
I replaced the code but it came up with a syntax error and it seems the server behaviour is missing,
I attach an image

Sign in to reply to this post

Ray BorduinWebAssist

You replaced the wrong line of code. The line I was telling you to replace was on the results page, not the details page, and it should be in the <html> nested in the repeat region, not in the recordset code on the top of the page.

Sign in to reply to this post
Did this help? Tips are appreciated...

john70964

Thanks Ray
I have the List Page producing the url
localhost/boatsforsalenow_mysqli/categories/details.php?RecNo=11476
from the Details link on List.php
<a href="details.php?RecNo=<?php echo($rsCanalBoatList->getColumnVal("RecNo")); ?>">Details</a>

When the Details link is used it opens details.php but no records appear.
When the Recordset for the details.php is tested
with a RecNo inserted eg 11746 the correct detail appears.
I hope I have explained this OK for you.

The code for detail.php is below
<?php require_once('../Connections/conn1_i.php'); ?>
<?php require_once('../webassist/mysqli/rsobj.php'); ?>
<?php
$rsDetails = new WA_MySQLi_RS("rsDetails",$conn1_i,1);
$rsDetails->setQuery("SELECT RecNo, Manufacturer, Model, Category1, image1_900, Image1_250 FROM boats WHERE RecNo = ?");
$rsDetails->bindParam("i", "".(isset($_GET['".($rsDetails->getColumnVal("RecNo")) ."'])?$_GET['".($rsDetails->getColumnVal("RecNo")) ."']:"") ."", "-1"); //colname
$rsDetails->execute();
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<p>Details <br />
<?php echo($rsDetails->getColumnVal("RecNo")); ?><br />
<?php echo($rsDetails->getColumnVal("Manufacturer")); ?><br />
<?php echo($rsDetails->getColumnVal("Model")); ?><br />
<?php echo($rsDetails->getColumnVal("BuildDate")); ?></p>
</body>
</html>

Sign in to reply to this post

Ray BorduinWebAssist

This line:

$rsDetails->bindParam("i", "".(isset($_GET['".($rsDetails->getColumnVal("RecNo")) ."'])?$_GET['".($rsDetails->getColumnVal("RecNo")) ."']:"") ."", "-1");

should be:

$rsDetails->bindParam("i", "".(isset($_GET["RecNo"])?$_GET["RecNo"]:"") ."", "-1");

Sign in to reply to this post
Did this help? Tips are appreciated...

john70964

Thank you Ray

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...