+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: problems with "mysql_num_rows()"

  1. #1
    anilson1 is offline x10Hosting Member anilson1 is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    45

    problems with "mysql_num_rows()"

    Hi,
    I am having problems with mysql_num_rows().
    I used to have this:

    $sqr1="SELECT * FROM $table WHERE GroupName = '$mygroup' ORDER BY SlipNum ASC, DrawNum ASC";

    and my site worked well. but now, it seems that every apostroph (') was replaced by ('), and I passed to have this:

    $sqr1="SELECT * FROM $table WHERE GroupName = '$mygroup' ORDER BY SlipNum ASC, DrawNum ASC";

    and I get the error:

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/anilson1/public_html/Molingokoko_3303/Quem_O_PuroMadie1094/proccessingPLAY.php on line 61

    I tried the following and worked

    $sqr1="SELECT * FROM $table";

    I even tried this:

    $sqr1="SELECT * FROM $table WHERE GroupName = '$mygroup' ORDER BY SlipNum ASC, DrawNum ASC";
    if(!($result1=mysql_query($sqr1,$connector)))
    {echo "problems with selector<br>";}

    and I got this:

    problems with selector

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/anilson1/public_html/Molingokoko_3303/Quem_O_PuroMadie1094/proccessingPLAY.php on line 61



    How can I solve this problem with the apostroph, I tried to change &apos; by "'" but it goes back to &apos;.

    Any help please.

  2. #2
    tttony's Avatar
    tttony is offline x10 Sophmore tttony is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    ~ 10°10'27.10''' N 67°59'59'.59''' O elev. 457m
    Posts
    147

    Re: problems with "mysql_num_rows()"

    try this:

    Code:
    $sqr1= sprintf("SELECT * FROM %s WHERE GroupName = '%s' ORDER BY SlipNum ASC, DrawNum ASC", $table, $mygroup);
    PHP & MySQL Web Developer
    Free Domain co.cc

  3. #3
    anilson1 is offline x10Hosting Member anilson1 is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    45

    Re: problems with "mysql_num_rows()"

    Thank you for you replay. It worked. I do not want to be bored, but I have in the same page something more complicated.

    How would I modify this:

    Code:
    $sqr = "INSERT INTO $table (RefNum,PersonalID,GroupName,SlipNum,DrawNum,Num1,Num2,Num3,Num4,Num5,Num6,Num7,DatePlayed)VALUE(&apos;$countRefNum&apos;,&apos;$userID&apos;,&apos;$mygroup&apos;,&apos;$sendSlipNum&apos;,&apos;$sendDrawNum&apos;,&apos;$myrealnumber[1]&apos;,&apos;$myrealnumber[2]&apos;,&apos;$myrealnumber[3]&apos;,&apos;$myrealnumber[4]&apos;,&apos;$myrealnumber[5]&apos;,&apos;$myrealnumber[6]&apos;,&apos;$myrealnumber[7]&apos;,&apos;$getcurrentDate&apos;)";
    Last edited by compwhizii; 12-09-2008 at 02:51 PM. Reason: Code tags please.

  4. #4
    tttony's Avatar
    tttony is offline x10 Sophmore tttony is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    ~ 10°10'27.10''' N 67°59'59'.59''' O elev. 457m
    Posts
    147

    Re: problems with "mysql_num_rows()"

    never use variables into string:

    echo "this is a $variable";

    use it like this:

    echo "this is a " . $variable;

    or

    printf("this is a %s", $variable);

    use the function sprintf() for multiple variables, you can do it just try it...
    Last edited by tttony; 12-09-2008 at 12:56 PM.
    PHP & MySQL Web Developer
    Free Domain co.cc

  5. #5
    anilson1 is offline x10Hosting Member anilson1 is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    45

    Re: problems with "mysql_num_rows()"

    So, I would have:

    Code:
    $sqr = "INSERT INTO %$ (RefNum,PersonalID,GroupName,SlipNum,DrawNum,Num1, Num2,Num3,Num4,Num5,Num6,Num7,DatePlayed) VALUE (‘%$’, ‘%$’,‘%$’, ‘%$’,‘%$’,‘%$’, ‘%$’,‘%$’, ‘%$’,‘%$’, ‘%$’, ‘%$’,‘%$’", $countRefNum, $userID, $m ygroup, $sendSlipNum, $sendD rawNum, $myrealnumber[1], $myrealnumber[2], $myrealnumber[3], $myrealnumber[4], $myrealnumber[5], $myrealnumber[6], $myrealnumber[7], $getcurrentDate), $table;
    OR

    Code:
    $sqr = "INSERT INTO %$ (RefNum,PersonalID,GroupName,SlipNum,DrawNum,Num1, Num2,Num3,Num4,Num5,Num6,Num7,DatePlayed) VALUE (‘%$’, ‘%$’,‘%$’, ‘%$’,‘%$’,‘%$’, ‘%$’,‘%$’, ‘%$’,‘%$’, ‘%$’, ‘%$’,‘%$’" $table, $countRefNum, $userID, $m ygroup, $sendSlipNum, $sendD rawNum, $myrealnumber[1], $myrealnumber[2], $myrealnumber[3], $myrealnumber[4], $myrealnumber[5], $myrealnumber[6], $myrealnumber[7], $getcurrentDate);
    Last edited by compwhizii; 12-09-2008 at 02:19 PM. Reason: Please use code tags

  6. #6
    tttony's Avatar
    tttony is offline x10 Sophmore tttony is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    ~ 10°10'27.10''' N 67°59'59'.59''' O elev. 457m
    Posts
    147

    Re: problems with "mysql_num_rows()"

    Use %s not %$, do you have the NumX fields as INT in the table??

    if it is remember that you dont have to use ' the simple quote for number fields

    other thing is if the data of variable is only string use %s if it is number use %d
    PHP & MySQL Web Developer
    Free Domain co.cc

  7. #7
    compwhizii is offline Banned compwhizii is an unknown quantity at this point
    Join Date
    May 2008
    Location
    The Moon
    Posts
    779

    Re: problems with "mysql_num_rows()"

    Just for future reference please use [CODE] tags. Thank you.

  8. #8
    anilson1 is offline x10Hosting Member anilson1 is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    45

    Re: problems with "mysql_num_rows()"

    Why does it happens?
    why instead of ' I am getting &apos; ?
    does it have to do with encoding characters?

    I noticed that if I open it in view the page in file manager I still have ' but if I open it for edit then I get &apos;, and if I save that then even in view format I get &apos;

    Does it have to do with my computer? I do not want to chance all my pages.

  9. #9
    tttony's Avatar
    tttony is offline x10 Sophmore tttony is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    ~ 10°10'27.10''' N 67°59'59'.59''' O elev. 457m
    Posts
    147

    Re: problems with "mysql_num_rows()"

    paste here the script code to see what happens
    PHP & MySQL Web Developer
    Free Domain co.cc

  10. #10
    anilson1 is offline x10Hosting Member anilson1 is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    45

    Re: problems with "mysql_num_rows()"

    here goes a single page. right now I am only worried with this &apos;

    the code:

    -----------------------

    --Code removed by compwhizii--
    Last edited by compwhizii; 12-10-2008 at 07:14 AM. Reason: Code removed

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Paid account.. Will it fix problems?
    By altrock182182 in forum Free Hosting
    Replies: 3
    Last Post: 01-14-2008, 04:23 PM
  2. NOTE: For all problems regarding phpBB3 RC6
    By CrownVictoriaCop in forum Free Hosting
    Replies: 1
    Last Post: 10-14-2007, 03:35 PM
  3. Problems...problems...problems...
    By eternal-empire in forum Free Hosting
    Replies: 4
    Last Post: 09-21-2007, 03:53 PM
  4. problems, problems
    By joandajer in forum Free Hosting
    Replies: 5
    Last Post: 01-29-2006, 04:47 PM
  5. more problems after reseting pass
    By rahul2006 in forum Free Hosting
    Replies: 6
    Last Post: 11-10-2005, 08:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers