Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,149,813 members, 7,806,283 topics. Date: Tuesday, 23 April 2024 at 02:01 PM

Post your PHP Problems Here - Webmasters (20) - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Post your PHP Problems Here (63220 Views)

Thread For All Your Blogging Related Problems Here / Get And Request For Your Php Problems Here / Connecting To Your Gmail Account From Your Php Application. (2) (3) (4)

(1) (2) (3) ... (17) (18) (19) (20) (Reply) (Go Down)

Re: Post your PHP Problems Here by Adesege(m): 6:05pm On Oct 03, 2015
satmaniac:



If I must be sincere,

1. I've not been away in the real sense.
2. Since our last discussion, I can categorically tell you that I haven't browsed with my system. Not that I don't have subscription but...
3. I've been busy.
4. No power supply in my area and whenever I put on my generator, I...
5. Use it to work on my clients' work.

The other day I asked you to give me some time to work on the code you posted, I actually did a rewrite of it but I didn't save it. When I was supposed to post it, I realized I've been banned on Nairaland. What the offence was, I really cant fathom.

And since then, I've been busy.

But don't worry, as soon as I post this, I will work on it for the last time.

Happy coding
Re: Post your PHP Problems Here by satmaniac(m): 6:35pm On Oct 03, 2015
Adesege:


If I must be sincere,

1. I've not been away in the real sense.
2. Since our last discussion, I can categorically tell you that I haven't browsed with my system. Not that I don't have subscription but...
3. I've been busy.
4. No power supply in my area and whenever I put on my generator, I...
5. Use it to work on my clients' work.

The other day I asked you to give me some time to work on the code you posted, I actually did a rewrite of it but I didn't save it. When I was supposed to post it, I realized I've been banned on Nairaland. What the offence was, I really cant fathom.

And since then, I've been busy.

But don't worry, as soon as I post this, I will work on it for the last time.

Happy coding

OK I will wait.
Re: Post your PHP Problems Here by Adesege(m): 6:37pm On Oct 03, 2015
satmaniac:
Welcome back bro,

[size=39pt]Modified[/size]

Hello, below is a brief rewrite i wrote on the code you posted. I believe it should work.

I do not guarantee any security whatsoever for this code, use it at your risk.

I've also provided some comments in between.

Your response will ascertain if the code actually works for you.

In between, i assumed you were trying to repopulate your form after the submit button has been clicked. While this is a good idea, the way you went about it wasnt good. I've provided a function which you can use to do that.

Just call set_value($fieldname); where $fieldname is the name you assigned to the input, select, checkbox, or radio element.


<?php
include 'connect.php';
if (isset($_POST['registerBtn']) && $_POST['registerBtn']=='Register'){
//It is adviced you sanitize whatever data you will be receiving from user.
$firstname = $_POST['firstname'];
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
$confirmpassword = $_POST['confirmpassword'];
$username = $_POST['username'];
$sex = $_POST['sex'];

}

