Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,726 members, 7,816,986 topics. Date: Friday, 03 May 2024 at 10:14 PM

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

Nairaland Forum / Science/Technology / Webmasters / Post your PHP Problems Here (63325 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) ... (16) (17) (18) (19) (20) (Reply) (Go Down)

Re: Post your PHP Problems Here by Nobody: 11:09am On Mar 13, 2015
Please I need a php mailer. Somebody help. It's URGENT.
Re: Post your PHP Problems Here by Adesege(m): 11:24am On Mar 13, 2015
Google search for PHPMailer.

eiBADAn:
Please I need a php mailer. Somebody help. It's URGENT.
Re: Post your PHP Problems Here by xyluz: 10:03pm On Mar 22, 2015
eiBADAn:
Please I need a php mailer. Somebody help. It's URGENT.

Download here: http://phpmailer.worxware.com/index.php?pg=sf

Tutorial here: http://codeforgeek.com/2014/11/phpmailer-ultimate-tutorial/
Re: Post your PHP Problems Here by OsoDupe(f): 10:56am On Mar 23, 2015
Pls I need an HTML script that will do WYSIWYG(What you see is what you get).
Re: Post your PHP Problems Here by Vijon(m): 10:46pm On Mar 26, 2015
babihouse:


Have you created a site on your dreamweaver? Have you try accessing the PHP page using the url? Try this out.
a site?wht do u
mean
Re: Post your PHP Problems Here by Debeloved87(m): 2:17am On Mar 27, 2015
Adesege:
Next time, it's advisable u post a sample code where u nid help. We can't work on abstract.

Let's create a php function, so we can use it multiple times in our project.

<?php
function truncate($text, $chars =150, $terminator=' …'){
$cutPos = $chars - mb_strlen($terminator);

$boundaryPos = mb_strrpos(mb_substr($text,0, mb_strpos($text,' ', $cutPos)),' ');

return mb_substr($text,0, $boundaryPos ===false? $cutPos : $boundaryPos). $terminator;

}

?>

By default, the text will be truncated by 150chars and terminated by "...".

You can edit the terminator variable to a link and the chars variable.

Feel free to let me know if u encountered any problem.
.
EDIT::

USUAGE:

