vaultdweller123 32 Posting Pro
<HTML>

<HEAD>
<TITLE> MY FIRST PHP PAGE </TITLE>
</HEAD>

<BODY
<?php echo "Hello World<br>Hello World
Hello Indiana!"; ?>
</BODY>

</HTML>
vaultdweller123 32 Posting Pro

try running my code so you can understand

vaultdweller123 32 Posting Pro

yeah its better save it as timestamp like his original code, but he wants it to be inserted as yyyy-mm-dd formatted date

vaultdweller123 32 Posting Pro

as i you see your trying to implement a chatting system. Use form submission, instead of onclick events

<?php

if($_POST['btnsubmit']){

$user = $_POST'user'];
$msg = $_POST['msg'];

$con = mysql_connect("localhost","host"); // i hope you can already connect successfully
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

$now = time(); // now

$date = date("Y-m-d",$now);
$time = date("h:i:s",$now);

mysql_select_db("chat",$con);
mysql_query("INSERT INTO chat (Name, Date, Content, Time) VALUES ('".$user."','".$date."','".$msg."','".$time."')"); // i hope you set your date field to data type date, and you set your time field to data type time

mysql_close($con);

}

?>
<form method="post">
User: <input type="text" name="user" /><br />
Message: <textarea name="msg"></textarea><br />
<input type="submit" name="btnsubmit" value="send" />
</form>

but if the scenario really require onclick events then, ill re-design the code, the reason why i abandon your javascript coz im kinda puzzled on what you really tryin to save, like this part

fTxt =("You entered" + ": " + text1 + " " + ":" + dT);

i assume you storing ftxt to string, something like "You entered: hello!:Wed Jun 30 2010 17:18:23 GMT+0800 (Taipei Standard Time)" the Date() in javascript returns a formatted date, unlike PHP date which returns timestamp. and your insert is incorrect

mysql_query("INSERT INTO chat (Name, Date, Content, Time)
VALUES ('fTxt')"); //insert

your inserting ftxt to where? it should be

mysql_query("INSERT INTO chat (Name, Date, Content, Time)
VALUES ('your_name','the_date','your_content','the_time')")// just a sample
vaultdweller123 32 Posting Pro

edit your insert.php to this

<?php
include('config.php');
if (isset($_POST['Signup']))
{
$bday = $_POST['birthday_year']."-".$_POST['Birthday_month']."-".$_POST['Birthday_day'];
$query="insert into date values('','".$bday."')";
$res=mysql_query($query)or die(mysql_error());
echo mysql_affected_rows();
}


?>
vaultdweller123 32 Posting Pro

yes we are selecting only a single field which is any_column no other else, FYI the column's are the fields othe table, maybe you mean return a single row? which is the queried recordset

then limit it with a WHERE clause, like

$sql = mysql_query("SELECT any_column FROM yourtable WHERE id=1")
while($row=mysql_fetch_array($sql)){
echo $row['any_column'];
}
vaultdweller123 32 Posting Pro
$timestamp = 1277851200; // as your example
echo date("h:i:s",$timestamp);
vaultdweller123 32 Posting Pro

i bet theres an error upon including a file, try using include instead of require coz when require encounters error, the script execution will stop and generate a fatal error, try reading this link for a much detail info http://www.w3schools.com/php/php_includes.asp

vaultdweller123 32 Posting Pro

maybe the username doesnt really exist... check your database if the username you inputted is already inserted

vaultdweller123 32 Posting Pro
$refresh = filemtime("stats.php");
$now = time();
$last_update = strtotime(date("m/j/y h:i", $refresh));
$answer = $now - $last_update;

echo "Last refreshed: ".$last_update. "<br/>";
echo"<a href='' onclick='history.go(0)'>Refresh Server Status</a>";
vaultdweller123 32 Posting Pro

you mean OOP? yeah OOP is much better its primary goal is reusability

vaultdweller123 32 Posting Pro

you dont know what your doing bro... check you form if your using get or post

vaultdweller123 32 Posting Pro

theres nothing wrong in the echo, mind if i ask? where did you get $b =$_GET, and where actually the error is pointing?

vaultdweller123 32 Posting Pro

put your code inside $_POST

like

<?
/* Check Username Script */
session_start(); // Start Session

include 'db.php';
// Conver to simple variables
$username = $_POST['username'];
$password = $_POST['password'];

if($_POST['Submit']){ // start of $_POST['Submit']

if((!$username) || (!$password)){
echo "Please enter ALL of the information! <br />";
include 'login_form.html';
exit();
}

// Convert password to md5 hash
$password = md5($password);

// check if the user info validates the db
$sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' AND activated='1'");
$login_check = mysql_num_rows($sql);

if($login_check > 0){
while($row = mysql_fetch_array($sql)){
foreach( $row AS $key => $val ){
$$key = stripslashes( $val );
}
// Register some session variables!
session_register('first_name');
$_SESSION['first_name'] = $first_name;
session_register('last_name');
$_SESSION['last_name'] = $last_name;
session_register('email_address');
$_SESSION['email_address'] = $email_address;
session_register('special_user');
$_SESSION['user_level'] = $user_level;

mysql_query("UPDATE users SET last_login=now() WHERE userid='$userid'");

header("Location: members.php");
}
} else {
echo "You could not be logged in! Either the username and password do not match or you have not validated your membership!<br />
Please try again!<br />";
include 'login_form.html';
}

} // end of $_POST['Submit']

?>
vaultdweller123 32 Posting Pro

first understand the difference about server-side and client-side scripting, server-side request data from server and reloads the page or not if you use ajax, and client side does not need the page to refresh before you can use it, i hope i understand you correctly, you want to use javascript which is a client-side to request data from php which is server-side, like

<script type="text/javascript">
function form_validation(){ 
if(validation==true){ // sample, if validation is true
<?php
// call php
?>
}
}
</script>

that's impossible, coz in order for you to process php you need to request to the server first commonly via form submit and then the page reloads, unless you use ajax, but php can

<?php
if($_GET['sampe']){ // sample
echo "<script>alert('you pressed it')</script>"; // call javascript or even html
}else{
echo "<script>alert('no you dont')</script>";
}
?>
vaultdweller123 32 Posting Pro
echo "<img src='". <?php echo $row['image']?>."' />";

lol of course its a parse error, i assume your inside a php tag coz you use echo, you cant nest another php inside php, instead you do it like this

echo "<img src='".$row['image']."' />";

REMEMBER

if you the code is inside the a php tag, use

echo "<img src='".row['image']."' />";

if not

<img src='<?=$row['image']?>' />
vaultdweller123 32 Posting Pro

the best way to store data is through database

vaultdweller123 32 Posting Pro

where is your log-in form? if you run this directly of course you will encounter an error to enter the field, coz you username and password are empty

vaultdweller123 32 Posting Pro

this is the only thing i know on how to change cursor using CSS, like cursor:pointer

http://www.javascriptkit.com/dhtmltutors/csscursors.shtml

i hope it helps :)

vaultdweller123 32 Posting Pro
$query = mysql_query("SELECT * FROM img WHERE id='$b'");

$row = mysql_fetch_array($query);
echo "<img src='".$content = $row['image']."' />";
vaultdweller123 32 Posting Pro

yeah this is like the header("location: sample.php"); you cant have any output before the session_start() even spaces, newline, tab etc. or else it will generate an error

vaultdweller123 32 Posting Pro

she right a version control system is the answer... see this link
http://bazaar.canonical.com/en/

vaultdweller123 32 Posting Pro
$sql = mysql_query("SELECT any_column FROM yourtable")
while($row=mysql_fetch_array($sql)){
echo $row['any_column'];
}
vaultdweller123 32 Posting Pro

ask the one who made your script as i see you didn't create this, as you dont even know what your doing and how the code works, and also youre just showing us partial part of the code.

okay...to limit the file size you need

$_FILES["file"]["size"] < 50000))

in this example the limit file size is 50kb

if(($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg))

only allows image such as gif and jpeg

vaultdweller123 32 Posting Pro

I admire Indian programmers as they are humble and naturally intelligent, look at Pranav Mistry he's a living proof. If you hate the school.... then so be it, but not the indian people.

vaultdweller123 32 Posting Pro

i recommend you google it for design tutorials

vaultdweller123 32 Posting Pro

with your query, it's not just the 0.3 will be displayed, it will also display the 0.1 and 0.2

your recordset will look something like this

0.1
0.2
0.3

vaultdweller123 32 Posting Pro

i hope you set-up correctly the php.ini for the mail function to work

vaultdweller123 32 Posting Pro

just stick to my original code and you'll do fine

$sql = mysql_query("SELECT name FROM users"); //sample table users
while($row=mysql_fetch_array($sql)){
$a[] = $row['name'];
}
vaultdweller123 32 Posting Pro
<?php

$obj = new Entry(); // instantiate class Entry
$title = $obj->getTitle(); // get array title
$content = ""; 

foreach($title as $val){ // loops through all array 
$content += "<td>".$val."</td>"; 
}

