PravinS
-
Posts
459 -
Joined
-
Last visited
-
Days Won
2
Posts posted by PravinS
-
-
You can use below given code to paging
function pagingPN($sql, $page, $limit, $getvars, $class) { if ($page == "") $page = 1; if ($limit == 0) $limit = $this->limit; $tsql = $sql; $result = mysql_query($tsql) or die("Error: ".mysql_errno().":- ".mysql_error()); $total = mysql_num_rows($result); $totnumpages = ceil($total/$limit); if ($offset < 0) $offset = 0; else $offset = ($page - 1) * $limit; $sql = $sql. " limit $offset, $limit"; $res = $this->select_row($sql); $serial_no = ($page - 1) * $limit; if ($total > 0) { $link = "<font face='verdana' size='1'>Page: <strong>".$page."</strong> of <strong>".$totnumpages."</strong> "; if ($page > 1) { $link .= "<a href=".$_SERVER['PHP_SELF']."?page=1$getvars class='".$class."' title='Jump to First Page'><<</a> | "; $prev = $page - 1; $link .= "<a href=".$_SERVER['PHP_SELF']."?page=".$prev."$getvars class='".$class."' title='Goto Previous Page'>Previous</a><span class='".$class."'> | </span>"; } else { $link .= "<span class='".$class."' title='Jump to First Page'><<</span> | <span class='".$class."' title='Goto Previous Page'>Previous | </span>"; } if ($page < $totnumpages) { $next = $page + 1; $link .= "<a href=".$_SERVER['PHP_SELF']."?page=".$next."$getvars class='".$class."' title='Goto Next Page'>Next</a> | "; $link .= "<a href=".$_SERVER['PHP_SELF']."?page=".$totnumpages."$getvars class='".$class."' title='Jump to Last Page'>>></a>"; } else { $link .= "<span class='".$class."' title='Goto Next Page'>Next</span> | <span class='".$class."' title='Jump to Last Page'>>></span>"; } } $retarr["sql"] = $sql; $retarr["records"] = $res; $retarr["serial_no"] = $_no; $retarr["link"] = $link; return $retarr; }
It will give you << | Previous | Next | >> pagination.
Parameters of functions are
$sql = sql query
$page = page number(just use $_REQUEST['page'])
$limit = number of record on one page
$getvars = query string variables, if you want to pass anything
$class = CSS for the links
-
Use this
<?php function format_date($date) { $dtarr = explode("/",$date); return $dtarr[2]."-".$dtarr[1]."-".$dtarr[0]; } echo format_date("24/08/2009"); ?>
-
You have redirected the page, so it is not showing the field values.
Comment this line
//header("location:1.php");
-
$sql="SELECT market_id FROM cashier WHERE (cashier_name='$myusername' and cashier_id='$mypassword')"; $result=mysql_query($sql); $row = mysql_fetch_row($result); echo $row[0]; // will display market_id
-
Try this
$DB_site->query("UPDATE tbluserdetails set logged= 'Y', dtlogged='now()', timeslogged = timeslogged + 1 where username='$username'");
-
Upload on any php supporting server and check. SMTP is not configured on you local machine so u r getting that error
-
May this function will help you
function quote_smart($value)
{
// Stripslashes
if (get_magic_quotes_gpc())
{
$value = stripslashes($value);
}
// Quote if not a number or a numeric string
if (!is_numeric($value))
{
$value = "'" . mysql_real_escape_string($value) . "'";
}
return $value;
}
-
Hi All,
I want to integrate phpbb registration/login with my customised site.
Any idea.
Thanks in advance.
-
You have missed mysql_query() in this function
function countMessages($name) {
$id = getidbyName($name);
$res= mysql_query("SELECT * FROM private_messages WHERE owner_id = '$id'");
$num_rows = mysql_num_rows($res);
return $num_rows;
}
-
User asort(array) function
-
Use:
$quotelist = $_REQUEST['quotelist'];
$p = explode("$$", $quotelist);
for($i=1;$i<count($p);$i = $i++){
//(process info)
}
-
Please share your upload code here
-
Share your iframe code
-
I have used nested function to generate multilevel dynamic menu.
-
Use DATETIME data type for date field. You can INSERT date and time by using NOW() function in sql statement.
-
$newname = dirname(__FILE__).'/uploads/'.$filename;
-
Replace your <form tag with this
<form name="gallery" action="" method="post" enctype="multipart/form-data">
-
Try this PHP code for menu
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.menutd
{
font-family: Verdana;
font-size: 11px;
color:#000000;
background-color:#FFFFFF;
cursor:pointer;
}
.menumainbg
{
background-color:#ECE9D8;
}
.menuhead
{
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:10px;
font-weight:bold;
height:20px;
cursor:pointer;
padding-top:5px;
}
.submenuhead
{
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:10px;
font-weight:bold;
height:20px;
cursor:pointer;
}
.menutr
{
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:10px;
font-weight:none;
background-color:#FFFFFF;
}
.menutr_over
{
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:10px;
font-weight:none;
background-color:#E3E9F1;
cursor:pointer;
}
-->
</style>
<script language="javascript">
function Toggle(id,len)
{
var obj=document.getElementById("adminmgmt"+id);
var visible=(obj.style.display != "none");
if (visible)
obj.style.display="none";
else
obj.style.display="block";
}
</script>
</head>
<body>
<table width="150" border="0" cellspacing="0" cellpadding="0" align="left">
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<?php
$adm_menu = array (1 => "Heading 1", "Heading 2", "Heading 2");
$adm_sub_menu =
array
(
1 =>
array(
1 => array("Google", "http://www.google.com"), array("Yahoo", "http://www.yahoo.com"), array("Rediff", "http://www.rediff.com")),
array(
1 => array("Orkut", "http://www.orkut.com"), array("Times", "http://www.indiatimes.com")),
array(
1 => array("ABC", "http://www.abc.com"))
);
for($mnu1=1;$mnu1<=count($adm_menu);$mnu1++)
{
?>
<tr>
<td align="left" valign="top" class="menumainbg">
<div onclick="javascript: Toggle(<?=$mnu1?>,<?=count($adm_menu)?>);" class="menuhead"><?=$adm_menu[$mnu1]?><?php if (count($adm_sub_menu[$mnu1]) > 0){?> »<?php } ?></div>
<div style="display:none;" id="adminmgmt<?=$mnu1?>">
<table width="100%" border="0" cellspacing="1" cellpadding="5">
<?php
for($mnu2=1;$mnu2<=count($adm_sub_menu[$mnu1]);$mnu2++)
{
?>
<tr>
<td class="menutr" onclick="javascript: window.location='<?=$adm_sub_menu[$mnu1][$mnu2][1]?>';" onmouseover="this.className='menutr_over';" onmouseout="this.className='menutr';"><?=$adm_sub_menu[$mnu1][$mnu2][0]?></td>
</tr>
<?php
}
?>
</table>
</div>
</td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
</table>
</body>
</html>
-
You cannot include .php file in .html page. You can try iframe to call .php page in .html page.
-
Hi,
Try this if you find it helpfull
AS button script
on(release)
{
var fname = _root.main_mc.form_mc.fname;
var sname = _root.main_mc.form_mc.sname;
var phone = _root.main_mc.form_mc.phone;
var mobile = _root.main_mc.form_mc.mobile;
var email = _root.main_mc.form_mc.email;
var errmsg = _root.main_mc.form_mc.errmsg;
errmsg.text = "";
if (fname.text == "")
{
errmsg.text = "Please Enter First Name";
}
else
if (sname.text == "")
{
errmsg.text = "Please Enter Surname";
}
else
if (phone.text == "" && mobile.text == "")
{
errmsg.text = "Please Enter Telephone or Mobile";
}
else
{
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean)
{
if (success) {
errmsg.text = "Form Submitted Successfully";
} else {
errmsg.text = "Please Enter valid email";
}
}
var tempObj:LoadVars = new LoadVars ();
tempObj.fname = fname.text;
tempObj.sname = sname.text;
tempObj.phone = phone.text;
tempObj.mobile = mobile.text;
tempObj.email = email.text;
//tempObj.send("http://locashot/mail.php", "_blank", "POST");
tempObj.sendAndLoad("mail.php", result_lv, "POST");
}
}
PHP mail.php script
First Name : '.trim($_REQUEST['fname']).'<br>
Surname : '.trim($_REQUEST['sname']).'<br>
Telephone : '.trim($_REQUEST['phone']).'<br>
Mobile : '.trim($_REQUEST['mobile']).'<br>
Email : '.trim($_REQUEST['email']).'<br>
-
You didn't fetched the records from the $result.
use
$row = mysql_fetch_row($result);
in if condition.
-
You want like this, try this updated code
<marquee behavior="scroll" scrollamount="5"> <?PHP
$MAXLINKCOUNT = 10; // (* 2) if =10, 5 news items will show
$MAX_DESC_CHARS = 120;
$insideitem = false;
$tag = "";
$title = "";
$description = "";
$link = "";
$linkcount = 0;
function startElement($parser, $name, $attrs) {
global $insideitem, $tag, $title, $description, $link;
if ($insideitem) {
$tag = $name;
} elseif ($name == "ITEM") {
$insideitem = true;
}
}
function endElement($parser, $name)
{
global $insideitem, $tag, $title, $description, $link, $linkcount, $MAXLINKCOUNT, $MAX_DESC_CHARS;
if ($name == "ITEM" && $linkcount <= $MAXLINKCOUNT)
{
if (strlen($description) > $MAX_DESC_CHARS)
{
$description = wordwrap($description, $MAX_DESC_CHARS, "-=CUT OFF HERE=-");
$pos = strpos($description, "-=CUT OFF HERE=-");
$description = trim(substr($description, 0, $pos)) . "...";
}
$description = htmlspecialchars(trim($description));
$description = str_replace(""", """, $description);
printf("<td><b><a href='%s'>%s</a></b></td>", trim($link),htmlspecialchars(trim($title)));
printf("<td>%s</td>",$description);
$title = "";
$description = "";
$link = "";
$insideitem = false;
}
}
function characterData($parser, $data) {
global $insideitem, $tag, $title, $description, $link, $linkcount;
if ($insideitem) {
switch ($tag) {
case "TITLE":
$title .= $data;
break;
case "DESCRIPTIon":
$description .= $data;
break;
case "LINK":
$link .= $data;
$linkcount++;
break;
}
}
}
print('<table cellpadding="3"><tr>');
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
$fp = fopen("http://tvnz.co.nz/content/455321/rss_20_skin.xml", "r")
or die("Error reading rss data.");
while ($data = fread($fp, 2048)) {
xml_parse($xml_parser, $data, feof($fp));
}
fclose($fp);
xml_parser_free($xml_parser);
print('</tr></table>');
?></marquee>
-
Try this code
<?php require_once('Connections/miconexion.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_miconexion, $miconexion); $query_reuniones = "SELECT reuniones.Población, reuniones.Dirección, reuniones.Día, reuniones.Hora, reuniones.Formato, reuniones.Observaciones FROM reuniones WHERE reuniones.Población LIKE '%".trim($_POST['textfield'])."%'"; $reuniones = mysql_query($query_reuniones, $miconexion) or die(mysql_error()); $row_reuniones = mysql_fetch_assoc($reuniones); $totalRows_reuniones = mysql_num_rows($reuniones); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <!-- TemplateBeginEditable name="doctitle" --> <title>resultado de reuniones</title> <!-- TemplateEndEditable --> <style type="text/css"> <!-- .color { background-color: #88D9FF; } .style3 {color: #0000FF; font-family: "Courier New", Courier, monospace; } .style5 { color: #0000FF; font-family: Georgia, "Times New Roman", Times, serif; font-weight: bold; font-size: 14px; } body { background-image: url(logofondoregion.gif); } .style6 {font-size: 24px} .style13 { font-size: 14; font-family: Georgia, "Times New Roman", Times, serif; } .style14 { font-size: 16; font-family: Georgia, "Times New Roman", Times, serif; } .style16 {color: #0000FF} .style18 {font-family: Georgia, "Times New Roman", Times, serif} .style19 {background-color: #88D9FF; font-family: Georgia, "Times New Roman", Times, serif; } .style20 {font-weight: bold; color: #800040;} .style24 { color: #0000FF; font-size: 16px; font-weight: bold; } .style25 {font-size: 16px} --> </style> <!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable --> </head> <body> <p> </p> <div align="center"> <h1 align="center" class="style3 style6 style18">Reuniones en <?php echo $_POST['textfield']; ?></h1> <p align="center" class="style5 style14 style25">Se encontraron <span class="style16"><?php echo $totalRows_reuniones ?></span> reuniones. </p> <table border="1" bordercolor="#88D9FF" bgcolor="#D0EEFB"> <tr background="logofondoregion.gif"> <td class="style19"><div align="center" class="style20">Población</div></td> <td class="style19"><div align="center" class="style20">Dirección</div></td> <td class="style19"><div align="center" class="style20">Día</div></td> <td class="style19"><div align="center" class="style20">Hora</div></td> <td class="style19"><div align="center" class="style20">Formato</div></td> <td class="style19"><div align="center" class="style20">Observaciones</div></td> </tr> <?php $contador = 0; //inicializa el contador fuera del loop ?> <?php if ($totalRows_reuniones > 0) { do { ?> <tr <?php if ($contador++ % 2) {echo 'class="color"';}?>> <td class="style18"><div align="center" class="style20"><?php echo $row_reuniones['Población']; ?></div></td> <td class="style18"><div align="center" class="style20"><?php echo $row_reuniones['Dirección']; ?></div></td> <td class="style18"><div align="center" class="style20"><?php echo $row_reuniones['Día']; ?></div></td> <td class="style18"><div align="center" class="style20"><?php echo $row_reuniones['Hora']; ?></div></td> <td class="style18"><div align="center" class="style20"><?php echo $row_reuniones['Formato']; ?></div></td> <td class="style18"><div align="center" class="style20"><?php echo $row_reuniones['Observaciones']; ?></div></td> </tr> <?php } while ($row_reuniones = mysql_fetch_assoc($reuniones)); } else { ?> <tr> <td colspan="6" class="style18"><div align="center" class="style20">No results found</div></td> </tr> <?php } ?> </table> <p align="center"><span class="style18"><a href="index.php"><span class="style24">Nueva búsqueda</span></a></span></p> </div> <a href="index.php"> </a> </body> </html> <?php mysql_free_result($reuniones); ?>
-
The form is submitting now.
HTML EMAIL
in PHP Coding Help
Posted
You can use mail class. I have attached the mail class file and copy below given code and set the values.
[attachment deleted by admin]