| | |
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 |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube






