Jeannie109 Posted August 5, 2008 Share Posted August 5, 2008 I am using some script to create a Job List. It works well to Add a new job and List all the jobs and the Search feature works also. But, I can't get the Edit, View and Delete feature to work on this page: http://bernardtransportation.com/jobboard/jobs.php?posting=yes& Everything used to work but now I am getting error messages. Can someone please help? Thank you so much. Quote Link to comment https://forums.phpfreaks.com/topic/118322-problems-w-edit-view-delete-feature-on-sql-program/ Share on other sites More sharing options...
DeanWhitehouse Posted August 5, 2008 Share Posted August 5, 2008 whats the error and the corresponding code Quote Link to comment https://forums.phpfreaks.com/topic/118322-problems-w-edit-view-delete-feature-on-sql-program/#findComment-608900 Share on other sites More sharing options...
DarkPrince2005 Posted August 5, 2008 Share Posted August 5, 2008 what i can recommend is using a hidden text field to store a unique value of each record and then using a form to post the value to the desired page, eg. edit or delete. Here is a sample script I've used before: while ($row = mysql_fetch_array($sql)) { echo " <tr> <td valign='center' align='center' width='300'><form method='post'><input type='hidden' name='product_id' value='$row[product_id]'><img src='$row[product_image]' border='0' alt='$row[product_name]' width='30%'></td> <td> </td> <td valign='top'><input type='hidden' name='product_name' value='$row[product_name]'>$row[product_name]<br><small><input type='hidden' name='product_price' value='$row[product_price]'>R $row[product_price]</small></td> <td> </td> <td valign='center'><input type='image' src='images/details.gif' value='View Details' alt='View Details' onclick=\"this.form.action='product_details.php';\"><br> <input type='image' src='images/placeorder.gif' value='Order' alt='Order' onclick=\"this.form.action='order.php';\"><br> <input type='hidden' name='qty' value='1'> <input type='image' src='images/addtocart.gif' value='Add To Cart' alt='Add To Cart' onclick=\"this.form.action='modcart.php?action=add';\"></form></td> </tr> <tr> <td colspan='5'> </td> </tr> ";}} Quote Link to comment https://forums.phpfreaks.com/topic/118322-problems-w-edit-view-delete-feature-on-sql-program/#findComment-608906 Share on other sites More sharing options...
Jeannie109 Posted August 6, 2008 Author Share Posted August 6, 2008 Here is the URL: http://bernardtransportation.com/jobboard/jobs.php?posting=yes& I had this site on IX Webhosting before and it worked perfectly. Now, I just transfered everything to GoDaddy for webhosting and it is failing. Adding a new record is no problem, so it is finding the database table and data just fine. Here is the error code: Editing Record V E D Error Retrieving Records (9993SQLGET) The whole process runs on the single page, job.php, but this is the code referencing the View Edit Delete portion of the page. if ($post == "") { //THEN WE ARE EDITING A RECORD echo "<table border=1 width=400 align=center><tr><td><DIV CLASS='PAGE_STATUS'>Editing Record</DIV>"; ?> <TABLE width=450 align=center><tr><td><DIV CLASS='PAGE_OPTIONS'> <?php if ($allowview == "yes") { ?><a href="<?php echo $thispage; ?>?id=<?php echo $id; ?>&proc=View&<?php echo $pagevars; ?>">V</a> <?php } //END ALLOWVIEW ?><?php if ($allowedit == "yes") { ?> <a href="<?php echo $thispage; ?>?id=<?php echo $id; ?>&proc=Edit&<?php echo $pagevars; ?>">E</a> <?php } //END ALLOWEDIT ?><?php if ($allowdelete == "yes") { ?> <a href="<?php echo $thispage; ?>?id=<?php echo $id; ?>&proc=Delete&<?php echo $pagevars; ?>">D</a> <?php } //END ALLOWDELETE ?></font><font face="arial" size="2"> </DIV></td> </tr> </table> <? /*-- SECTION: 9993SQLGET --*/ $sql = "SELECT * FROM loads WHERE (id = '$id') $addl_select_crit "; if ($sql_debug_mode==1) { echo "<BR>SQL: $sql<BR>"; } $result = mysql_query($sql,db() ) or die ("Error Retrieving Records (9993SQLGET)"); if ($myrow = mysql_fetch_array($result)) { do { Quote Link to comment https://forums.phpfreaks.com/topic/118322-problems-w-edit-view-delete-feature-on-sql-program/#findComment-610205 Share on other sites More sharing options...
DeanWhitehouse Posted August 6, 2008 Share Posted August 6, 2008 change this or die ("Error Retrieving Records (9993SQLGET)"); to or die (mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/118322-problems-w-edit-view-delete-feature-on-sql-program/#findComment-610213 Share on other sites More sharing options...
Jeannie109 Posted August 6, 2008 Author Share Posted August 6, 2008 Hi Blade, Thank you so much for the suggestion. Now, at least I can see what the problem is, but unfortunately, I do not know how to fix it. This is the error for the "V" View link: Editing Record VED Unknown column 'id' in 'where clause' I am not sure how to fix that. Do I add another field called ID into my Loads table in the database? Also, here is the error message if you click on "V" or View on the main jobs.php Viewing Record Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/content/b/t/g/btginc/html/jobboard/jobs.php on line 921 And, here is the error for the "D" or Delete link from jobs.php Once the box appears and you click on YES: Deleting Record Error Deleting Record (9995SQL) Jeannie Quote Link to comment https://forums.phpfreaks.com/topic/118322-problems-w-edit-view-delete-feature-on-sql-program/#findComment-610261 Share on other sites More sharing options...
DeanWhitehouse Posted August 7, 2008 Share Posted August 7, 2008 this means there is no row called id in the table, make sure it is called id not ID Unknown column 'id' in 'where clause' Quote Link to comment https://forums.phpfreaks.com/topic/118322-problems-w-edit-view-delete-feature-on-sql-program/#findComment-610311 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.