close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Dynamic redirect url on update based on column value in table

Thread began 5/22/2020 11:51 am by jo271221 | Last modified 2/03/2021 10:56 am by Ray Borduin | 253 views | 10 replies |

jo271221

Dynamic redirect url on update based on column value in table

We have been redirecting according to a column value in our user table. Now I am upgrading my pages to mySLQi and I obviously do not have something right.
I am attaching my page.

The recordset is on line #16 and also pasted here:
<?php
$SecurityAssisttbldirectorylistings = new WA_MySQLi_RS("SecurityAssisttbldirectorylistings",$HotNetwork_i,1);
$SecurityAssisttbldirectorylistings->setQuery("SELECT * FROM tbl_directorylistings WHERE id = ?");
$SecurityAssisttbldirectorylistings->bindParam("i", "".($_SESSION['id']) ."", "-1"); //colname
$SecurityAssisttbldirectorylistings->execute();
?>

The update is on line#258 and here
<?php
if (isset($_POST["Update"]) || isset($_POST["Update_x"]) && ($_SESSION["SecurityAssist_id"] == 9290)) {
$UpdateQuery = new WA_MySQLi_Query($HotNetwork_i);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "horses";
$UpdateQuery->bindColumn("admin_notes", "s", "".((isset($_POST["admin_notes"]))?$_POST["admin_notes"]:"") ."", "WA_BLANK");
$UpdateQuery->addFilter("horseid", "=", "i", "".((isset($_POST["WADAUpdateRecordID"]))?$_POST["WADAUpdateRecordID"]:"") ."");
$UpdateQuery->execute();
$UpdateGoTo = "http://". ($SecurityAssisttbldirectorylistings->getColumnVal("toptable")) . "/hotpage/horse-profile.php?horseid=" ."";
if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo?rel2abs($UpdateGoTo,dirname(__FILE__)):"";
$UpdateQuery->redirect($UpdateGoTo);
}
?>

Sign in to reply to this post

Ray BorduinWebAssist

I think you can update this:
$UpdateGoTo = "http://". ($SecurityAssisttbldirectorylistings->getColumnVal("toptable")) . "/hotpage/horse-profile.php?horseid=" ."";

to:
$UpdateGoTo = "http://". ($SecurityAssisttbldirectorylistings->getColumnVal("toptable")) . "/hotpage/horse-profile.php?horseid=[InsertID]";

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

jo271221

Dynamic redirect issue remains

I am getting an error in my SQL syntax message

Sign in to reply to this post

Ray BorduinWebAssist

Turn on Debug in the rsobj.php page and the queryobj.php page. That will give you the actual SQL error instead of this generic one.

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

jo271221

I added the debug code per you suggestion and I am still getting a generic error.
I also added the similar redirect code to another update page (noted in private message) and on that page it allows me to submit, it just is not find the data in the database to populate the url correctly.

Sign in to reply to this post

Ray BorduinWebAssist

You still have:

$this->Debug = false;

in both the rsobj.php and queryobj.php file.

Once I updated that, I got the error:
Unknown column 'admin_notes_royalcrown' in 'field list'

That means you are missing that column in your database.

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

jo271221

Thank you, Is that something I should change back as soon as we are done troubleshooting?
(Ref - $this->Debug = false; in both the rsobj.php and queryobj.php file)

No we are having the same error on both pages.
http://hotpage/horse-profile.php?horseid=0 It is not inserting the url prefix from the database or the horseid

Sign in to reply to this post

Ray BorduinWebAssist

You should keep it turned off because it can reveal information about your database like column names or queries you are running when an error occurs, which could potentially be used to help a hacker get information from your database if you have a security hole somewhere else.

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

jo271221

Ok, I will check to make sure that you turned it back off and if not do that immediately. Thank you.

Now we are having the same issue on both pages.
http://hotpage/horse-profile.php?horseid=0 It is not inserting the url prefix from the database or the horseid

Sign in to reply to this post

Ray BorduinWebAssist

That url doesn't seem to work for me. Please attach the page as well so I can look at it more quickly without having to FTP in.

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

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...