if ($password!=$confirmpassword){
echo 'password do not match';
exit;
}
if (empty($firstname) || empty($name)){
echo 'The name field is required';
exit;
}
if (empty($username)){
echo 'The username field is required';
exit;
}
$query= mysql_query("SELECT username FROM user WHERE username ='$username'"wink;

if (mysql_num_rows($query_run)>=1){

die("The username already exist!"wink;

}else{
$insert = mysql_query("INSERT INTO user SET firstname='$firstname', name='$name', email='$email', password='$password', username='$username', sex='$sex'"wink;
/*
** Storing confirm password is not necessary.

** It should only be used at runtime to verifiy if it matches password field

** Also, a rewrite has been made in the insert query. I used the set clause.
*/
if ($insert){
echo 'You have been successfully registered.';

}else{

echo 'You could not be registered at this time, try again';

}

}



?>

<?php
function set_value($name){
if(!empty($name) && isset($name) && isset($_POST)){
return $_POST[$name];
}
return;
}
?>
<h1>REGISTRATION FORM </h1>

<form action = "register.php" method = "POST">

First Name:<br /><br /><input type = "text" name = "firstname" value = "<?php echo set_value('firstname'); ?>"/><br /><br />
Name:<br /><br /><input type = "text" name = "name" value = "<?php echo set_value('name'); ?>"/><br /><br />
Email:<br /><br /><input type = "text" name = "email" value = "<?php echo set_value('email'); ?>"/><br /><br />
Password:<br /><br /><input type = "password" name = "password" /><br /><br />
Confirm Password:<br /><br /><input type = "password" name = "confirmpassword" /><br /><br />
Username:<br /><br /><input type = "text" name = "username" value = "<?php echo set_value('username'); ?>"/><br /><br />
Sex:<br /><br /><input type = "text" name = "sex" value = "<?php echo set_value('sex'); ?>" /> <br /><br />
<input type = "submit" value = "Register" name="registerBtn"/>


</form>
Re: Post your PHP Problems Here by ProElite: 9:18pm On Oct 04, 2015
Elvisten10:
Hello,

If You need help or request solutions to problems on php, kindly post on this thread.

No matter how simple or complex it is, people are here to help.

Happy Coding smiley

Okies. I will love to join the brains here to improve.
To start with my Wamp Server is mot coming up.
Error msg is that it cant run cos one dll file is missing.
Please help me. Also I will be grateful if U can help with my Window 8 Mně pro mě activation. »̶·Ŧђɑ̤̥̈̊п̥̥̲̣̣̣kƨ̣̣̣̇̇̇̇«̶
Re: Post your PHP Problems Here by rflexii(m): 11:13pm On Oct 06, 2015
xyluz:


hi. You should have been given contact for GTB technician. I'm sure they can help you.

But, if you have a sample code or give the response string sample from a request, maybe someone here can help you.

smiley

Hello my oga,

The GTB technician (One OGIEAMILLA JAMES) have never responded to all the mails i sent to him.

The code am working with on displaying the transaction response is below, please anyone can advise:

<?php
print_r($_request);


if(isset($_POST['mertid'])){
//get the full transaction details as an xml from GTPAY
$xml = file_get_contents('https://ibank.gtbank.com/GTPayService/gettransactionstatus.xml?mertid='.$_POST['mertid'].'&amount='.$_POST['amount'].'&tranxid='.$_POST['tranxid'].'&hash='.$_POST['hash']);


$xml_elements = new SimpleXMLElement($xml);
//create new array to store our transaction detail
$transaction = array();
//loop through the $xml_elements and populate our $transaction array
foreach($xml_elements as $key => $value){ $transaction[$key]=$value; }

$transaction['Amount'];
$transaction['MerchantReference'];
$transaction['MertID'];
$transaction['ResponseCode'];
$transaction['ResponseDescription'];

///////

$amount = $transaction['Amount'];
$m_ref = $transaction['MerchantReference'];
$mertid = $transaction['MertID'];
$res_code = $transaction['ResponseCode'];
$res_desc = $transaction['ResponseDescription'];

echo $amount."<br>";
echo $m_ref."<br>";
echo $mertid."<br>";
echo $res_code;
if($transaction['total'] != "00"wink{


//$sql =mysql_query("INSERT INTO payment_history () VALUES() "wink;


echo "<br> Failed transaction";


}
if($transaction['status'] == "00"wink{ print "Your payment has been approved on our payment processor. Thank you.<br>";

$p_status ="Paid_".$transaction['transaction_id'];
$do_paid = mysql_query("UPDATE orders SET status ='$p_status' WHERE pay_id='$pay_id' "wink;


}
}
//IF PROCEDURES WAS SKIPED
if(!isset($_POST['mertid'])){
print "<br>Invalid transaction on our payment processor.";
}
?>
Re: Post your PHP Problems Here by Adesege(m): 3:37pm On Nov 08, 2015
rflexii:


Hello, though I've never tried gtpay for once. If you can direct me to their doc, I may actually help rectify the problem you are facing.

I've integrated a payment platform before but not gtpay.

Regards
Re: Post your PHP Problems Here by Adesege(m): 3:40pm On Nov 08, 2015
ProElite:


Okies. I will love to join the brains here to improve.
To start with my Wamp Server is mot coming up.
Error msg is that it cant run cos one dll file is missing.
Please help me. Also I will be grateful if U can help with my Window 8 Mně pro mě activation. »̶·Ŧђɑ̤̥̈̊п̥̥̲̣̣̣kƨ̣̣̣̇̇̇̇«̶

Hello, it appears the MSXML dll on your system is not up to date. Forgive me if the file is not MSXML. You can get the name of the file when the error comes up.

Search google with the name as the query but suffix it with download. Download the file and install. Your wampserver should work.

Alternatively, you can download it from Wampserver site.

Hope it helps
Re: Post your PHP Problems Here by okpamenvictory: 8:11pm On Nov 12, 2015
my dreamweaver cs6 is showing an unidentified error, when i am trying to connect to my data base on my local host what will i do
Re: Post your PHP Problems Here by Adesege(m): 9:12pm On Nov 12, 2015
okpamenvictory:
my dreamweaver cs6 is showing an unidentified error, when i am trying to connect to my data base on my local host what will i do

Can you upload a screenshot so I can have a better idea of what u are experiencing
Re: Post your PHP Problems Here by xyluz: 8:25am On Dec 21, 2015
ProElite:


Okies. I will love to join the brains here to improve.
To start with my Wamp Server is mot coming up.
Error msg is that it cant run cos one dll file is missing.
Please help me. Also I will be grateful if U can help with my Window 8 Mně pro mě activation. »̶·Ŧђɑ̤̥̈̊п̥̥̲̣̣̣kƨ̣̣̣̇̇̇̇«̶

If your OS is authentic, then you shouldn't have this problem.

If not, then you might encounter more problems later...
Re: Post your PHP Problems Here by gozmos(m): 9:54am On Dec 21, 2015
PLS I NEED HELP ON THIS... HOW CAN I CREATE DATABASE AND TABLE FOR WORDPRESS IN MY CPANEL AND FETCH D DATA FROM WORDPREESS BY A CLICK OF BUTTON USING PHP
Re: Post your PHP Problems Here by xyluz: 2:57pm On Dec 23, 2015
gozmos:
PLS I NEED HELP ON THIS... HOW CAN I CREATE DATABASE AND TABLE FOR WORDPRESS IN MY CPANEL AND FETCH D DATA FROM WORDPREESS BY A CLICK OF BUTTON USING PHP

Maybe someone else can help you, personally i don't understand what you're saying... if you could explain better, that will be nice... smiley
Re: Post your PHP Problems Here by A7(m): 5:03pm On Dec 23, 2015
gozmos:
PLS I NEED HELP ON THIS... HOW CAN I CREATE DATABASE AND TABLE FOR WORDPRESS IN MY CPANEL AND FETCH D DATA FROM WORDPREESS BY A CLICK OF BUTTON USING PHP

Google "php-mysql crud system", read every page.

It boggles me that you are able to have a webserver and can navigate your way to the cpanel but have no idea about mysql basics like the crud system.
Re: Post your PHP Problems Here by gozmos(m): 5:18pm On Dec 23, 2015
xyluz:


Maybe someone else can help you, personally i don't understand what you're saying... if you could explain better, that will be nice... smiley

ok...I mean getting info from database in my wordpress site by clicking a submit button
Re: Post your PHP Problems Here by xyluz: 3:32pm On Dec 25, 2015
gozmos:


ok...I mean getting info from database in my wordpress site by clicking a submit button

It sounds like you're attempting to create your own php code and make it work within wordpress...

here are a few suggestions that can help:

1. There are some plugins that allow you enter your php code directly into a wordpress page
2. You can create your own plugin (which is a more preferred option, and probably easier)
3. You can create the php codes (pages or application) separately, then have a link on your wordpress site to the application then a redirect back from the application/page/ or code to wordpress

If you need more explanation of help with any of these suggestions, do let me know...

And if i come up with other solutions, i'll update this post.

Happy Holidays!
Re: Post your PHP Problems Here by xyluz: 3:33pm On Dec 25, 2015
A7:


Google "php-mysql crud system", read every page.

It boggles me that you are able to have a webserver and can navigate your way to the cpanel but have no idea about mysql basics like the crud system.

LOL. that sounds so cruel and like a punishment of some sort...

be nice bro... cheesy

He just wants to integrate his code into wordpress...
Re: Post your PHP Problems Here by Tobilastik(m): 6:49pm On Aug 03, 2017
is this thread still active
i am getting this error
i have search all over google, can't still fix it

guys please help me
Fatal error: Uncaught Error: Call to a member function get_result() on boolean in C:\xampp\htdocs\img\login.php:29 Stack trace: #0 {main} thrown in C:\xampp\htdocs\img\login.php on line 29

cc: adesege, elvisten10, spikesC, dhtml18, adewasco2k, 5hyguy
Re: Post your PHP Problems Here by Bolaji21(m): 11:02pm On Aug 03, 2017
Tobilastik:
is this thread still active
i am getting this error
i have search all over google, can't still fix it

guys please help me
Fatal error: Uncaught Error: Call to a member function get_result() on boolean in C:\xampp\htdocs\img\login.php:29 Stack trace: #0 {main} thrown in C:\xampp\htdocs\img\login.php on line 29

cc: adesege, elvisten10, spikesC, dhtml18, adewasco2k, 5hyguy
The bug is originating from your login.php script. You're trying to use get_result() on boolean arguments.
Programmers here might be able to help if you post the content of the login.php, particularly the function get_result() and where you're calling the function
Re: Post your PHP Problems Here by Tobilastik(m): 11:51pm On Aug 03, 2017
Bolaji21:

The bug is originating from your login.php script. You're trying to use get_result() on boolean arguments.
Programmers here might be able to help if you post the content of the login.php, particularly the function get_result() and where you're calling the function

thanks for the reply bro.
i'll post the whole code now
Re: Post your PHP Problems Here by Tobilastik(m): 11:53pm On Aug 03, 2017
<?php

ob_start();
session_start();
require_once 'dbconnect.php';

// if session is set direct to index
if (isset($_SESSION['user'])) {
header("Location: index.php"wink;
exit;
}

if (isset($_POST['btn-login'])) {
$email = $_POST['email'];
$upass = $_POST['pass'];

$password = hash('sha256', $upass); // password hashing using SHA256
$stmt = $conn->prepare("SELECT id, username, password FROM users WHERE email= ?"wink;

if (!$stmt) {
echo "";
}
else {
$stmt->bind_param("ssss", $username, $password);
$stmt->execute();
}

//get result
$res = $stmt->get_result();
$stmt->close();

$row = mysqli_fetch_array($res, MYSQLI_ASSOC);

$count = $res->num_rows;
if ($count == 1 && $row['password'] == $password) {
$_SESSION['user'] = $row['id'];
header("Location: index.php"wink;
} elseif ($count == 1) {
$errMSG = "Bad password";
} else $errMSG = "User not found";
}
?>

<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Login</title>
<link rel="stylesheet" href="assets/css/bootstrap.min.css" type="text/css"/>
<link rel="stylesheet" href="assets/css/style.css" type="text/css"/>
</head>
<body>

<div class="container">


<div id="login-form">
<form method="post" autocomplete="off">

<div class="col-md-12">

<div class="form-group">
<h2 class="">Login:</h2>
</div>

<div class="form-group">
<hr/>
</div>

<?php
if (isset($errMSG)) {

?>
<div class="form-group">
<div class="alert alert-danger">
<span class="glyphicon glyphicon-info-sign"></span> <?php echo $errMSG; ?>
</div>
</div>
<?php
}
?>

<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-envelope"></span></span>
<input type="email" name="email" class="form-control" placeholder="Email" required/>
</div>
</div>

<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
<input type="password" name="pass" class="form-control" placeholder="Password" required/>
</div>
</div>

<div class="form-group">
<hr/>
</div>

<div class="form-group">
<button type="submit" class="btn btn-block btn-primary" name="btn-login">Login</button>
</div>

<div class="form-group">
<hr/>
</div>

<div class="form-group">
<a href="register.php" type="button" class="btn btn-block btn-danger"
name="btn-login">Register</a>
</div>

</div>

</form>
</div>

</div>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script type="text/javascript" src="assets/js/bootstrap.min.js"></script>
</body>
</html>
Re: Post your PHP Problems Here by solutionarena: 3:01am On Aug 04, 2017
Start your reseller based business today
SMS : http://eadesms.com/index.php/resellers
Own you Unique SMS platform , But SMS at lower rates and start reselling and more...
WEB HOSTING : http://cedarhostng.net/reseller.html
You can be your own boss today and work from the comfort of your home
Make an extra source of income
and more....
for further enquires call/whatsapp:08186219002 or 07011123518
Re: Post your PHP Problems Here by adewasco2k(m): 3:31am On Aug 04, 2017
Why not use
$stmt->fetch();
Re: Post your PHP Problems Here by Tobilastik(m): 12:01pm On Aug 04, 2017
adewasco2k:
Why not use
$stmt->fetch();




tried that now

Fatal error: Uncaught Error: Call to a member function get_result() on boolean in C:\xampp\htdocs\img\login.php:29 Stack trace: #0 {main} thrown in C:\xampp\htdocs\img\login.php on line 29
Re: Post your PHP Problems Here by adewasco2k(m): 12:07pm On Aug 04, 2017
Tobilastik:



tried that now

Fatal error: Uncaught Error: Call to a member function get_result() on boolean in C:\xampp\htdocs\img\login.php:29 Stack trace: #0 {main} thrown in C:\xampp\htdocs\img\login.php on line 29

I mean use that instead of the get_result()
Re: Post your PHP Problems Here by Tobilastik(m): 12:22pm On Aug 04, 2017
adewasco2k:


I mean use that instead of the get_result()


yh
this is what It's bringing rather

Fatal error: Uncaught Error: Call to a member function fetch() on boolean in C:\xampp\htdocs\img\login.php:29 Stack trace: #0 {main} thrown in C:\xampp\htdocs\img\login.php on line 29


the get_result just change to fetch()
no difference
Re: Post your PHP Problems Here by Nuel112: 11:35pm On Sep 17, 2017
please does any one have idea of how to create table structure for student exam result broadsheet comprising of the total 1st, 2nd and 3rd term result e.g
name | mathematics | english | physics
john doe | 70 | 80 | 90
Re: Post your PHP Problems Here by xyluz: 4:04pm On Feb 28, 2018
You might want to consider joining staybusy.ng
Re: Post your PHP Problems Here by allaboutobed(m): 4:07pm On Feb 28, 2018
pls how can i connect my blog site to nairaland
Re: Post your PHP Problems Here by mesheal7: 11:08am On Jul 03, 2020
Hi guys,

Not to derail this thread but we're seeking more applicants for a WordPress Writing positon. Read more here https://www.nairaland.com/5929831/urgent-recruitment-wordpress-article-writer
Re: Post your PHP Problems Here by DanieleLorenzo: 6:27am On Sep 29, 2022
k
Re: Post your PHP Problems Here by mesheal7: 5:36pm On Oct 04, 2022
Hello Guys,

Not to derail this thread, but we are seeking a technical writer with some WordPress experience for a virtual position.

Learn more and apply here - https://www.nairaland.com/7366263/hiring-technical-writer-some-wordpress

(1) (2) (3) ... (17) (18) (19) (20) (Reply)

Is Your Blog Powered By Wordpress? / Add More Than One Website Url To Your Twitter Account. / Top Google Searches By Nigerians 2015;Arsenal,Buhari,Diezani Arrest tops d list.

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 64
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.