mysql_num_rows(): error needs to work in 24 hrs mac :S thanks in advance

Thread Solved

Join Date: Oct 2009
Posts: 3
Reputation: Maged Media is an unknown quantity at this point 
Solved Threads: 0
Maged Media Maged Media is offline Offline
Newbie Poster

mysql_num_rows(): error needs to work in 24 hrs mac :S thanks in advance

 
0
  #1
Oct 31st, 2009
hello plz i need help with this urgently as it i supposed to be used tomorrow
i get this error from the following script
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/aybasuco/public_html/MySQL-Formmaker/lib/db_index.inc.php on line 42


thanks in advance for your valiable time

  1. <?php
  2. # MySQL-Formmaker 2002 by Kristof De Jaeger
  3. # swentel@realize.be
  4. # index page displaying databases.
  5.  
  6. $error = "";
  7. $dbname = "";
  8. $description = "";
  9. /*
  10.   POST checking from new db insert if $_POST is set, otherwhise just form
  11.   if everything is ok, redirect to table overview (which will be empty)
  12.   otherwise, display errors etc
  13. */
  14. if (isset($_POST["dbsubmit"]))
  15. {
  16. $dbname = trim($_POST["newdbname"]);
  17. if (empty($dbname)) $error .= translate("error1")."<br />";
  18. if (eregi("[^[:alpha:]_]+",$dbname)) $error .= translate("error3")."<br />";
  19. if (strlen($dbname) > 64) $error .= translate("error2")."<br />";
  20. $found = in_array_cin($dbname);
  21. if ($found == 1) $error .= translate("error5")."<br />";
  22. $query = "select db_name from formmaker_db where db_name = '".mq_add($dbname)."'";
  23. $result = mysql_query($query);
  24. $row = mysql_fetch_object($result);
  25. if ($row) $error .= translate("error4")."<br />";
  26. $description = $_POST["description"];
  27.  
  28. /* no errors -> insert & redirect to table index */
  29. if ($error == false)
  30. {
  31. $query = "insert into formmaker_db values ('','$dbname','".nl2br(mq_add($_POST['description']))."','0')";
  32. mysql_query($query);
  33. $dbid = mysql_insert_id();
  34. header("location: index.php?formaction=table_index&dbid=$dbid");
  35. }
  36. }
  37.  
  38. include("header.inc.php");
  39. /* display existing databases */
  40. $query = "select db_id,db_name,db_description from formmaker_db order by db_name ASC";
  41. $result = mysql_query($query);
  42. $rows = mysql_num_rows($result);
  43. if ($rows > 0)
  44. {
  45. echo '<span class="titles">'.
  46. translate("listofdbs").'</span><br /><br />
  47. <table border="0" cellpadding="4" cellspacing="0">
  48. <tr><td class="toprow">'.translate("name").'</td><td class="toprow">'.translate("description").'</td>
  49. <td class="toprow">'.translate("update").'</td><td class="toprow">'.translate("delete").'</td></tr>';
  50. $foo = '';
  51. while ($row = mysql_fetch_object($result))
  52. {
  53. echo '
  54. <tr>
  55. <td valign="top" class="list">'.mq_out($row->db_name).'</td>
  56. <td valign="top" class="list">'.mq_out($row->db_description).'</td>
  57. <td valign="top" class="list"><a href="index.php?formaction=table_index&amp;dbid='.$row->db_id.'">'.translate("details").'</a></td>
  58. <td valign="top" class="list"><a onclick="return confirmdelete(\''.translate("deleteq1").'\')" href="index.php?formaction=db_del&amp;dbid='.$row->db_id.'">'.translate("delete").'</a></td>
  59. </tr>';
  60. }
  61. echo '</table>';
  62. }
  63. else echo '<b>'.translate("nodbsyet").'</b>';
  64.  
  65. echo '<br /><br />';
  66.  
  67. # form form for creating new database
  68.  
  69. echo '<span class="titles">'.
  70. translate("createnewdb").'</span>
  71. <form action="index.php" method="post">';
  72. if (!empty($error)) echo '<span class="error">'.$error.'</span>';
  73. echo '<p>'.translate("name").' : <br /><input type="text" value="'.mq_out($dbname,1).'" name="newdbname"></input><br />
  74. * '.translate("help1").' * '.translate("dbeventcreate").'</p>
  75. <p>'.translate("description").' : <br /><textarea cols="50" rows="5" name="description">'.mq_out($description,1).'</textarea></p>
  76. <p><input type="submit" name="dbsubmit" value="'.translate("submitnewdb").'"></input></p>
  77. </form>';
  78.  
  79. include("footer.inc.php");
  80. ?>
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 525
Reputation: Will Gresham is on a distinguished road 
Solved Threads: 86
Sponsor
Will Gresham's Avatar
Will Gresham Will Gresham is offline Offline
Posting Pro
 
0
  #2
Oct 31st, 2009
Did you even read the 'Read Me' topic at the top of the forum list?
http://www.daniweb.com/forums/thread191031.html
AJAX is not a programming language, scripting language or any other sort of language.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 3
Reputation: Maged Media is an unknown quantity at this point 
Solved Threads: 0
Maged Media Maged Media is offline Offline
Newbie Poster
 
0
  #3
Nov 1st, 2009
i read the link you provided and didn't get a solution
maybe i am doing something wrong
and so i started this topic for someone to help me as i am stuck in time
thanks for your fast reply ..appreciated

so could someone plz get what is wrong with the supplied argument in line 42 ?
thanks in advance
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 265
Reputation: Dukane is an unknown quantity at this point 
Solved Threads: 22
Dukane's Avatar
Dukane Dukane is offline Offline
Posting Whiz in Training
 
0
  #4
Nov 1st, 2009
Perhaps the query on line 41 is not being executed.
It is very important to read this: http://www.catb.org/~esr/faqs/smart-questions.html
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 525
Reputation: Will Gresham is on a distinguished road 
Solved Threads: 86
Sponsor
Will Gresham's Avatar
Will Gresham Will Gresham is offline Offline
Posting Pro
 
0
  #5
Nov 1st, 2009
Originally Posted by Maged Media View Post
i read the link you provided and didn't get a solution
maybe i am doing something wrong
and so i started this topic for someone to help me as i am stuck in time
thanks for your fast reply ..appreciated

so could someone plz get what is wrong with the supplied argument in line 42 ?
thanks in advance
The error you are getting tells you exactly what the problem is.
The problem is that the 'supplied argument is not a valid MySQL result resource'.

If you re-read the topic I linked to, you will see it tells you to add error-checking to your queries to tell you what they are not successful.
Add in the error checking and see what errors it gives you.
AJAX is not a programming language, scripting language or any other sort of language.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 3
Reputation: Maged Media is an unknown quantity at this point 
Solved Threads: 0
Maged Media Maged Media is offline Offline
Newbie Poster
 
0
  #6
Nov 3rd, 2009
for the urgent matter i said i used that google documents tools of creating forms and output in excel format
@ Dukane: i think so too
...and still to learn and find the mistake out i will try the error checking "Will" pointed to ..and will inform you with the results perhaps someone benifits from this

thanks alot Dukane & Will
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 309 | Replies: 5
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC