Jump to content

tanvirzafar

Members
  • Posts

    14
  • Joined

  • Last visited

Everything posted by tanvirzafar

  1. i am making a simple php discussion forum.But when i intert data into database using form input the output data is not shown in output table.i verified that data is enter into database tables sucessfully.on output page the rows increas as data enter but data is not show on that rows...here is the output page code $host="localhost"; // Host name$username=""; // Mysql username$password=""; // Mysql password$db_name="itinsight"; // Database name$tbl_name="forum_question"; // Table name// Connect to server and select databse.mysql_connect("$host", "$username", "$password")or die("cannot connect");mysql_select_db("$db_name")or die("cannot select DB");$sql="SELECT * FROM $tbl_name ORDER BY id DESC";// OREDER BY id DESC is order result by descending$result=mysql_query($sql);?><table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC"><tr><td width="6%" align="center" bgcolor="#E6E6E6"><strong>#</strong></td><td width="53%" align="center" bgcolor="#E6E6E6"><strong>Topic</strong></td><td width="15%" align="center" bgcolor="#E6E6E6"><strong>Views</strong></td><td width="13%" align="center" bgcolor="#E6E6E6"><strong>Replies</strong></td><td width="13%" align="center" bgcolor="#E6E6E6"><strong>Date/Time</strong></td></tr><?php // Start looping table rowwhile($rows=mysql_fetch_array($result)){?><tr><td bgcolor="#FFFFFF"><? echo $rows['id']; ?></td><td bgcolor="#FFFFFF"><a href="view_topic.php?id=<? echo $rows['id']; ?>"><? echo $rows['topic']; ?></a><BR></td><td align="center" bgcolor="#FFFFFF"><? echo $rows['view']; ?></td><td align="center" bgcolor="#FFFFFF"><? echo $rows['reply']; ?></td><td align="center" bgcolor="#FFFFFF"><? echo $rows['datetime']; ?></td></tr><?php// Exit looping and close connection}mysql_close();?><tr><td colspan="5" align="right" bgcolor="#E6E6E6"><a href="create_topic.php"><strong>Create New Topic</strong> </a></td></tr> here is the code of add new discussion <?php$host="localhost"; // Host name$username=""; // Mysql username$password=""; // Mysql password$db_name="itinsight"; // Database name$tbl_name="forum_question"; // Table name// Connect to server and select database.mysql_connect("$host", "$username", "$password")or die("cannot connect");mysql_select_db("$db_name")or die("cannot select DB");// get data that sent from form$topic=$_POST['topic'];$detail=$_POST['detail'];$name=$_POST['name'];$email=$_POST['email'];$datetime=date("d/m/y h:i:s"); //create date time$sql="INSERT INTO $tbl_name(topic, detail, name, email, datetime)VALUES('$topic', '$detail', '$name', '$email', '$datetime')";$result=mysql_query($sql);if($result){echo "Successful<BR>";echo "<a href=forum.html>View your topic</a>";}else {echo "ERROR";}mysql_close();?>
  2. i try localhost...but it doesnot connect...as the other keyword become dark blue color in notepad++ these mysql_connect and mysql)select_db not become like other....not work???
  3. hello friends i have a problem..i create a page in localhost db.php here is its code <?php$con= mysql_connect("localhost:8080","root","");$db = mysql_select_db('gcuf',$con);?> it is looking fine...but it doesnot work....when i see the page where i include this one it does not show me any error also not connect to database...dont know what's going on...my apache is running on port 8080 tell me its solution please??
  4. no...it does't work.....please check it...
  5. i get input of registratio_id from a forum with post method....i create a record.php file...connenct database and want to show record on student on the basis of registration id....here is the record.phph file...correct this code.. <?php$con = mysql_connect("abc.com","colg","Pta@1","colg");// Check connectionif (mysql_connect_errno()) { echo "Failed to connect to MySQL: " . mysql_connect_error(); }$result = mysql_query($con,"SELECT * FROM fsc_engg_ics WHERE reg_id='".mysql_real_escape_string($con, $_POST["registrationid"])."'"$result = mysql_query($con, $sql);while($row = mysql_fetch_array($result)) { echo $row['f_name'] . " " . $row['l_name']; echo "<br>"; }?>
  6. hello everyone..i have a database...i want users to get their data by entering their registration id into forum... i am working on phpmyadmin..please tell me the code of .php file with query..... any phph expert please help....??
  7. yup...i got it...its all due to you my bro...thanks alot
  8. 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
  9. and what about the rest code..???is it correct??
  10. 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
  11. hello everyone...i have a database of student result...i want to show record of student on its roll number..but there are some fields that i want empty in some cases...i don't want those empty or null fields to show in result or output ....please tell me what is the query for this purpose...
  12. Hello every one i am new to this forum...i have a site with 2 databases one is for WP and 2nd is for student portal...i want to add external pages of 2nd database in WP so that only be accesed by admin by login into WP....is it possible?? if yes them please tell me how i can do this... please reply me ASAP...
×
×
  • Create New...