| | |
error in displaying results.
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved
![]() |
•
•
Join Date: May 2008
Posts: 29
Reputation:
Solved Threads: 0
hi,
this is a snippet of my codes,
<td><a href="editFunction.php?ID=<?php echo $contact['ID']; ?>">update</a></td>
after clicking "update", the ID will be passed to the editFunction.php page.
editFunction.php
why aren't my results displaying out in the respective fields except for ID?
where do i start debugging? Thanks alot.
this is a snippet of my codes,
<td><a href="editFunction.php?ID=<?php echo $contact['ID']; ?>">update</a></td>
after clicking "update", the ID will be passed to the editFunction.php page.
editFunction.php
php Syntax (Toggle Plain Text)
<?php //get variables from previous page $ID = $_GET['ID']; //sql statement to retrieve the commands $sql = "SELECT * FROM contacts WHERE ID LIKE '".$ID."'"; //execute query $result = mysql_query($sql) or die (mysql_error()); //display on table $contact = mysql_num_rows($result); { ?> . ...... <td width="140"><span class="style2">ID : </span></td> <td width="384"> <input name="ID" type="ID" id="ID" value="<? echo $_GET['ID'] ?>" size="50" readonly /> </td> </tr> <tr> <td width="140"><span class="style2">First Name : </span></td> <td width="384"> <input name="firstName" type="text" id="firstName" value="<? echo $contact['firstName'] ?>" size="50" /> </td> </tr> </table> <?php } ?> </body> </html>
where do i start debugging? Thanks alot.
Last edited by peter_budo; Jun 10th, 2008 at 7:27 am. Reason: Keep It Organized - please use [code] tags
because contact contains the number of rows returned by the query.
change:
to
change:
PHP Syntax (Toggle Plain Text)
$contact = mysql_num_rows($result);
to
PHP Syntax (Toggle Plain Text)
$contact = mysql_fetch_assoc($result);
Last edited by kkeith29; Jun 6th, 2008 at 5:06 am.
•
•
Join Date: Jun 2008
Posts: 4
Reputation:
Solved Threads: 1
using this wll help you.
actually mysql_assoc is used to retrive resuts form
actually mysql_assoc is used to retrive resuts form
php Syntax (Toggle Plain Text)
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "Name :{$row['name']} <br>" . "Subject : {$row['subject']} <br>" . "Message : {$row['message']} <br><br>"; }
Last edited by peter_budo; Jun 10th, 2008 at 7:28 am. Reason: Keep It Organized - please use [code] tags
![]() |
Similar Threads
- htttp status 404 error (Java)
- pagination not displaying results (PHP)
- Pagination - not displaying results properly, please help! (PHP)
- Displaying error line number (ASP)
Other Threads in the PHP Forum
- Previous Thread: 2 questions involving scripts, select tag, and loading pages
- Next Thread: Displaying images retrieved from a mysql db using the image path
| Thread Tools | Search this Thread |
action address advanced ajax apache api array auto autoincrement basics beginner broken cakephp class cms code codingproblem combobox cron curl database date datepart display domain dynamic email error errorlog file folder form format forms function functions google head href htaccess html image include includingmysecondfileinthechain interactive ip javascript job joomla js limit link load login malfunctioning masterthesis menu multiple mysql nodes oop outofmemmory paging password paypal pdf php popup problem procedure query ram random reference script search server sessions smarty source space sql stored syntax system table traffic tutorial unicode unset up-to-date upload url validation variable video web webapplications websitecontactform youtube






