rob200375 Posted March 27, 2006 Share Posted March 27, 2006 hi,I am trying to alter some code to try and understand it, I have a page called amend.php, it shows me all records in my table (agent_details), i can type a record number in and then hit submit and it should go to amend1.php, this iswhere it goes wrong, I have tried to edit the coding and I am getting lost, i get an error saying "Parse error: syntax error, unexpected $end in C:\wamp\www\amend1.php on line 62"here is the amend1.php in full.<html><?PHPsession_start();?><HTML><?php$record = $_POST['record'];echo "Reference Number: $record<br><BR>";$host = "localhost";$login_name = "root";$password = "";//Connecting to MYSQLMySQL_connect("$host","$login_name","$password");//Select the database we want to usemysql_select_db("performance_tracker") or die("Could not find database");$result=mysql_query(" SELECT * FROM agent_details WHERE IDNumber='$record'");$num=mysql_num_rows($result);$i=0;while ($i < $num) {// collect all details for our one reference$description=mysql_result($result,$i,"AgentName");$text2=mysql_result($result,$i,"TeamName");$reference=mysql_result($result,$i,"LucentLogin");$thumb=mysql_result($result,$i,"Date Of Birth");$img1=mysql_result($result,$i,"Sex");$img2=mysql_result($result,$i,"Employment");$f='<font face=Verdana,Arial,Helvetica size=2 Color=Blue';//next we display only the details we want to allow to be changed in a form object// the other details that we won't allow to be changed can be echoed to the screen//note the hidden input line 3 below. We don't need to echo it to the screen?><TABLE WIDTH="100%" CELLPADDING="10" CELLSPACING="0" BORDER="2"> <TR ALIGN="center" VALIGN="top"> <TD ALIGN="center" COLSPAN="1" ROWSPAN="1" BGCOLOR="#F2F2F2"><FORM ACTION="amend2.php" METHOD="post"> <P ALIGN="LEFT"><INPUT TYPE="hidden" NAME="IdNumber" VALUE="<? echo "$record" ?>"> <BR>Agent Name:<BR><TEXTAREA NAME="AgentName" COLS="50" ROWS="4"><? echo "$description"?></TEXTAREA></P><P ALIGN="LEFT">Description:<BR><TEXTAREA NAME="ud_text2" COLS="50" ROWS="4"><? echo "$text2"?></TEXTAREA></P><HR><B> </B><P ALIGN="LEFT">Thumbnail:<BR> <INPUT TYPE="text" NAME="ud_thumb" VALUE="<? echo "$thumb"?>" SIZE="30" MAXLENGTH="50"></P><P ALIGN="LEFT">Image 1 :<BR> <INPUT TYPE="text" NAME="ud_img1" VALUE="<? echo "$img1"?>" SIZE="30" MAXLENGTH="50"></P><P ALIGN="LEFT">Image 2 :<BR> <INPUT TYPE="text" NAME="ud_img2" VALUE="<? echo "$img2"?>" SIZE="30" MAXLENGTH="50"></P><P ALIGN="LEFT">Image 3 :<BR> <INPUT TYPE="text" NAME="ud_img3" VALUE="<? echo "$img3"?>" SIZE="30" MAXLENGTH="50"><BR><BR> </P><P><INPUT TYPE="Submit" VALUE="Update the Record" NAME="Submit"> </P></FORM></TD></TR></TABLE><?++$i;}?>can someone please tell me what I have or havnt done and how to get it show the record in a table, that I have selected on amend.php, as I believe this is what it is trying to get me todo, but i can get it to work.thanks Quote Link to comment https://forums.phpfreaks.com/topic/5958-not-sure-what-i-am-doing/ Share on other sites More sharing options...
swatisonee Posted March 28, 2006 Share Posted March 28, 2006 First find the error . Replace [code]$result=mysql_query(" SELECT * FROM agent_details WHERE IDNumber='$record'");[/code]with[code]$sql= "SELECT * FROM agent_details WHERE IDNumber='$record' ";echo $sql;$result=mysql_query ($sql) or die (mysql_error()); [/code]Another thing [code]$num=mysql_num_rows($result);$i=0;while ($i < $num) {[/code]If $i=0, then 0 will always be less than $num , correct ? Quote Link to comment https://forums.phpfreaks.com/topic/5958-not-sure-what-i-am-doing/#findComment-21458 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.