$p->setContent('<table border="1">

<tr><td>Info: '.$u->getInfo().'</td>
'.$content.'</tr></table>');


?>
vaultdweller123 32 Posting Pro

if you fail to plan then you plan to fail

vaultdweller123 32 Posting Pro

haha yeah into mutans if successful else into ghoul just like the "fall out" game

vaultdweller123 32 Posting Pro

then study C or C++ programming language as browsers are created by this

vaultdweller123 32 Posting Pro

haha wat ever dude... but in our country we are very superstitious people, its our culture

vaultdweller123 32 Posting Pro

maybe theres a problem with your database, maybe the data type of field username is int and not varchar, try checking your table fields as i check there is no problem on getting the username.

vaultdweller123 32 Posting Pro

i dont know... but one thing is for sure, we had set correctly the php.ini coz at first i was seeing errors but now no error only a never ending loading upon submit

vaultdweller123 32 Posting Pro

shucksss... this guy so lazy, you asked for help with just making a simple form?

fine.....here ill give you a chance, but do you homework next time kiddo

<html>
<head>
</head>
<body>
<form>
<table>
<tr>
<td>Name</td><td><input type="text" name="name" /></td>
</tr>
<tr>
<td>E-mail</td><td><input type="text" name="email" /></td>
</tr>
<tr>
<td>Phone</td><td><input type="text" name="phone" /></td>
</tr>
<tr>
<td>Address</td><td><input type="text" name="address" /></td>
</tr>
<tr>
<td>Comments</td><td><textarea name="comments"></textarea></td>
</tr>
</table>
<input type="submit" name="btnsubmit" value="submit" />
</form>
</body>
</html>
vaultdweller123 32 Posting Pro

@ivanichi explain the problem clearly so we can help you

vaultdweller123 32 Posting Pro

sorry dude im out of idea, but thats the only possible error i could think of, coz when i examined your code, i noticed that at first it lacking the closing parenthesis of the jfunc() function, the code look like this

<a href="javascript:void(0)" onclick="jfunc('.$row["id"].','.$row["event"].','.$i.'" />Update</a>

so its clear that it will be an error if you dont close your function

so you must append the closing parenthesis of jfunction()

<a href="javascript:void(0)" onclick="jfunc('.$row["id"].','.$row["event"].','.$i.')" />Update</a>
vaultdweller123 32 Posting Pro

why would you change the getTitle() function? its fine already, it just a matter of how you retrieve it

so you retrieve it like this, first lets instantiate you class Entry

<?php
$obj = new Entry(); // instantiate class Entry
$title = $obj->getTitle(); // get array title

foreach($title as $val){ // loops through all array 
echo $val."<br />"; // test result
}
?>
vaultdweller123 32 Posting Pro

you forgot the closing single quote

echo "<script type='text/javascript'>location.href='userReport_Create_Ticket.php;</script>";

to

echo "<script type='text/javascript'>location.href='userReport_Create_Ticket.php';</script>";
vaultdweller123 32 Posting Pro
<!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>Teas of the World!</title>
</head>
<body>
<table>

<?php // Script 10.6 - Teas of the World.php
// This function displays a four cell table.
function tea() {

	$types = array ("Chinese Green", "Japanese Red", "Korean Black", "British White");
	foreach($types as $val){
	echo "<tr><td>".$val."</td></tr>";
	}

}
tea();
?>

</table>
</body>
</html>
vaultdweller123 32 Posting Pro

@madkat3 yeah dude same here, when i hit send, it's just loads a never ending loading

vaultdweller123 32 Posting Pro

first you must study how to upload file http://www.w3schools.com/php/php_file_upload.asp, then save the image path to database then you can retrive them so you can get them to display images using the html img tag

vaultdweller123 32 Posting Pro
<?php

print_r($_GET); 

?>
vaultdweller123 32 Posting Pro

i never tried including a php file using javascript external, if you really want to include a php file user php include() or require() instead

vaultdweller123 32 Posting Pro

hey cscgal... i didn't know your Dani Horowitz, until i thoroughly researched you out of curioisity :D , btw its very nice if daniweb has a notification on thread responses, coz like now i had to open thunderbird, so i can have a notification, coz thunderbird will display a pop-up notification when new email is received, its nice if daniweb can make a notification like facebook :)

jonsca commented: Dani Horowitz is her mild-mannerd alter ego that works as a reporter for The Daily Daniweb. Only after going into a telephone booth and taking off her fake "Dinner With Dani" glasses does she become cscgal! +0
iamthwee commented: The comment below mine is creepy. +0
vaultdweller123 32 Posting Pro

hey zagga i also had problem on sending mail, i cannot send even if i edited my php.ini mail setting i get from thunderbird SMTP setting.

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.googlemail.com
; http://php.net/smtp-port
smtp_port = 465

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = vaultdweller123@gmail
vaultdweller123 32 Posting Pro

so is it fixed?

vaultdweller123 32 Posting Pro

yeah i found it, the jfunction has no closing parenthesis.

change it from

onclick="jfunc('.$row["id"].','.$row["event"].','.$i.'"

to

onclick="jfunc('.$row["id"].','.$row["event"].','.$i.')"