Jump to content

please help in php?/


tanvirzafar

Recommended Posts

hello everybody...i have an error when i submit data into database..please check it out..phph code is<?php$con= mysql_connect('abc.com', 'colg', 'Colg@1');if (!$con) {die('Could not connect: ' . mysql_error());}mysql_select_db(colg);$sql="INSERT INTO fsc_med(reg_id,f_name,l_name,roll_num,t_eng,o_eng,t_urdu,o_urdu,t_phy,o_phy,t_che,o_che,t_bio,o_bio, t_isl_sstd,o_isl_sstd,total_marks,obtain_marks,attendance)VALUES('$_POST[reg_num]','$_POST[firstname]','$_POST[lastname]','$_POST[rollnum]','$_POST[t_english]','$_POST[o_english]','$_POST[t_urdu]','$_POST[o_urdu]','$_POST[t_physics]','$_POST[o_physics]','$_POST[t_chemistry]','$_POST[o_chemistry]','$_POST[t_biology]','$_POST[o_biology]','$_POST[t_isl_sst]','$_POST[o_isl_sst]','$_POST[t_marks]','$_POST[o_t_marks]','$_POST[attdnce]')";if (!mysqli_query($con,$sql)){die('Error: ' . mysqli_error($con));}echo "1 record added";mysqli_close($con);?>data entry form is here http://igoc.com.pk/student_results/r...c_med_123.html

Link to comment
Share on other sites

Database name if string should be within quotesmysql_select_db('colg');If variablemysql_select_db($colg);The database connection should contain host, username, and passwordmysql_connect('abc.com', 'colg', 'Colg@1');Is this correct? or have you used database name for user by mistake.

Link to comment
Share on other sites

Database name if string should be within quotesmysql_select_db('colg');If variablemysql_select_db($colg);The database connection should contain host, username, and passwordmysql_connect('abc.com', 'colg', 'Colg@1');Is this correct? or have you used database name for user by mistake.

mysql_connect("abc.com","colg","Colg@1","colg");

please correct the code mention above..

Link to comment
Share on other sites

No you at look at my post, and you correct your code, as you know more about what is username, hostname, password and database name than I do, or you should, if not! I suggest you look at tutorials on how to connect to MySQL database.

and what about the rest code..???is it correct??

Link to comment
Share on other sites

Again! How could I possibly know I can't test it! I can't tell if column names are correct, I can't tell if posted value are correct or exist to be inserted into database, only YOU can do this.

i checked all things you mention above...all are correct..please submit data into form and then tell me what the ###### such error is??

igoc.com.pk/student_results/register_fsc_med_123.html

Link to comment
Share on other sites

OK! Submitted data and 1 record added apparently, so I guess its fixed, no errors displayed which would have shown if server was setup to display errors, this is my last comment on this topic bye.

yup...i got it...its all due to you my bro...thanks alot :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...