What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    Form to MySQL - Warning: mysql_numrows() expects parameter 1 to be resource

    Asked by RCinSTP on November 27, 2014 at 12:59 PM

    When you get the error below. Try going into phpMyAdmin and adding one row of bogus data to your table. That way, when it counts the number of rows it will find 1 (it is looking for more than zero)

     

    Warning: mysql_numrows() expects parameter 1 to be resource, boolean given in line 33

    Below is the 33 in my file. "$resultcount = mysql_numrows($sqlsearch);



    This is a re-post of a comment on How to send Submissions to Your MySQL Database Using PHP

    form to mysql
  • Profile Image
    JotForm Support

    Answered by Mike_T on November 27, 2014 at 02:57 PM

    Thank you for contacting us.

    Do you mean that you solve the problem by adding a row to your MySQL table, or the issue is till there?

  • Profile Image

    Answered by RCinSTP on November 27, 2014 at 08:40 PM

    It solved the problem for me because the code below basically says 'if resultcount is greater than zero, then proceed'  and resultcount is a count of the number of rows in the sql table. I'm not sure that code is needed, but when you start with new / empty table it will always count zero rows and fail.

    $query = "SELECT * FROM `table_name` WHERE `submission_id` = '$submission_id'"; $sqlsearch = mysql_query($query); $resultcount = mysql_numrows($sqlsearch); if ($resultcount > 0) {

     

  • Profile Image
    JotForm Support

    Answered by abajan on November 28, 2014 at 06:06 AM

    Thanks for that helpful information. Should anyone report the error, we'll suggest your solution.

    Cheers