I'm trying to pull the value in my "NumberOfKidsYouSign" and print it using the following command.
$sQuery = db_arr("SELECT 'ID','NumberOfKidsYouSign' FROM `Profiles` WHERE `ID` = '4'"); echo ((int) $sQuery['NumberOfKidsYouSign']);
The value in the DB is 2 and I am getting 0. what is wrong with the syntax
|
I'm trying to pull the value in my "NumberOfKidsYouSign" and print it using the following command.
$sQuery = db_arr("SELECT 'ID','NumberOfKidsYouSign' FROM `Profiles` WHERE `ID` = '4'"); echo ((int) $sQuery['NumberOfKidsYouSign']);
The value in the DB is 2 and I am getting 0. what is wrong with the syntax
The type of quote mark your using in the above query are wrong. Should be ` not '
The type of quote your using tells mysql that those are string values instead of database fields.
https://www.deanbassett.com |
Deano is right. Modify it like below
$sQuery = db_arr(" SELECT ID, NumberOfKidsYouSign FROM Profiles WHERE ID = 4 ");
Looking for Help? http://www.boonex.com/kevinmitnick |
Many thanks!
I need now to modify the redirect mod of deano so it will check if the field is 0 to go to pedit.php page so new members will fill the form or to go another page in the Page_after_logon. Somehow I'm getting an error again.
$sQuery = db_arr(" SELECT ID, NumberOfKidsYouSign FROM Profiles WHERE ID = (int)$_COOKIE['memberID'] ");
if( !$sUrlRelocate = $_REQUEST['relocate'] or $_REQUEST['relocate'] == $site['url'] or basename( $_REQUEST['relocate'] ) == 'join.php' ) $sUrlRelocate = $_SERVER['PHP_SELF']; if ($sUrlRelocate == $site['url'] . 'member.php') { $dbRv = getParam('page_after_logon'); $dbRd = $dbRv; $dbRd = str_replace("{nickname}",getNickName((int)$_COOKIE['memberID']),$dbRd); $dbRd = str_replace("{memberid}",$_COOKIE['memberID'],$dbRd); if (((int) $sQuery['NumberOfKidsYouSign'])== 0){ $sUrlRelocate = $site['url'] . 'pedit.php?ID={memberID}'; }else { $sUrlRelocate = $site['url'] . $dbRd;} }
In red is my change
|
Many thanks!
I need now to modify the redirect mod of deano so it will check if the field is 0 to go to pedit.php page so new members will fill the form or to go another page in the Page_after_logon. Somehow I'm getting an error again.
$sQuery = db_arr(" SELECT ID, NumberOfKidsYouSign FROM Profiles WHERE ID = (int)$_COOKIE['memberID'] ");
if( !$sUrlRelocate = $_REQUEST['relocate'] or $_REQUEST['relocate'] == $site['url'] or basename( $_REQUEST['relocate'] ) == 'join.php' ) $sUrlRelocate = $_SERVER['PHP_SELF']; if ($sUrlRelocate == $site['url'] . 'member.php') { $dbRv = getParam('page_after_logon'); $dbRd = $dbRv; $dbRd = str_replace("{nickname}",getNickName((int)$_COOKIE['memberID']),$dbRd); $dbRd = str_replace("{memberid}",$_COOKIE['memberID'],$dbRd); if (((int) $sQuery['NumberOfKidsYouSign'])== 0){ $sUrlRelocate = $site['url'] . 'pedit.php?ID={memberID}'; }else { $sUrlRelocate = $site['url'] . $dbRd;} }
In red is my change
Try this instead.
if (((int)
$sQuery['NumberOfKidsYouSign'])== 0){ $sUrlRelocate = $site['url'] .
'pedit.php?ID=' . $_COOKIE['memberID']; }else { $sUrlRelocate = $site['url']
. $dbRd;} }
{memberID} is just a key i allow for use in the stored value. If it exists it is replaced with the member id. It can't be used in the way you tried to use it. The code above should do what your looking for.
https://www.deanbassett.com |
Deano, now after the change it's not allowing me to login. It complains that user / password is wrong. It's working on the version before this change.
Strange isn't it?
|
Deano, now after the change it's not allowing me to login. It complains that user / password is wrong. It's working on the version before this change.
Strange isn't it?
No it's not strange. If any quotes are missing or misplaced or any other error in the php code, that is exactly what happens. I ran into several times while writing the mod. If a error exists in that code, the logon process does not complete.
We just need to figure out where the error is.
I think i found it. Try this.
if (((int)
$sQuery['NumberOfKidsYouSign']) == 0) { $sUrlRelocate = $site['url'] .
'pedit.php?ID=' . $_COOKIE['memberID']; }else { $sUrlRelocate =
$site['url']
. $dbRd; }
There was a extra } located where it should not have been.
If this don't work, we just need to keep looking at it until the error is found.
https://www.deanbassett.com |
Still not working....maybe better to start from the begining :-)
I took your mod:
// Deano - Redirect after Logon Mod - Start if( !$sUrlRelocate = $_REQUEST['relocate'] or $_REQUEST['relocate'] == $site['url'] or basename( $_REQUEST['relocate'] ) == 'join.php' ) $sUrlRelocate = $_SERVER['PHP_SELF']; if ($sUrlRelocate == $site['url'] . 'member.php') { $dbRv = getParam('page_after_logon'); $dbRd = $dbRv; $dbRd = str_replace("{nickname}",getNickName((int)$_COOKIE['memberID']),$dbRd); $dbRd = str_replace("{memberid}",$_COOKIE['memberID'],$dbRd); $sUrlRelocate = $site['url'] . $dbRd; } // Deano - Redirect after Logon Mod - End
And now I need to add a request for the field content:
$sQuery = db_arr(" SELECT ID, NumberOfKidsYouSign FROM Profiles WHERE ID = (int)$_COOKIE['memberID'] ");
and then to add the check so we can flip pages based on if member filled the form or not..since defualt is 0
if (((int) $sQuery['NumberOfKidsYouSign']) == 0) { $sUrlRelocate = $site['url'] . 'pedit.php?ID=' . $_COOKIE['memberID']; }else { $sUrlRelocate = $site['url'] . $dbRd; }
Where do you recommend to add it in your mod?Should be have a generic variable like what you added to check against something?
I think having this version will allow many members to make sure new members are filling their details after join.
Thanks for your help so far.
|
I will write one up. I'll test on my server. It will not match yours exactly as i prefer to write sql queries a little different. Back in a few with some code.
https://www.deanbassett.com |
Ok. This has been tested on my site. No errors.
// Deano - Redirect after Logon Mod - Start if( !$sUrlRelocate = $_REQUEST['relocate'] or $_REQUEST['relocate'] == $site['url'] or basename( $_REQUEST['relocate'] ) == 'join.php' ) $sUrlRelocate = $_SERVER['PHP_SELF']; if (strpos($sUrlRelocate,'member.php') > 0) { $dbRv = getParam('page_after_logon'); $dbRd = $dbRv; $dbRd = str_replace("{nickname}",getNickName((int)$_COOKIE['memberID']),$dbRd); $dbRd = str_replace("{memberid}",$_COOKIE['memberID'],$dbRd); $memID = (int)$_COOKIE['memberID']; $sQuery = db_arr("SELECT `ID`, `NumberOfKidsYouSign` FROM `Profiles` WHERE `ID` = '$memID'"); if ((int)($sQuery['NumberOfKidsYouSign']) == 0) { $sUrlRelocate = $site['url'] . 'pedit.php?ID=' . $memID; } else { $sUrlRelocate = $site['url'] . $dbRd; } } // Deano - Redirect after Logon Mod - End
https://www.deanbassett.com |
Hmm. i should rewrite that. After looking at it again i see how sloppy it is.
https://www.deanbassett.com |
BINGO! You are great!
Maybe you can post a new version with two other variables:
Var1- Page_after_logon
Var2- field_to check_against
Var3- Default_value_to_check
And you can have a generic mod to allow other people making sure members are filling their required details after they joined
......
Do you know where I can find more details about the different function to get results from mysql in Dolphin or like what you did with the var?
|
Dolphin lacks docs but you can reference the items pointed to here.
http://www.boonex.com/unity/forums/#topic/Developers-Links.htm
All of what i know about dolphin i had to learn from looking at the dolphin code. And i still have a lot to learn about it. Dolphin is complex and as i see it, a big mess which makes it even worse when you want to try and find out how to do something.
https://www.deanbassett.com |
How can I apply this method to the JOIN. I want that after successful join to bring the user to same place like login. Now it's going to Avatar page
I guess there is a similar place but can't find it in the Join.php
|