guruparthi
-
Posts
14 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by guruparthi
-
-
The below 2 steps areworked in backend process for store values into database
- First need to create database in your Phpmyadmin
- create table with required field
Then in php
- make form with required field
- make connection with database using PHP
- get values from form and store it to database
-
Try this
<?php mysql_connect('localhost','root','') or die('Cannot connect mysql server'); mysql_select_db('new') or die('cannot connect database');?>
This is the concept for connect database.
-
You can also done this in ajax with jquery. If you want to send message without page refresh, the better idea is ajax.
On form submit, you post values to another page. for sample
$.ajax({url:'next.php',data:$('#form').serialize(),type:'POST',success:function(a) { $('.res').html('Your msg send successfull'); }});
Otherwise you redirect next page if the mail is send successfully. For exmple,
$mail=mail($to,$subject,$msg,$header); if($mail) { header('location:next.php'); }
-
In my point of view, your query is not looking good. So please add die(mysql_error()) at end of query.
ie,
$query=mysql_query("your query") or die(mysql_error());
-
This is the correct format for send mail in PHP
<?php $to='example@gmail.com'; $subject='Send mail using php'; $message='This mail send using php'; $headers='From: guruparthiban19@gmail.com'; $mail=mail($to,$subject,$message,$headers); if($mail) { echo'Mail send successfully'; } else { echo'Mail is not send'; } ?>
Your email address may be wrong. The email id should be lowercase. It may be cause errors.
-
First of all you need to store all urls of your website to mysql database. Then retrieve from db and make RSS feed dynamically using PHP.
Example Code is
<?phpheader("Content-Type: application/rss+xml; charset=ISO-8859-1");echo '<?xml version="1.0" encoding="UTF-8" ?><?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel> <title>Phponwebsites</title> <link>http://www.phponwebsites.com</link> <description>Phponwebsites about php related topics like .htaccess, robots.txt, mysql, jquery, ajax, js and also php for php developers</description>'; $connection = @mysql_connect('localhost', 'root', '') or die(mysql_error()); mysql_select_db('new') or die (mysql_error()); $query = "SELECT * FROM links order by id desc"; $rss = mysql_query($query) or die (mysql_error()); $ImgPath='http://2.bp.blogspot.com/-vwl4cGyoDPM/UqKklyTGE-I/AAAAAAAAALI/iOipE7-PhAM/s1600/logo5.png'; while($row=mysql_fetch_array($rss)){ echo ' <item> <title>'.$row['name'].'</title> <link>'.$row['link'].'</link> <content:encoded> <![CDATA[<p align="left"> <a href="'.$row['link'].'"><img style="background-image: none; " border="0" src="'.$ImgPath.'" /> </a></p>]]> </content:encoded> <description>'.$row['description'].'</description></item>'; } echo '</channel></rss>';?>
-
If you can get details from mysql, then you can easily make daily stats.
-
Try this
<?php
$mail=$_POST['mail'];
$pwd=$_POST['password'];
$q=mysql_query("select * from user where mail='".$mail."' and password='".$pwd."' ") or die(mysql_error());
$res=mysql_fetch_row($q);
if($res)
{
header('location:home.php');
}
else
{
echo'not valid';
}
Reference: http://www.phponwebsites.com/2014/07/php-mysql-login-validation.html
-
Alter table table_name change old_name new_name datatype(length)
For ex,
Alter table user change mail email varchar(50)
Reference: http://www.phponwebsites.com/2013/12/mysql-change-column-name.html
-
You need to learn only few things first in pagination concept.
1. You get page no.
2. find limit, number of results shows on each page and starting point
3. total number of records
4. then make query and display result
-
<?php$result = mysql_query("SELECT * FROM files ORDER BY RAND() LIMIT 10") or die(mysql_error());if (!$result) die("1st query failed"); // test for valid $resultwhile ($row = mysql_fetch_array($result)) { $result2 = mysql_query("SELECT * FROM members WHERE id = $row[subject] ") or die(mysql_error()); if (!$result2) die("2nd query failed"); // test for valid $result2 while ($row2 = mysql_fetch_array($result2)) { if ($row2['public'] == 1) { $img = 'uploads/' . $row['subject'] . '/' . $row['filename']; echo '<img src="' . $img . '" style="border:0px;"/>'; } }}?>
Reference: http://www.phponwebsites.com/2014/03/php-mysql-fetch-array.html
-
First you get value from your db.
The query is
$q=mysql_query("select * from tbl_name where id=$id") or die(mysql_error());$res=mysql_fetch_assoc($q);
Then in your text box
<input type="text" name="name" value="<?php echo $res['username']">
You need to add
error_reporting('E_ALL ^ E_NOTICE');
at first of your file to avoid errors.
- 1
-
pagination
in PHP
You will try this to get current page value in php
$page=$_GET['pages'];if($page==''){ $page=1; $start=0;}else { $start=$per_page*($page-1)}
Reference: http://www.phponwebsites.com/2014/05/php-mysql-ajax-jquery-pagination.html
php forgot password email
in PHP
Posted · Edited by Ingolme
Advertising
The concept is below: