...

View Full Version : PHP & SQL With No Table?



ccarrin2
01-10-2012, 10:12 PM
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
$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..

Inigoesdr
01-10-2012, 10:15 PM
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).

Based on the name of the class it looks like it's using a Mingle (http://wordpress.org/extend/plugins/mingle/) plugin of some sort, but not necessarily that one I linked.

ccarrin2
01-10-2012, 10:34 PM
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

Spookster
01-10-2012, 10:55 PM
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.

ccarrin2
01-10-2012, 11:06 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum