₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,345,054 members, 8,515,276 topics. Date: Sunday, 08 November 2026 at 02:27 PM

Toggle theme

Please Help Php/mysql - Webmasters - Nairaland

Nairaland Forum › Science/Technology › Webmasters › Please Help Php/mysql (1406 Views)

1 Reply (Go Down)

Please Help Php/mysql by Dawgzfada(op): 3:23pm On Jul 01, 2011
Am working on the registration page of a webapp and i need the query statement i'll be using for the "testcode" parameter i.e. if the code exists in the database, then it should register, else fail.

The way it was inserted is
$query = "update test set testname='" . htmlspecialchars($_REQUEST['testname'], ENT_QUOTES) . "',testdesc='" . htmlspecialchars($_REQUEST['testdesc'], ENT_QUOTES) . "',subid=" . htmlspecialchars($_REQUEST['subject'], ENT_QUOTES) . ",testfrom='" . $fromtime . "',testto='" . $totime . "',duration=" . htmlspecialchars($_REQUEST['duration'], ENT_QUOTES) . ",totalquestions=" . htmlspecialchars($_REQUEST['totalqn'], ENT_QUOTES) . ",testcode=ENCODE('" . htmlspecialchars($_REQUEST['testcode'], ENT_QUOTES) . "','oespass') where testid=" . $_REQUEST['testid'] . ";";
I tried


$result=executeQuery("select testcode from test where testcode=DECODE('" . htmlspecialchars($_REQUEST['testcode'], ENT_QUOTES) . "';"wink;
if(mysql_num_rows($result1) != 0)
    {
        $_GLOBALS['message']="Sorry the Testcode doesn't exist.";
    }
else
{
//Register
}


but it didn't work.

Someone should please help. Thanks
Re: Please Help Php/mysql by joomlaman(m): 4:37pm On Jul 01, 2011
Hmm! let me finish eating tongue and concentrate to solve your problem soon!
Re: Please Help Php/mysql by Dawgzfada(op): 4:42pm On Jul 01, 2011
Thank you. .

Lemme simplify the problem now, the main problem is in this line, around that decode line.

$result=executeQuery("select testcode from test where testcode=DECODE('" . htmlspecialchars($_REQUEST['testcode'], ENT_QUOTES) . "';"wink;


I want it to encode the user's input. .and check against what i have in my db.
Re: Please Help Php/mysql by Mobinga: 5:51pm On Jul 01, 2011
Re: Please Help Php/mysql by Nobody: 12:11am On Jul 02, 2011
I can see you didn't close your quote properly. Look at your lines they are not in accordance with what you want them to do for you. Just look closely you will see what the errors are.
Re: Please Help Php/mysql by Dawgzfada(op): 7:16am On Jul 02, 2011
Thanks for all the efforts. Solved already.
Re: Please Help Php/mysql by DualCore1: 7:28am On Jul 02, 2011
Post the solution, to help someone someday.
1 Reply

Php/mysql Pin And Serial Number Generation Script • Wamp Server Ebook Ft Install Wamp, Write Php / Mysql / Mysql Console • Learn Cakephp, Php/mysql For Free With Video Tutorials • 2 • 3 • 4

..... • Remote Code Execution Vulnerability In PHP Still Unresolved • 2016 Top 5 Digital Marketing Agencies In Nigeria.