truncate($text,"300","..."wink

or

truncate($text,"300","<a href='path/to/page'>some text"wink
Thanks bro. i don't understand html so i use compose and then page break check it out lifeboatchristianministry..com tell me what you think about the blog.
Re: Post your PHP Problems Here by Adesege(m): 11:01am On Mar 27, 2015
It's ok but why don't you create a website for it instead of blogger. Wordpress would've been ok.

It isn't optimised for mobile
Debeloved87:
Thanks bro. i don't understand html so i use compose and then page break check it out lifeboatchristianministry..com tell me what you think about the blog.
Re: Post your PHP Problems Here by Adesege(m): 11:02am On Mar 27, 2015
Try using a bootstrap theme for that cos u'll need a combo of html and js

OsoDupe:
Pls I need an HTML script that will do WYSIWYG(What you see is what you get).
Re: Post your PHP Problems Here by Walexwal: 8:35pm On Apr 19, 2015
hello @ adesege....... pls hep me with the error on my site www.agripreneurforum.com . I also sent you a fend request on fb, pls kindly accept. tanks bro
Re: Post your PHP Problems Here by Adesege(m): 8:29am On Apr 20, 2015
Hi! What's your name on FB so i can add you?

The error is explicit. You don't have the said table in your DB.

Walexwal:
hello @ adesege....... pls hep me with the error on my site www.agripreneurforum.com . I also sent you a fend request on fb, pls kindly accept. tanks bro
Re: Post your PHP Problems Here by Adesege(m): 8:33am On Apr 20, 2015
If you are on dreamweaver.

Press Alt + S, then click on New Site to create a site.

Sites on Dreamweaver is just like a defined directory of your server and local folders so you can easily manage them on DW.

Vijon:

a site?wht do u
mean
Re: Post your PHP Problems Here by Walexwal: 10:18am On Apr 20, 2015
Adesege:
Hi! What's your name on FB so i can add you?


The error is explicit. You don't have the said table in your DB.

Re: Post your PHP Problems Here by xyluz: 10:07am On Apr 21, 2015
Walexwal:
hello @ adesege....... pls hep me with the error on my site www.agripreneurforum.com . I also sent you a fend request on fb, pls kindly accept. tanks bro

Table 'u3766634_agripreneur.settings' doesn't exist

Create Table settings in your database.
Re: Post your PHP Problems Here by kentc3: 8:01pm On Apr 25, 2015
Where can i find a tutorial on how to use the jwplayer or video.js
Adesege:
Try to take a look at jplayer or video.js. They are good plugin to achieve ur aim.

Re: Post your PHP Problems Here by A7(m): 10:49pm On Jun 16, 2015
Ajax1211:
Hello, am having issues with php as usual

Am creating an application and in the page where people are to register (i.e register.php page) so that their data can be stored into the database is not working.

Actually every thing works well without any error but the values from the form does not get inserted into the database. here is the code after creating the form

//assuming ive selected the right database and the connection is working

<form action="thankyou.php method="post">
// Please no time to start typing the html form abeg
</form>

$username = $_POST['username']; //putting the username the user typed into the form into a variable
$password = $_POST['password']; //same with the password
$firstnamename = $_POST['firstname'];

$query="INSERT INTO user (userid,username,password,name)
VALUES ('','$username','$password','$firstname')";

mysql_query($query);

Now when i fill the form and click on the submit button, the thankyou.php page runs properly and echoes the values from the form but checking the database,nothing gets inserted.

Now the funny thing is that whenever i type the values directly into the sql statement, it works, let me show you

$query="INSERT INTO user (userid,username,password,name)
VALUES ('','ehis','pass','ehinome')";

When i type in the values i want inserted into the form, it works and gets inserted but when i try using variables that contains the values typed into a form, it does not get inserted.

What could be the problem, ive being on this for days. Thanks

Try:

$query="INSERT INTO user (userid, username, password, name) VALUES ('', '".$username."', '".$password."', '".$firstname."'"wink;


Pay attention, the double quotes must not be outside the parenthesis, that space is for the semicolon.
Re: Post your PHP Problems Here by lifegate007(m): 2:54pm On Jun 17, 2015
Pls how can I integrate live audio streaming to my website
Re: Post your PHP Problems Here by OsoDupe(f): 11:27am On Jun 24, 2015
Pls guys, how do I reduce the number of digits after decimal point?
Re: Post your PHP Problems Here by Nobody: 7:09am On Jun 25, 2015
OsoDupe:
Pls guys, how do I reduce the number of digits after decimal point?
round()
Re: Post your PHP Problems Here by xyluz: 4:51pm On Jul 07, 2015
A7:


Try:

$query="INSERT INTO user (userid, username, password, name) VALUES ('', '".$username."', '".$password."', '".$firstname."'"wink;


Pay attention, the double quotes must not be outside the parenthesis, that space is for the semicolon.

Actually single quote will work, if quote was the problem you should get an error, or a blank page if error reporting was turned off.

Actually, the form you refused to type might be useful.

Here are my suggestions if you haven't solved this issue yet:

Comment out all your processes, do:

echo '<pre>';
print_r($_POST);

this is to check that the form input is actually been passed across.

If all form input is displayed, then go ahead to check your database column names and ensure they all match.

If the form input is not displaying, then we know what the problem is...

check that the method and action are set right. Also check that the name of each field matches the respective name in your process page.
Re: Post your PHP Problems Here by A7(m): 7:23pm On Jul 07, 2015
xyluz:


Actually single quote will work, if quote was the problem you should get an error, or a blank page if error reporting was turned off.

Actually, the form you refused to type might be useful.

Here are my suggestions if you haven't solved this issue yet:

Comment out all your processes, do:

echo '<pre>';
print_r($_POST);

this is to check that the form input is actually been passed across.

If all form input is displayed, then go ahead to check your database column names and ensure they all match.

If the form input is not displaying, then we know what the problem is...

check that the method and action are set right. Also check that the name of each field matches the respective name in your process page.

Yeah i know, my post is a reply to someone who initially posted the codes.

The double quotes am referring to are those enclosed within the parentheses, the questioner is getting errors because he added " after ).

All is well, your explanation will put him on tracks also. Cheers!

1 Like

Re: Post your PHP Problems Here by satmaniac(m): 6:48pm On Sep 22, 2015
I have been following this thread for a while now, learning from others mistakes as well as the GURUS answers to the problems presented herein. The learning experience, is fulfilling I must say. Hence, I thank every contributor of this thread.
I am new to PHP or rather programming in general. I venture into learning how to code after acquiring some video tutorials online and I have been practicing coding whatever I learnt. I must confess that learning how to code is by no means an easy task, as you will make mistakes. Mistakes that a very much identifiable as well as those you can not be able to detect what is amiss in your line of codes.
The latter is what bring me here: I have created a registration form that inserts the values entered in the form fields, into a database successfully. The issue is having created this line of code to check if the username entered in the field 'username ' so as to return the string ' the username already exist' The registration still happened, instead of outputting the string 'username already exist'
Here are the line of codes:
if( mysql_num_rows( $query_run)==0 ) {
$mysql = " INSERT INTO ‘users' VALUES( 'name', 'email', 'password', 'username' ) ";
$mysql_run = mysql_query($mysql);


if(mysql_run){
echo ' you don register';
}



}else{
echo 'The username already exist';
}
Re: Post your PHP Problems Here by Adesege(m): 7:29pm On Sep 22, 2015
satmaniac:
if( mysql_num_rows( $query_run)==0 ) {
$mysql = " INSERT INTO ‘users' VALUES( 'name', 'email', 'password', 'username' ) ";
$mysql_run = mysql_query($mysql);


if(mysql_run){
echo ' you don register';
}



}else{
echo 'The username already exist';
}

The interpretation of your code is:

If username does not exists, then do the following code.

What you ought to test for should be

if( mysql_num_rows( $query_run)>=1 ) {
$mysql = " INSERT INTO ‘users' VALUES( 'name', 'email', 'password', 'username' ) ";
$mysql_run = mysql_query($mysql);


if(mysql_run){
echo ' you don register';
}



}else{
echo 'The username already';
}

You will notice there is 1 there instead of 0


Let me know if you have any issue concerning this.

1 Like

Re: Post your PHP Problems Here by satmaniac(m): 7:39pm On Sep 22, 2015
Adesege:


The interpretation of your code is:

If username does not exists, then do the following code.

What you ought to test for should be

if( mysql_num_rows( $query_run)>=1 ) {
$mysql = " INSERT INTO ‘users' VALUES( 'name', 'email', 'password', 'username' ) ";
$mysql_run = mysql_query($mysql);


if(mysql_run){
echo ' you don register';
}



}else{
echo 'The username already';
}

You will notice there is 1 there instead of 0


Let me know if you have any issue concerning this.



Thanks a million bro, I will try it out and get back to you.
Re: Post your PHP Problems Here by satmaniac(m): 8:13pm On Sep 22, 2015
Adesege:


The interpretation of your code is:

If username does not exists, then do the following code.

What you ought to test for should be

if( mysql_num_rows( $query_run)>=1 ) {
$mysql = " INSERT INTO ‘users' VALUES( 'name', 'email', 'password', 'username' ) ";
$mysql_run = mysql_query($mysql);


if(mysql_run){
echo ' you don register';
}



}else{
echo 'The username already';
}

You will notice there is 1 there instead of 0


Let me know if you have any issue concerning this.

Hi Adesege, I am sorry to bother you with my little troubles, 'cos am back again. I made mistake in my first post about this issue, as I am assessing nairaland using my phone and typing on that phone is not an easy task. I am going to copy the entire codes on my notepad++, as I have try that which you suggested in your reply to my post.
So, here are the codes:




<?php
include 'connect.php';
if (isset($_POST['firstname']) && isset($_POST['name']) && isset($_POST['email']) && isset($_POST['password']) && isset($_POST['confirmpassword']) && isset($_POST['username']) && isset($_POST['sex'])){

$firstname = $_POST['firstname'];
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
$confirmpassword = $_POST['confirmpassword'];
$username = $_POST['username'];
$sex = $_POST['sex'];

}

if (!empty($firstname) && !empty($name) && !empty($email) && !empty($password) && !empty($confirmpassword) && !empty($username)){

if ($password!=$confirmpassword){
echo 'password do not match';

}else{
$query = "SELECT username FROM user WHERE username ='$username'";
$query_run = mysql_query($query);

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

die("The username already exist!"wink;

}else{
$query = "INSERT INTO user VALUES('', '.$firstname.', '.$name.', '.$email.', '.$password.', '.$confirmpassword.', '.$username.', '.$sex.' )";
$query_run = mysql_query($query);
}
if ($query_run){
echo 'You have been successfully registered.';

}else{

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

}


}
}else{
echo 'All fields are required';
}






?>

<h1>REGISTRATION FORM </h1>

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

First Name:<br /><br /><input type = "text" name = "firstname" value = "<?php echo $firstname; ?>"/><br /><br />
Name:<br /><br /><input type = "text" name = "name" value = "<?php echo $name; ?>"/><br /><br />
Email:<br /><br /><input type = "text" name = "email" value = "<?php echo $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 $username; ?>"/><br /><br />
Sex:<br /><br /><input type = "text" name = "sex" value = "<?php echo $sex; ?>" /> <br /><br />
<input type = "submit" value = "Register"/>


</form>
Re: Post your PHP Problems Here by satmaniac(m): 10:09pm On Sep 22, 2015
Adesege:


I will get back to you shortly. I just recieved your message and i will need to study it first.


All right bro.
Re: Post your PHP Problems Here by rflexii(m): 10:52pm On Sep 22, 2015
Hi Fellow Nairalanders, am kinda new to coding and am trying to set up a simple donation page with GTPAY.

I've been able to setup the form, the hash and post to the gateway successful as well as redirect to a page i desire but i need help with the successful page configuration, i have no idea on how to set retrieve the transaction status. Though am also able to save all the parameters to a database on the way to GTPAY for payment so i have informations such tran ID hash cust ID, amount and others stored in a database.

If i need to provide more information please let me know.

Thanks in advance.
Re: Post your PHP Problems Here by xyluz: 9:12am On Sep 29, 2015
rflexii:
Hi Fellow Nairalanders, am kinda new to coding and am trying to set up a simple donation page with GTPAY.

I've been able to setup the form, the hash and post to the gateway successful as well as redirect to a page i desire but i need help with the successful page configuration, i have no idea on how to set retrieve the transaction status. Though am also able to save all the parameters to a database on the way to GTPAY for payment so i have informations such tran ID hash cust ID, amount and others stored in a database.

If i need to provide more information please let me know.

Thanks in advance.

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
Re: Post your PHP Problems Here by afotrick(m): 11:11am On Sep 29, 2015
satmaniac:


Hi Adesege, I am sorry to bother you with my little troubles, 'cos am back again. I made mistake in my first post about this issue, as I am assessing nairaland using my phone and typing on that phone is not an easy task. I am going to copy the entire codes on my notepad++, as I have try that which you suggested in your reply to my post.
So, here are the codes:




<?php
include 'connect.php';
if (isset($_POST['firstname']) && isset($_POST['name']) && isset($_POST['email']) && isset($_POST['password']) && isset($_POST['confirmpassword']) && isset($_POST['username']) && isset($_POST['sex'])){

$firstname = $_POST['firstname'];
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
$confirmpassword = $_POST['confirmpassword'];
$username = $_POST['username'];
$sex = $_POST['sex'];

}

if (!empty($firstname) && !empty($name) && !empty($email) && !empty($password) && !empty($confirmpassword) && !empty($username)){

if ($password!=$confirmpassword){
echo 'password do not match';

}else{
$query = "SELECT username FROM user WHERE username ='$username'";
$query_run = mysql_query($query);

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

die("The username already exist!"wink;

}else{
$query = "INSERT INTO user VALUES('', '.$firstname.', '.$name.', '.$email.', '.$password.', '.$confirmpassword.', '.$username.', '.$sex.' )";
$query_run = mysql_query($query);
}
if ($query_run){
echo 'You have been successfully registered.';

}else{

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

}


}
}else{
echo 'All fields are required';
}






?>

<h1>REGISTRATION FORM </h1>

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

First Name:<br /><br /><input type = "text" name = "firstname" value = "<?php echo $firstname; ?>"/><br /><br />
Name:<br /><br /><input type = "text" name = "name" value = "<?php echo $name; ?>"/><br /><br />
Email:<br /><br /><input type = "text" name = "email" value = "<?php echo $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 $username; ?>"/><br /><br />
Sex:<br /><br /><input type = "text" name = "sex" value = "<?php echo $sex; ?>" /> <br /><br />
<input type = "submit" value = "Register"/>


</form>





Hello ur script is alittle buggy cause of ur use of single and double quotes. Try this instead

$query = "INSERT INTO user VALUES('', '$firstname', '$name', '$email', '$password', '$confirmpassword', '$username',' $sex')";

The mistake u made is pputting . which means concatenation in php between the sql query will only cause problem if u dont break it will double quote like u statted with. If u started with single quote then wen u concatenate. U end each string with single also.
Re: Post your PHP Problems Here by Adesege(m): 2:16pm On Oct 01, 2015
While you may be correct, I've been busy to rewrite the code after I did before I got blocked, so I just edited what he needs and repost from his post.

So I didn't study it deep down. Just corrected the errors he was facing.

Thanks for pointing it out anyway. It will definitely help anyone experiencing such.

Adesege.

afotrick:






Hello ur script is alittle buggy cause of ur use of single and double quotes. Try this instead

$query = "INSERT INTO user VALUES('', '$firstname', '$name', '$email', '$password', '$confirmpassword', '$username',' $sex')";

The mistake u made is pputting . which means concatenation in php between the sql query will only cause problem if u dont break it will double quote like u statted with. If u started with single quote then wen u concatenate. U end each string with single also.
Re: Post your PHP Problems Here by satmaniac(m): 7:07am On Oct 03, 2015
afotrick:






Hello ur script is alittle buggy cause of ur use of single and double quotes. Try this instead

$query = "INSERT INTO user VALUES('', '$firstname', '$name', '$email', '$password', '$confirmpassword', '$username',' $sex')";

The mistake u made is pputting . which means concatenation in php between the sql query will only cause problem if u dont break it will double quote like u statted with. If u started with single quote then wen u concatenate. U end each string with single also.

Thank you very much, afotrick@. Though I have tried what you suggest, the problem still persist. What is baffling me is to my untrained eyes everything seems okay, but I know something is wrong somewhere. I wish I knew what it is. This is about the 6th time I am rewriting this code. I have look at the code line by line, yet couldn't tell what is missing.
Re: Post your PHP Problems Here by satmaniac(m): 10:31am On Oct 03, 2015
Adesege:
While you may be correct, I've been busy to rewrite the code after I did before I got blocked, so I just edited what he needs and repost from his post.

So I didn't study it deep down. Just corrected the errors he was facing.

Thanks for pointing it out anyway. It will definitely help anyone experiencing such.

Adesege.



Welcome back bro, while you are away I have been troubleshooting the codes, by echoing it line by line. I discovered that when I tried echoing the line mysql_num_rows($query_run); I get 0 in return. So, assume there is something wrong with the query I runned i.e. $query = "SELECT `username` FROM `user` WHERE `username` ='satmaniac'";. However hard I look at the query and the rest of the codes, I have not been able to see where I go wrong. Hence, I am counting on you guys to help me out.
This not the first time come across challenges in coding practice but for guys like you I would have given up. Thanks guys.


Welcome back bro,

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

Add More Than One Website Url To Your Twitter Account. / Top Google Searches By Nigerians 2015;Arsenal,Buhari,Diezani Arrest tops d list. / Mark Zuckerberg Eating Pounded Yam And Eforiro (Photo)

(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. 74
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.