Try to use <br>
;
<?php
echo "Hello World!!"."<br>"."Im new to php";//sample 1
echo "Hello World!! <br> Im new to php";//sample 2
?>
Try to use <br>
;
<?php
echo "Hello World!!"."<br>"."Im new to php";//sample 1
echo "Hello World!! <br> Im new to php";//sample 2
?>
Try this code. I modified it.
<?php
echo "<h1>Register</h1>";
$submit = $_POST["submit"];
$usernamenew = strip_tags($_POST["usernamenew"]);
$passwordnew = md5(strip_tags($_POST["passwordnew"]));
$repeatpasswordnew = md5(strip_tags($_POST["repeatpasswordnew"]));
$email = $_POST["email"];
$date = date(Y-m-d);
if ($_POST['submit']=="Create Account")
{
//check for existence
if ($usernamenew=="" || $passwordnew=="" || $repeatpasswordnew=="" || $email=="")
{
echo "Please fill in all the blanks!";
}
else
{
if ($passwordnew == $repeatpasswordnew)
{
// Open database
echo "Success!";
$connect = mysql_connect("localhost","root","");
if (!$connect)
{
die("Could not connect!");
}
else
{
mysql_select_db("users");
$sql = "INSERT INTO `users` (username,password,email,date) VALUES ('$usernamenew','$passwordnew','$email','$date')";
mysql_query("$sql");
}
}
else
{
echo "The passwords you entered do not match!";
}
}
}
?>
<html>
<form action="register.php" method="POST">
NEW USERNAME:<input type="text" name="usernamenew" maxlength="25" /><br>
NEW PASSWORD:<input type="password" name="passwordnew" maxlength="25" /><br>
REPEAT NEW PASSWORD:<input type="password" name="repeatpasswordnew" maxlength="25" /><br>
EMAIL ADDRESS:<input type="text" name="email" maxlength=64 /><br>
<input type="submit" name="submit" value="Create Account" />
</form>
</html>
That is cross browser issue. Checking below link may help you.
I think ditty was right. There should be "Where" in the query so that the script can identify the record you want to update.
Something like this.
<?php
// Connects to your Database
mysql_connect("localhost", "john", "nicho123") or die(mysql_error());
mysql_select_db("john_321") or die(mysql_error());
echo "connected to database";
$update = "UPDATE auth SET auth.realuser = '$_POST[realuser]' where usermail='$_POST[usermail]'";
$update = "UPDATE auth SET auth.realpass = '$_POST[realpass]' where usermail='$_POST[usermail]'";
mysql_query($update);
?>
oopppssss. Sorry. I forgot to include the folder ^^
$images_folder = "images/";
<td><img src="<?php echo $images_folder.$image;?>"></td>
Try this Joe.
Just find out the difference of the 3 query. ^^,
$Find_Query1 = mysql_query("SELECT * FROM pages WHERE title='$Search' AND keywords LIKE '%$Search%' AND description LIKE '%$Search%'"); // between
// or
$Find_Query1 = mysql_query("SELECT * FROM pages WHERE title='$Search' AND keywords LIKE '$Search%' AND description LIKE '$Search%'"); //starts with
// or
$Find_Query1 = mysql_query("SELECT * FROM pages WHERE title='$Search' AND keywords LIKE '%$Search' AND description LIKE '$%Search'"); //end with
This issue was solve. I just have some mistake on the path of my file.
Thanks pritaeas. you solve my problem. ^^,
Try this:
<td><img src="<?php echo $image;?>"></td>
Is there anything wrong with my task scheduler? It doesn't work
Try this query.
<?php
$query = mysql_query("SELECT * from table_name");
while($result = mysql_fetch_array($query))
{
echo "<a href='some_page.php?id=$result[id]'>".$result['name']."</a>"."<br/>";
}
?>
and here's the code for some_page.php
<?php
$id = $_GET['id'];
$query = mysql_query("select * from tbl_name where id='".$id."'");
while($result = mysql_fetch_array($query))
{
echo $result['id']."<br>";
echo $result['name']."<br>";
echo $result['lname']."<br>";
echo $result['pass']."<br>";
echo $result['zip']."<br>";
echo $result['customer_type']."<br>"; // although "customer type" should have "_" and the database right?
}
?>
Where the clients (name,id, etc.) information stored? I mean are you used mysql database?
Hi to all again,
Can anyone one help me with this? The scenario goes like this.
I have this PHP script:
<?php
$to = "email_address_here";
$subject = "SAMPLE AUTOMATIC MAIL";
$body = "Hi to Every one. Please help me with this ^^,";
if (mail($to, $subject, $body))
{
echo("<p>Message successfully sent!</p>");
echo "Sent to: $to";
}
?>
Above code works fine. When I type the "http://server/folder/phpfile.php" at my explorer address bar, the message was successfully sent.
I try to use windows schedule task to run this automatically, but it only open the phpfile.php itself. By the way, my I'm using Windows Server 2003 OS.
Note: I don't want to use cron for this activity.
Thanks in advance guys.
this should work
<?php
include "sql_connect.php";
$text = $_POST['text'];
$test = mysql_query("SELECT * FROM Movies WHERE Mov_ID = '".$text."'");
?>
Try this:
1. Why don't create a page where your sql connection is coded. For example, create a php script and save it as connection.php and here is the code for it.
<?php
error_reporting(0);
$connection = Mysql_connect('localhost','root','');
mysql_select_db('test'); //test is the name of your database.
?>
Now analyze the modification that I made in this code.
<?PHP
error_reporting(0);
session_start();
include 'connection.php' // call the connection for your database.
$critiria=$_POST['critiria'];
$search=$_POST['search'];
if($critiria=="epitheto_iatrou"){
$sql=mysql_query("SELECT * FROM doctors WHERE epitheto='$critiria'");
while($newarray=mysql_fetch_array($sql)){
echo "Epitheto: $newarray['epitheto'] <br>";
echo "Eidikotita: $newarray['eidikotita']<br>";
echo "Misthos: $newarray['misthos']<br>";
}
}
else if($critiria=="eidikotita"){
$sql=mysql_query("SELECT * FROM doctors WHERE eidikotita='$eidikotita'");
while ($newarray=mysql_fetch_array($sql)){
echo "Epitheto: $newarray['epitheto'] <br>";
echo "Eidikotita: $newarray['eidikotita']<br>";
echo "Misthos: $newarray['misthos']<br>";
}
}
else if($critiria=="epitheto_patient"){
$sql=mysql_query("SELECT * FROM patients WHERE epitheto='$critiria'");
while ($newarray=mysql_fetch_array($sql)){
echo "Epitheto: $newarray['epitheto'] <br>";
echo "Onoma: $newarray['onoma']<br>";
echo "id_doctor: $newarray['id_doctor']<br>";
echo "date: $newarray['date']<br>";
echo "poli: $newarray['poli']<br>";
}
}
else if ($critiria=="poli")
{
$sql=mysql_query("SELECT * FROM patients WHERE poli='$critiria'");
while ($newarray=mysql_fetch_array($sql)){
echo "Epitheto: $newarray['epitheto'] <br>";
echo "Onoma: $newarray['onoma']<br>";
echo "id_doctor: $newarray['id_doctor']<br>";
echo "date: $newarray['date']<br>";
echo "poli: $newarray['poli']<br>";
}
}
else if ($critiria=="date"){
$sql=mysql_query("SELECT * FROM patients WHERE date='$critiria'");
while ($newarray=mysql_fetch_array($sql)){
echo "Epitheto: $newarray['epitheto'] <br>";
echo "Onoma: $newarray['onoma']<br>";
echo "id_doctor: $newarray['id_doctor']<br>";
echo "date: $newarray['date']<br>";
echo "poli: $newarray['poli']<br>";
}
}
?>
The above query should work, but if not, try to eliminate "else" on "else if". Just make
if($critiria=="something")
{
//blah blah blah
}
if($critiria=="something")
{
//blah blah blah
}
Hi again to all,
Can anyone know how to do this?
<?php
// let say the time now is 06:00 PM
$time = Date('h:i A');
$time1 = strftime('$time'); // I know it is wrong coz the output of this code is $time only. I just include this for you to have an specific idea ^^
// now i want to display $time1 as 1800
?>
Thanks in advance for your help.
Ahm ok. So I'll try to elaborate as much as I can ^^,
The situation goes like this.
I have a script where I can save records (stock number, item, hours before expire,). Now for example, I save the record at exactly 4:00 PM and then in the "hours before expire", I input 4 hrs. So I want to have a script that send a mail stating the this item is expire at exactly 8:00 PM.
Hi to All,
Can anyone show me a sample alarm script using php or javascript? The alarm was base on the record at the database. I mean, for example I have records that have overdue, the user is the one who state the overdue. For example, the user input his overdue is after one 1 he saves the record, so I want the system will give an alarm after 1 hour.
Thanks in advance.
I modify the code again. ^^,
<?php
$username = 'username';
$password = 'password';
if (isset($_POST["username"]) && isset($_POST["password"]))
{
// open text.txt for reading
$file = fopen("text.txt","r");
while (!feof($file))
{
$data = explode ("|", fgets($file));
}
if(isset($data[0]) && isset($data[1]))
{
if (trim($data[0]) == trim($_POST["username"]) && trim($data[1]) == trim($_POST["password"]))
{
$login = true;
$_SESSION["login"] = $login;
$_SESSION["username"] = $_POST["username"];
//$_SESSION['type'] = $data[3];
echo "Thank you for logging in, in 5 seconds you will be taken to the homepage.";
header("refresh: 5; private.php");
break;
}
else
{
// something you want if the log in failed.
}
}
fclose($file);
}
?>
I'm not so sure, but try this:
<?php
$username = 'username';
$password = 'password';
if (isset($_POST["username"]) && isset($_POST["password"]))
{
// open text.txt for reading
$file = fopen("text.txt","r");
while (!feof($file))
{
$data = explode ("|", fgets($file));
if(isset($data[0]) && isset($data[1])){
if (trim($data[0]) == trim($_POST["username"]) && trim($data[1]) == trim($_POST["password"]))
{
$login = true;
$_SESSION["login"] = $login;
$_SESSION["username"] = $_POST["username"];
//$_SESSION['type'] = $data[3];
echo "Thank you for logging in, in 5 seconds you will be taken to the homepage.";
header("refresh: 5; private.php");
break;
}
else
{
// something you want if the log in failed.
}
}
}
fclose($file);
}
?>
just want to make a sample ^^,
<?php
echo "sample";
?>
thanks again pritaeas
I think you can save the image on the server drives but not on the database itself. The path of the image is the one that saves in the database.
try this:
<select name="con_st" >
<?php
$sql = "SELECT distinct con_stat FROM contst";
// $rs = mysql_query($sql); // you can eliminate this code
while($row = mysql_fetch_array($sql)) // change $rs into $sql
{
echo "<option value='$row[con_stat]'>".$row."</option>";
}
?>
</select>
how about the system accept is exactly until 4:00 PM only. but if the time is 4:01 PM, the system doest save the record?
and another one, how can i write the code that appear as same as pritaeas code?
thanks a lot guys.
Try this.
<?PHP
$query=mysql_query("SELECT * FROM call_details WHERE !ISNULL(call_project_name)");
echo "<select name='detailr'>";
while($row=mysql_fetch_array($query))
{
echo "<option value='$row[call_id]'>".$row."</option>";
}
echo "</select>";
?>
Thanks for the reply guys. I really appreciated that.
Hi to all.
Can anyone help me with this? I have PHP script the save record. But I want to have time limit in saving the record. When the local time is 4:00 PM, the user can no longer save their record. Please help.
Here's my code;
if($_POST=="Save")
{
$name = $_POST;
$age = $_POST;
$addr = $_POST;
//if time is beyond 4:00 PM this code is enable ------ this what i want.
mysql_query("insert into file(name,age,address) values ('$name','$age','$addr')");
echo "Record Save";
//if time is exceed 4:00 PM this code is enable and disable the saving codes
echo "Can not save record. Time limit has expire"
}
I format your code. try this.
$conn = mysql_connect ("localhost", "xxxx", "xxxx");
mysql_select_db ("wkho_TTX", $conn);
$query = "SELECT * FROM venues";
$result = mysql_query($query) or die(mysql_error());
$num=mysql_numrows($result); //change this to $num=mysql_num_rows($result);
$i=0;
while ($i < $num)
{
$option = mysql_result($result,$i,'vname'); // i dont know waht is vname?
echo "<option value='$2option'>".$1option."</option>"; // notice the (") and (')
$i++;
}
Try this. Lets say we save this php as savedb.php
<?php
//database connection here
echo "<form action='savedb.php' method='post'>";
echo "<input type='text' name='empid'>"."<br/>";
echo "<input type='text' name='password'>"."<br/>"; //or use <input type='password'>
echo "<input type='text' name='address'>"."<br/>";
echo "<input type='text' name='first_name'>"."<br/>";
echo "<input type='text' name='last_name'>"."<br/>";
echo "<input type='submit' name='submit' value='Save'>";
echo "</form>";
if($_POST['submit']=="Save")
{
$empid = $_POST['empid'];
$pass = $_POST['password'];
$addr = $_POST['address'];
$fname = $_POST['first_name'];
$lname = $_POST['last_name'];
mysql_query("INSERT INTO table_name (emp_id,emp_password,emp_address,emp_fname,emp_lname) values ('$empid','$pass','$addr','$fname','$lname')");
}
?>
You must stored the path of the image file into mysql database. Then try to query the file path using PHP.
Try this query
$insert = mysql_query("INSERT INTO mystuff.pageser (name,content) VALUES('$content_name','$content') where user_id = '$colname_Recordset1'"));
<form action='page.php' method='post'>
<input type='checkbox' name='chk' value='value1'> ANY VALUE 1 <br>
<input type='checkbox' name='chk' value='value2'> ANY VALUE 2 <br>
<input type='checkbox' name='chk' value='value3'> ANY VALUE 3 <br>
<input type='checkbox' name='chk' value='value4'> ANY VALUE 4 <br>
<input type='submit' name='submit' value='Get Value'>
</form>
page.php codes:
<?php
$value = $_POST['chk'];
echo $value;
?>
$query_Directory_update = "update directory set Sno=<?php $Directory_update; ?>where Sno='$_GET[updateid]'";
try to modified the above code into this:
$query_Directory_update = mysql_query("update directory set directory.Sno='$Directory_update[Sno]' where Sno='".$_GET[updateid]."'");
I think you don't have any PHP error with that query, but I'm not so sure if the query successfully update the record, since I don't know what is the exact variable from your database and PHP code itself.
<?php
$subject_set=mysql_query("select * from subjects", $connection);
confirm_query($subject_set);
while ($subject = mysql_fetch_array($subject_set)) {
echo "<li><a href=\"content.php?subj=" . urlencode($subject["id"]) ."\">{$subject["menu_name"]}</a></li>";
$id=$subject['id'];} // read below note
$page_set=mysql_query("SELECT * FROM pages WHERE subject_id = '".$id."'", $connection);
confirm_query($page_set);
echo "<ul class=\"pages\">";
while ($page = mysql_fetch_array($page_set)) {
echo "<li><a href=\"content.php?page=" . urlencode($page["id"]) ."\">{$page["menu_name"]}</a></li>";}
echo "</ul>";
?>
note: I modified you code and include the $id=$subject['id'];
inside the while loop in your first query. Try it.
I'm not so sure but try this:
<?php
error_reporting(0);
session_start();
$connection = Mysql_connect('localhost','root','password');
mysql_select_db('name_of_database');
$subject_set=mysql_query("select * from subjects");
while($subject = mysql_fetch_array($subject_set))
{
$id=$subject['id'];
}
$page_set=mysql_query("SELECT * FROM pages WHERE subject_id = '".$id."'");
echo "<ul class='pages'>";
while ($page = mysql_fetch_array($page_set))
{
echo "<li><a href='yourpage.php?id=$page[id]'>".$page['menuname']."</a>"."</li>";
}
echo "</ul>";
?>
Can you show us your code?
Try to analyze this example.
$query = mysql_query("select * from tbl_name");
while($result=mysql_fetch_array($query))
{
$name = $result;
$age = $result;
$address = $result;
$gender = $result;
}
// now display the result into textbox to allow the user to edit
echo "<form action='save.php' method='post'>";
echo "<input type='text' name='name' value='$name'>";
echo "<input type='text' name='age' value='$age'>";
echo "<input type='text' name='address' value='$address'>";
echo "<input type='text' name='gender' value='$gender'>";
echo "<input type='submit' name='submit' value='Save Changes'>";
echo "</form>";
Try to put the $subject into a variable. For example, $id=$subject;
then make a query like this:
$page_set=mysql_query("SELECT * FROM pages WHERE subject_id='".$id."'");
just pay attention (') and (").
Hi to all,
Can anyone show me a sample php code on how to get the client's Mother Board Serial Number?
Thanks.
Just press F5.
Or if not possible on PHP, maybe in Visual Basic 6.0.
If using 2 programming language for the research.
Thanks.
Hi every one,
Can anyone help me on the problem? The scenario goes like this.
I have lots of files (.pdf, .doc, and .xls) stored on my sever. I want the user to access the files. I mean, they can open it for some review purposes but I don't want them to save it on their local machine. Is the possible?
Here's my sample codes:
<?php
echo "<a href='folder/file.pdf'>"."Sample Files"."</a>";
?>
I want that when they click the Sample Files link, the file.pdf will open so they can read it, but i don't want them to save it on their local machines.
Please help. Thanks in advance
I agree with borzoi.
If you are lazy, then it is impossible for you to learn PHP and MySQL. PHP is not an easy programming language specially to the lazy person like you. Try to help your self first... You can search over the internet to have basic knowledge in PHP.