ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
else
{
echo ('<tr><td colspan="3" class="err">Please fill the form above completely.<br /></tr>');
echo ('<tr><td colspan="3" align="center">');
echo ('<input type="submit" value="Edit" />');
echo ('</td>');
echo ('</tr>');
}
if (mysql_query($query1,$connect))
{
echo ('<tr class="err">');
echo ('<td colspan="3" align="left">You are Registered with STM group of colleges.<br /></td>');
echo ('</tr>');
}
?>
Yes I was wondering the same thing when i got my script working but as i am new here i dont know much that how can i add it in the SOLVED. could you please show me? and also about to mark it as helpful...
Marking someone's reply as helpful is located on the right bottom of someone's reply. Click on the text.
To set a thread as solved, you can find this text above the first post: Please Mark this thread as solved if you feel a solution has been provided. Click on the link (blue underlined text) to mark the thread solved.
Hello, I was trying to execute my this file called reg_confrmation.php but it gives me the following error:
"Parse error: parse error in C:\wamp\www\Project\reg_confirmation.php on line 119"
in this file line 119 is the closing curly bracket after the echo. but i dont know what's the problem....Please Help..
<?php
if(isset($_POST['submit']))
{
$sql=mysql_query("SELECT * FROM student WHERE ref_no=('".$_SESSION["refno"]."')");
// Mysql_num_rows is counting table row
$result=mysql_num_rows($sql);
if (!mysql_query($query1 , $connect))
{
die('Error: ' . mysql_error());
}
else
// function to get Auto generated student_id from student table
{
$student_id = mysql_insert_id();
}
}
echo '<p align="center"><h2>Thank you for using Online Course Registration and Result declaration system.</h2> You will get an email confirmation to access your account.</p>';
You have five open braces and six close braces. You will need to look at your code and decide how to modify this so that the braces are properly balanced.
Yep, it is also a good habit to indent your code like this:
if ($something == true){
$i=1;
}
else{
$i=2;
}
if ($...
etc
That way you and others can read your code much better. Nice to see you actually comment your code, a good habit. Lots of programmers forget that and have no clue what they made a few years later.
Last edited by Mark1986; 10-19-2010 at 01:27 AM.
Reason: Just noticed my indents don't show in the forum... Probably yours doesn't either, regard my comment about indent as not said.
I would do that from now and on..Thank you very much...
But I changed my code a bit and it still doesn't work. I want the data to be inserted into the table and it doesn't appear into the database..Following is the code..Please Help!!!!!!
Code:
<?php
include "includes/connection.php"; //coneection to the databse
include "includes/session.php"; //starts a new session
//registering of session variables, ie form name values
session_register('emename');
session_register('emeaddress');
session_register('emepostcode');
session_register('emephoneno');
session_register('emeemail');
//storing of posted values in the session variables
$_SESSION['emename']=$_POST['emename'];
$_SESSION['emeaddress']=$_POST['emeaddress'];
$_SESSION['emepostcode']=$_POST['emepostcode'];
$_SESSION['emephoneno']=$_POST['emephoneno'];
$_SESSION['emeemail']=$_POST['emeemail'];
if(isset($_POST['submit']))
{
$sql=mysql_query("SELECT * FROM student WHERE ref_no=('".$_SESSION["refno"]."')");
// Mysql_num_rows is counting table row
$result=mysql_num_rows($sql);
if($result==1)
{
echo header("location: login.php");
echo 'Applicant already exist!';
}
else
{
//creating the query for the first table student
$query1 = mysql_query("INSERT INTO student (title, ref_no, f_name, middle_name, l_name, date_of_birth, gender, house_no, street_name, country, state, postcode, phone_no, e_mail, ethinicity, disabilty, year_of_enrollement, eme_contact_name, eme_contact_address, eme_contact_postcode, eme_contact_email, eme_contact_phone, password) VALUES('".$_SESSION['title']."', '".$_SESSION['refno']."', '".$_SESSION['firstname']."', '".$_SESSION['middlename']."', '".$_SESSION['lastname']."', '".$_SESSION['dob']."', '".$_SESSION['gender']."', '".$_SESSION['houseno']."', '".$_SESSION['streetname']."', '".$_SESSION['country']."', '".$_SESSION['state']."', '".$_SESSION['postcode']."', '".$_SESSION['phoneno']."', '".$_SESSION['email']."', '".$_SESSION['ethinicity']."', '".$_SESSION['disability']."', '".$_SESSION['yearofenroll']."', '".$_SESSION['emename']."', '".$_SESSION['emeaddress']."', '".$_SESSION['emepostcode']."', '".$_SESSION['emeemail']."', '".$_SESSION['emephoneno']."', '".$_SESSION['password']."')");
}
if (mysql_query($query1 , $connect))
{
echo '<p align="center"><h2>Thank you for using Online Course Registration and Result declaration system.</h2> You will get an email confirmation to access your account.</p>';
$student_id = mysql_insert_id();
}
else
{
die('Error: ' . mysql_error());
}
//else
// function to get Auto generated id form applicant table
//{
//
//}
mysql_close($connect);
}
?>
Thank you very much....
Last edited by naziya486; 10-21-2010 at 08:33 AM.
Reason: Before only put part of the code not the whole coding
Next to that, I see you don't validate user input. Please note that it is a serious security breach. Everything you get from $_POST can be manipulated by anyone. There are lots of guides to help you program safer in that matter.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.