another logic:
1- make a one iframe in main page.
2- on header of main page put a timer of 20 minute.
3- When 20 min finishes close iframe using js and prompt user that time is over.
Check this steps might be help u.
another logic:
1- make a one iframe in main page.
2- on header of main page put a timer of 20 minute.
3- When 20 min finishes close iframe using js and prompt user that time is over.
Check this steps might be help u.
Same code for multiple textbox and checkbox.
<!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>
<script language="javascript">
function enableMe(fld)
{
eval('window.document.formx.'+fld+'.disabled = !window.document.formx.'+fld+'CB'+'.checked');
}
</script>
</head>
<body>
<form name="formx" action="" method="post" >
<table>
<tr>
<td>
<input type="text" disabled="disabled" name="firstbox" value="First box" >
</td>
<td width="235">
<input type="checkbox" value="1" name="firstboxCB" onClick="enableMe('firstbox');" />
</td>
</tr>
<tr>
<td>
<input type="text" disabled="disabled" name="secondbox" value="Second box" >
</td>
<td width="235">
<input type="checkbox" value="1" name="secondboxCB" onClick="enableMe('secondbox');" />
</td>
</tr>
</table>
</form>
</body>
</html>
This is example.
function highlight($str,$searchText)
{
return (eregi_replace($searchText, "<span
class='highlight'>$searchText</span>", $str));
}
$str = 'This is beautiful';
$searchText = 'is';
echo highlight($str,$searchText);
Hope this helps.
You can do this by htaccess file also.
below is the code when user open non existed file then he is redirected to error.php.
ErrorDocument 404 http://localhost/project/error.php
I have make this code.
comment in code will guide you..
Hope it helps...
<script type="text/javascript">
function GetIst(sourcedt)
{
var d = new Date()
var gmtHours = (-d.getTimezoneOffset()/60);
var origDate = new Date(sourcedt);
var futDate = origDate.getTime();
futDate += (gmtHours*60*60*1000);
origDate.setTime(futDate);
//--- below line will generate date string.. you can set your date format
//--- this link will help you to create your desire format : http://www.w3schools.com/jsref/jsref_obj_date.asp
var dt = origDate.getDate()+ "-" +(origDate.getMonth()+1)+ "-" +origDate.getFullYear()+ " " + origDate.getHours()+":"+origDate.getMinutes()+":"+origDate.getSeconds() ;
document.write(dt);
}
</script>
GMT Date : July 27, 2010 10:00:00
<br />
Convet to local : <?php echo "<script language=javascript>GetIst('July 27, 2010 10:00:00');</script>";
// here 'July 27, 2010 10:00:00' will be your dunamic date $row["sch_time"]
// you have to create this format from $row["sch_time"] to work in JS
?>
Here i have posted code which will work for 5second, you can set urs.
<html>
<head>
<script type="text/javascript">
function timedMsg()
{
var t=setTimeout("redirect()",5000);
}
function redirect()
{
alert('5 seconds is completed!');
window.location.href='nextpage.php';
}
</script>
</head>
<body onload="timedMsg()">
exam paper.
</body>
</html>
This is a php function to avoid sql injection.
<?
function cleanQuery($string)
{
if(get_magic_quotes_gpc()) // prevents duplicate backslashes
{
$string = stripslashes($string);
}
if(phpversion() >= '4.3.0')
{
$string = mysql_real_escape_string($string);
}
else
{
$string = mysql_escape_string($string);
}
return $string;
}
// if you are using form data, use the function like this:
if (isset($_POST['itemID'])) $itemID = cleanQuery($_POST['itemID']);
// you can also filter the data as part of your query:
$sql = "SELECT * FROM items WHERE itemID = '". cleanQuery($itemID)."'";
?>
where is starting of form tag in your last code?
and where is $count in line no. 28?
Post complete page and also error you are getting....
Just consider beta form as a login page.
On home page is session is not set user is redirect to key enter page.
If key is properly inserted you can set session and redirect back to home page.
You can achieve your requirement by checking and setting simple php sessions.
This code shows simple example of query result and array.
<?
$q="select * from user";
$res = mysql_query($q);
while($sar = mysql_fetch_assoc($res))
{
$arr[]['username'] = $sar['username'];
}
echo '<pre>';
print_r($arr);
?>
This below code is working at my end.
<script type="text/javascript">
function GetIst() {
var d = new Date()
var gmtHours = -d.getTimezoneOffset();
document.write(+ gmtHours);
}
</script>
<?
$reminder ="<script language=javascript>GetIst();</script>";
echo $reminder;
?>
Bcz your code is merging of js and php.
Just refer this :
But whenever a php page is loaded all code inside php tag is executed at server side and when page comes at browser js will be executed in client side.
So when we have to merge JS and PHP then take in mind above hint.
Tell exact goal of your post with date example so we can help !!!!
Yeah this works... thnx almostbob and all..
Okay.. gr8
Okay. try above code i have posted.
Here when form submitted you can have $max_no_img value.
max_no_img is text field in this code you can make it hidden.
Try this code.
<script type="text/javascript">
function increment(){
if(!max_no_img)
{ var max_no_img = document.getElementById('max_no_img').value; }
max_no_img++;
document.getElementById('max_no_img').value = max_no_img;
return max_no_img;
}
</script>
<?
$max_no_img=2; // Maximum number of images value to be set here
echo "<form method=post action=addimgck.php enctype='multipart/form-data'>
<input type=\"text\" value=\"".$max_no_img."\" name=\"max_no_img\" id=\"max_no_img\" />";
echo "<table border='0' width='400' cellspacing='0' cellpadding='0' align=center>";
for($i=1; $i<=$max_no_img; $i++){
echo "<tr><td>Images $i</td><td>
<input type=file name='images[]' class='bginput'></td></tr>";
}?>
<a href='#' onclick='increment();'>attach more files</a>
<?php
echo "<tr><td colspan=2 align=center><input type=submit value='Add Image'></td></tr>";
echo "</form> </table>";
?>
JS code runs on client side.
If you will give href on "attach more files" that means page is changed. And you can not have count of click.
you can add file element dynamically using JS.
Below code will give number of click without href.
<script type="text/javascript">
var max_no_img = 0;
function increment(){
max_no_img++;
alert('max_no_img : '+max_no_img);
return max_no_img;
}
</script>
<?
$max_no_img=2; // Maximum number of images value to be set here
echo "<form method=post action=addimgck.php enctype='multipart/form-data'>";
echo "<table border='0' width='400' cellspacing='0' cellpadding='0' align=center>";
for($i=1; $i<=$max_no_img; $i++){
echo "<tr><td>Images $i</td><td>
<input type=file name='images[]' class='bginput'></td></tr>";
}?>
<a href='#' onclick='increment();'>attach more files</a>
<?php
echo "<tr><td colspan=2 align=center><input type=submit value='Add Image'></td></tr>";
echo "</form> </table>";
?>
I have one link in my webpage where user can call to other skype user.
<a href="skype:skype_username?call">Call me</a>
But when user have not skype installed in their pc one notification popup is coming.
Is there any way in any manner i can detect is skype is installed or not? so i can give custom message to install skype.
It might be some issue in query to passing 'Option Two'.
Also check database with having value 'Option Two'.
Images must be stored some where to get it display.
It may be 3 case:
- you can save image in folder
- in database
- you can directly use external link like http://www.abc.jpf as a image src.
Post this two values what you are getting at line # 107.
-> $_SERVER
-> $real_dir;
This is the simplest way to create doc file.
This code is for example using users table.
<?
$fp = fopen("export.doc", 'w+');
$sql = "select * from users";
$res = mysql_query($sql);
while($sar = mysql_fetch_assoc($res))
{
$str = "<br />Username : ".$sar['username']." Password : ".$sar['password'];
fwrite($fp, $str);
}
fclose($fp);
?>
Because your select query is not returning credits field.
Change $drawquery as below.
$drawquery = mysql_query("SELECT id, credits FROM userstats WHERE `todaysurfed`>=250 AND DATEDIFF(NOW(),`wondaily`) > 30 OR `wondaily`='0000-00-00' ORDER BY rand() LIMIT 3");
change line no. 26 to:
$result = mysql_query($sql) or die(mysql_error());
Check whats wrong in $sql.
1) add new field as sendEmailAlert.make a simple php page where you check if difference between expired_date and current date is greater than 15 and sendEmailAlert is zero.
2) if is is greater than 15 then send a email to that username about expiration and make sendEmailAlert field to one.
3) once you have php page ready place that php code in cronjob of server.
Cronjob is a scheduler which will execute your php page by itself in background.
Based on your argument php execution will be repeated that frequently.
e.g. you can specify to run php page daily, or weekly, or monthly based on your requirement.
This code will generate your requires output.
<?
$reminder ="300"; // 5 minutes * 60 seconds (to convert to seconds)
$timefromreminder = date('h:i:s', strtotime("-$reminder seconds"));
// this will give 5 minutes minus the current time
//but what i am looking for is to be able to do this
$event_start_time = '11:45:00';
echo '<br />Start Time : '.date('H:i:s',strtotime($event_start_time));
echo '<br />End Time : '.date('H:i:s', strtotime("-$reminder seconds",strtotime($event_start_time)));
exit;
?>
What you exactly like to do?
You want to add new record in database?
By java script you can show dynamic row and by clicking on submit button, using php you can insert that values in database.
Thank u so much tesuji.
Actually i have never used function, procedure, view kind of stuff in mysql, But love to learn.
I have posted your code in sql window of phpmyadmin but it is throwing error.
Can u elaborate more on functions.
What is exact problem? This form is not working?
SigninSubmit function is not defined in current code.
Add this code to submit form.
<script language="javascript">
function SigninSubmit()
{
document.SigninForm.submit();
}
</script>
You can also use below code to pass both id and price in single form.
<?
$item2 = $_REQUEST['item2'];
$ar = explode('###',$item2);
$itemId = $ar[0];
$itemPrice = $ar[1];
?>
<select name="item2" id="item2" onchange="getPrice(this.id)" />
<option value="">Select medicine</option>
<?php
$sql = "SELECT ItemID, ItemName, Price FROM itemavail ORDER BY ItemName";
$rs = mysql_query($sql);
while($row = mysql_fetch_array($rs))
{
echo "<option value=\"".$row['ItemID'].'###'.$row['Price']."\">".$row['ItemName']."</option> \n ";
}
?>
</select>
You can pass ItemID as a value.
After form submitted you can again fire select query to fetch price of selected item from ItemID.
<select name="item2" id="item2" onchange="getPrice(this.id)" />
<option value="">Select medicine</option>
<?php
$sql = "SELECT ItemID, ItemName, Price FROM itemavail ORDER BY ItemName";
$rs = mysql_query($sql);
while($row = mysql_fetch_array($rs))
{
echo "<option value=\"".$row['ItemID']."\">".$row['ItemName']."</option> \n ";
}
?>
</select>
code with BR.
<?php
$msg = "Message from Platform Form<br />";
$msg .= "Aspirant's Background:\t $_POST[aspirant_background]<br />";
$msg .= "Aspirant's Position:\t $_POST[aspirant_email3]<br />";
$msg .= "Aspirant's Offer:\t $_POST[aspirant_email2]<br />";
$msg .= "Aspirant's email:\t $_POST[aspirant_email]<br />";
$fname = $_FILES['aspirant_photo']['name'];
$uploadfile = 'upload/'.$fname;
if(move_uploaded_file($_FILES['aspirant_photo']['tmp_name'], $uploadfile))
{
$imgUrl = '<img src="'.'http://www.youngvotersinitiative.org/'.$uploadfile.'">';
$msg .= "Aspirant's Photo:\t ".$imgUrl."<br />";
}
$to = "walterosadebe@youngvotersinitiative.org";
$subject = "Platform Submission";
$mailheaders = "From: Young Voters Initiative <> \n";
$mailheaders .= "Reply-To: $_POST[sender_email]\n\n";
$mailheaders .= "MIME-Version:1.0\nContent-type:text/html; charset=ISO-8859-1\n";
mail($to, $subject, $msg, $mailheaders);
?>
create new folder at root named : 'upload'.
Place below code for mail sending.
<?php
$msg = "Message from Platform Form\n";
$msg .= "Aspirant's Background:\t$_POST[aspirant_background]\n";
$msg .= "Aspirant's Position:\t$_POST[aspirant_email3]\n";
$msg .= "Aspirant's Offer:\t$_POST[aspirant_email2]\n";
$msg .= "Aspirant's email:\t$_POST[aspirant_email]\n";
$fname = $_FILES['aspirant_photo']['name'];
$uploadfile = 'upload/'.$fname;
if(move_uploaded_file($_FILES['aspirant_photo']['tmp_name'], $uploadfile))
{
$imgUrl = '<img src="'.'http://www.youngvotersinitiative.org/'.$uploadfile.'">';
$msg .= "Aspirant's Photo:\t".$imgUrl."\n";
}
$to = "walterosadebe@youngvotersinitiative.org";
$subject = "Platform Submission";
$mailheaders = "From: Young Voters Initiative <> \n";
$mailheaders .= "Reply-To: $_POST[sender_email]\n\n";
mail($to, $subject, $msg, $mailheaders);
?>
let me know ur output.
Try this:
<?php
/*
$Id: contact_us.php 1739 2007-12-20 00:52:16Z hpdl $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
require('includes/application_top.php');
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONTACT_US);
$error = false;
if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {
$name = tep_db_prepare_input($HTTP_POST_VARS['name']);
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);
// BOF Super Contact us enhancement 1.41
$order_id = tep_db_prepare_input($HTTP_POST_VARS['order_id']);
if ($order_id <> NULL){
$enquiry = 'Order ID: ' . $order_id . "\n\n" . tep_db_prepare_input($HTTP_POST_VARS['enquiry']);
}
// BOF Super Contact us enhancement 1.41
$order_id = tep_db_prepare_input($HTTP_POST_VARS['order_id']);
if ($order_id <> NULL){
$enquiry = 'Order ID: ' . $order_id . "\n\n" . tep_db_prepare_input($HTTP_POST_VARS['enquiry']);
}else{
$enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);
}
$emailsubject = tep_db_prepare_input($HTTP_POST_VARS['reason']) . ' ' . EMAIL_SUBJECT;
if (tep_validate_email($email_address))
tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $emailsubject, $enquiry, $name, $email_address);
if (CONTACT_US_LIST !=''){
$send_to_array=explode("," ,CONTACT_US_LIST);
preg_match('/\<[^>]+\>/', $send_to_array[$send_to], $send_email_array);
$send_to_email= eregi_replace (">", "", $send_email_array[0]);
$send_to_email= eregi_replace ("<", "", $send_to_email);
tep_mail(preg_replace('/\<[^*]*/', '', $send_to_array[$send_to]), $send_to_email, $emailsubject, $enquiry, $name, $email_address);
}else{
//tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success'));
tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=send'));
}
}
// EOF Super Contact us enhancement 1.41
require('az_template/template_main.php');
$template = new azTmpl;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<?php
$template->az_tmpl_css();
$template->az_tmpl_js();
?>
</head>
<body>
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<?php
$template->az_tmpl_header();
$template->az_tmpl_content_top();
?>
<!-- body //-->
<?php echo tep_draw_form('contact_us', tep_href_link(FILENAME_CONTACT_US, 'action=send')); ?>
<table border="0" width="100%" …
Hope this code will help..
u can modify it as per ur requirement.
<HTML>
<HEAD>Try</HEAD>
<BODY>
<form NAME="myForm">
<input TYPE="button" VALUE="Line Break" ONCLICK="insertString('</br>')">
<input TYPE="button" VALUE="H1 Tag" ONCLICK="insertString('<h1></h1>')">
<br>
<textarea NAME="myTextArea" ROWS="5" COLS="100"></textarea>
</form>
</body>
</html>
<script LANGUAGE="Javascript">
var globalCursorPos=0; // global variabe to keep track of where the cursor was
function caret(node) {
//node.focus();
/* without node.focus() IE will returns -1 when focus is not on node */
if(node.selectionStart) return node.selectionStart;
else if(!document.selection) return 0;
var c = "\001";
var sel = document.selection.createRange();
var dul = sel.duplicate();
var len = 0;
dul.moveToElementText(node);
sel.text = c;
len = (dul.text.indexOf(c));
sel.moveStart('character',-1);
sel.text = "";
return len;
}
function setCursorPos() {
globalCursorPos = caret(myForm.myTextArea);
}
function insertString(stringToInsert) {
setCursorPos();
var firstPart = myForm.myTextArea.value.substring(0, globalCursorPos);
var secondPart = myForm.myTextArea.value.substring(globalCursorPos, myForm.myTextArea.value.length);
myForm.myTextArea.value = firstPart + stringToInsert + secondPart;
}
</SCRIPT>
I found this code..
test at your end.
function postit($host, $url, $postdata) {
$fp = pfsockopen ( $host, 80, &$errno, &$errstr, 60 );
if( ! $fp ) return "$errstr ($errno)<br>\n";
fputs ($fp,"POST $url HTTP/1.1\n");
fputs ($fp,"Host: $host\n");
fputs ($fp,"User-Agent: Autopost demonstration script\n");
fputs ($fp,"Accept: */*\n");
fputs ($fp,"Content-type: application/x-www-form-urlencoded\n");
fputs ($fp,"Content-length: ".strlen($postdata)."\n\n");
fputs ($fp,"$postdata\n\n");
$output = "";
while( !feof( $fp ) ) {
$output .= fgets( $fp, 1024);
}
fclose ( $fp);
return ($output);
}
$host = "www.abc.com";
$url = "page.php";
$postdata = "name=john";
postit($host, $url, $postdata);
I have made a code...
Try this.
Hope this is what you want.
<!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>
</head>
<body>
<? if(isset($_REQUEST['submit']))
{
$col1 = $_REQUEST['col1'];
$col2 = $_REQUEST['col2'];
$col3 = $_REQUEST['col3'];
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><?=$col1[0]?> <?=$col1[1]?></td>
</tr>
<tr>
<td><?=$col2[0]?> <?=$col2[1]?></td>
</tr>
<tr>
<td><?=$col3[0]?> <?=$col3[1]?></td>
</tr>
</table>
<? } else { ?>
<form id="form1" name="form1" method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Column 1</td>
<td>Column 2</td>
<td>Column 3</td>
</tr>
<tr>
<td><input type="text" name="col1[]" /></td>
<td><input type="text" name="col2[]" /></td>
<td><input type="text" name="col3[]" /></td>
</tr>
<tr>
<td><input type="text" name="col1[]" /></td>
<td><input type="text" name="col2[]" /></td>
<td><input type="text" name="col3[]" /></td>
</tr>
<tr>
<td> </td>
<td><input name="submit" type="submit" /></td>
<td> </td>
</tr>
</table>
</form>
<? } ?>
</body>
</html>
Okay...mark thread as solved.
You can not use class in this way.
you have to create object of class and then have to assign class member values.
class NewGo
{
public $username;
public $password;
}
$obj = new NewGo();
$obj->username = $uid;
$obj->password = $pwd;
get it..
Here problem is with UL LI.
Try this:
<?php
include 'config.php';
$page="";
$sql="select * from cms where sub_page='$page' order by pid";
$result = mysql_query($sql);
echo mysql_error();
while($row = mysql_fetch_row($result))
{
echo "<li class='pureCssMenui0'><a class='pureCssMenui0' href=content.php?a=$row[0]><span>$row[1]</span></a><![endif]><!--[if lte IE 6]><table><tr><td><![endif]-->";
$spage=$row[1];
$sq="SELECT *
FROM cms
WHERE sub_page = '$spage'
ORDER BY pid ";
$res = mysql_query($sq);
echo mysql_error();
echo "<ul class='pureCssMenum'>";
while($dropdown = mysql_fetch_row($res))
{
echo "<li class='pureCssMenui0'><a class='pureCssMenui' href=content.php?a=$dropdown[0]>$dropdown[1]</a></li>";
}
echo "</ul>";
}
?>
lets this page is index.php.
<?
include 'connection.php';
define ("MAX_SIZE","1000");
function getExtension($str)
{
$i = strrpos($str,".");
if (!$i)
{
return "";
}
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}
$errors=0;
if(isset($_POST['Submit']))
{
$image=$_FILES['image']['name'];
if ($image)
{
$filename = stripslashes($_FILES['image']['name']);
$extension = getExtension($filename);
$extension = strtolower($extension);
if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif"))
{
echo '<h1>Unknown extension!</h1>';
$errors=1;
}
else
{
$size=filesize($_FILES['image']['tmp_name']);
$s=round($size/1024);
if ($size > MAX_SIZE*1024)
{
echo '<h1>You have exceeded the size limit!</h1>';
$errors=1;
}
$image_name=$filename;
$newname="images/".$image_name;
$copied = copy($_FILES['image']['tmp_name'], $newname);
if (!$copied)
{
echo '<h1>Copy unsuccessfull!</h1>';
$errors=1;
}
}
}
if(!$data)
{
die('Could not enter data:' . mysql_error());
}
}
if(isset($_POST['Submit']) && !$errors)
{
echo "<h1>File Uploaded Successfully! Try again!</h1>";
$sql="INSERT INTO images(id,name,size,path,comments) VALUES (null,'$filename','$s','$newname','data is not present')";
$data=mysql_query($sql);
$LastId = mysql_insert_id();
header("Location:index.php?id=".$LastId);
exit;
}
if(isset($_GET['id']))
{
$q= " select * from images where id=".$_GET['id'];
$rs = mysql_query($q);
$sar = mysql_fetch_array($rs);
$imgPath = $sar['path'];
}
?>
<html>
<body>
<form name="newad" action="test.php" method="POST" enctype="multipart/form-data">
<p>Upload Image: <input type="file" name="image"><br>
<font size="1">Click browse to upload a local file</font><br>
<br>
<input type="submit" name="Submit" value="View Image">
<? if($imgPath!=''){?><img src="<?=$imgPath;?>"><? } ?>
</form>
</body>
</html>
then there is missing with your $con. Execute any simple insert query just for testing connection and check that insert works or not?
At line no 61:
echo $sql="INSERT INTO images(name,size,path,comments) VALUES ('$filename','$s','$newname','data is not present')"; exit;
Check this echo query in sql window. Does it works successfully?
$qry = "UPDATE Staff SET FirstName = '$fname', LastName = '$lname', Login = '$login', Password = '".md5($password)."' WHERE LastName = '$lname' AND FirstName = '$fname'";
$result = @mysql_query($qry);
I thing there is blank space before Password = ' and ".md5
This causes issue.
where did you place this code? rather post complete page.
What error you are getting??
Check this code.
<?
function timeAfter($timestamp, $granularity=2, $format='Y-m-d H:i:s'){
$difference = $timestamp - time();
if($difference < 0) return '0 seconds ago'; // if difference is lower than zero check server offset
elseif($difference < 864000){ // if difference is over 10 days show normal time form
$periods = array('week' => 604800,'day' => 86400,'hr' => 3600,'min' => 60,'sec' => 1);
$output = '';
foreach($periods as $key => $value){
if($difference >= $value){
$time = round($difference / $value);
$difference %= $value;
$output .= ($output ? ' ' : '').$time.' ';
$output .= (($time > 1 && $key == 'day') ? $key.'s' : $key);
$granularity--;
}
if($granularity == 0) break;
}
return ($output ? $output : '0 seconds').' after';
}
else return date($format, $timestamp);
}
$ts = strtotime('2010-07-15 7:00:00');
echo timeAfter($ts,4);
exit;
?>
Your php code sequence is not correct.
<?php
$mysql_host = "mysql9.000webhost.com";
$mysql_database = "a2354076_db";
$mysql_user = "username";
$mysql_password = "*********";
$con = mysql_connect("$mysql_host","$mysql_user","$mysql_password");
if (!$con) { die('Could not connect: ' . mysql_error()); }
mysql_select_db("$mysql_database", $con);
if (isset($_REQUEST['name']))
{
$email = $_REQUEST['email'] ;
$pass = $_REQUEST['pass'] ;
$country = $_REQUEST['country'] ;
$name = $_REQUEST['name'] ;
$q= 'INSERT INTO users (username , pass , email ,country )VALUES ($name, $pass, $email, $country)';
mysql_query($q);
header("Location:success.php");
exit;
}
echo "<form method='post' action='db.php'>
name: <input name='email' type='text' /><br />
password: <input name='pass' type='password' /><br />
country:<input type="text" name="country" /><br />
email :<input type="text" name="email" /><br />
<input type='submit' />
</form>";
?>
Check this.
For displaying it back you should use mysql db.
So once image is uploaded on server i.e. @ echo "<h1>File Uploaded Successfully! Try again!</h1>";
$newname will be saved in table.
After that using select query that $newname will be fetched and shown in image src tag.