Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jan 2012
    Posts
    41
    Thanks
    6
    Thanked 0 Times in 0 Posts

    PHP & SQL With No Table?

    I just had my first experience with elance and I had someone make a favorite option for my site on the development platform. It works great. A user clicks favorite and that board post is then added to their favorites section. Because everything was good I payed the guy and said goodbye. However, I just tried adding the files to my site and I am getting this error.

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/ccarrin2/public_html/wp-content/plugins/mingle/classes/views/mngl-boards/board_post.php on line 497

    Here is line 495 to 509

    PHP Code:
    <?php 
    $sql 
    mysql_query("SELECT * FROM wp_favourite WHERE mngl_id='".$board_post->id."'");
    $counter mysql_num_rows($sql);
    if(
    $counter !='0'){
    $in '';

        while(
    $result mysql_fetch_array($sql)){
            
    $user2 MnglUser::get_stored_profile_by_id($result['fav_user_id']);
            
    $sqlf mysql_fetch_array(mysql_query("SELECT meta_value FROM wp_usermeta WHERE meta_key = 'first_name' AND user_id = '".$result['fav_user_id']."'"));
            
    $sqll mysql_fetch_array(mysql_query("SELECT meta_value FROM wp_usermeta WHERE meta_key = 'last_name' AND user_id = '".$result['fav_user_id']."'"));
            
    $screenname $sqlf['meta_value'].' '.$sqll['meta_value'];
            
    $in .= "<a href='".$user2->screenname."' >".$screenname."</a>,";
        }
    $final substr($in,0,-1);
    ?>
    It seems like on the development database he made a table named wp_mngl_favourite but in the database there is no table by this name. I am 100% sure it is not here. Is it possible to run this code without that table? Or do you guys think it is in my database but under a different name because I can't find it and I don't have that many tables. Any help in anyway would be greatly appreciated. I am so confused..
    Last edited by ccarrin2; 01-11-2012 at 12:30 AM.

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Quote Originally Posted by ccarrin2 View Post
    Is it possible to run this code without a table? Any help in anyway would be greatly appreciated. I am so confused..
    No, it's not possible to run it without the table. The data you are displaying is depending on retrieving the data from that table. You should contact your coder and see if they will send you the SQL or plugin for that table(looks like a WP plugin, but it could be just a table they created with a wp_ prefix).

    Edit: Based on the name of the class it looks like it's using a Mingle plugin of some sort, but not necessarily that one I linked.
    Last edited by Inigoesdr; 01-10-2012 at 10:17 PM.

  • #3
    New Coder
    Join Date
    Jan 2012
    Posts
    41
    Thanks
    6
    Thanked 0 Times in 0 Posts
    I've done a query and get back

    Error

    SQL query: Documentation

    SELECT *
    FROM wp_favourite
    LIMIT 0 , 30

    MySQL said: Documentation
    #1146 - Table 'instrideusername.wp_favourite' doesn't exist
    Last edited by ccarrin2; 01-11-2012 at 12:30 AM.

  • #4
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    This would have been a new table he created for your new favorites feature. As was stated you need to have him provide you with a SQL file containing the SQL necessary to create that table in your database. Once you have that SQL file you can import it using phpMyAdmin.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #5
    New Coder
    Join Date
    Jan 2012
    Posts
    41
    Thanks
    6
    Thanked 0 Times in 0 Posts
    I am definitely going to ask him what is going on, I just came here b/c it is 3am in India so I need to wait a couple hours before I can get my site back up again. I was just hoping someone could help me here. I have transferred over all of the files he worked on so if there are any that have a create table function they would have been transferred over. Idk I'm just really confused, I guess i will just have to wait.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •