The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Need php5 expert
I have an addon product that worked in php4 but we upgraded to php5 and most of it works except for 1 error showing at top of page. I have no knowledge of php but am trying to learn.
This is the error we are getting: HTML Code:
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/xxxx/xxx/pickem/includes/header.php on line 122 HTML Code:
if (mysql_num_rows($query)) { HTML Code:
$sql = "select * from " . $db_prefix . "users where userID = " . $user->userID; $query = mysql_query($sql); if (mysql_num_rows($query)) { $result = mysql_fetch_array($query); $template_name = $result['template_name']; } if (!empty($_POST['template_name'])) $template_name = $_POST['template_name']; ?> Warning: There are 3 functions in your code that have been deprecated in the current version of PHP : mysql_fetch_array() mysql_num_rows() mysql_query() Any ideas on what may work? |
#2
|
|||
|
|||
I'm not a php5 expert. But, I see that mysql_query() can return FALSE in the case of an error, and since the error message says that $query is a boolean, I'd assume that's what's happening. You could just check for that in the 'if', like maybe:
Code:
if ($query !== FALSE && mysql_num_rows($query)) { The mysql interface has been deprecated so you should change to one of the other interfaces, but you can ignore that for now. ETA: Actually, if that plugin is depending on the database connection that vbulletin opens, and you've changed to using mysqli in the config.php, then the error could be that there's no database connection. In that case what you probably want to do is rewrite the plugin to use the vbulletin database functions (which isn't as difficult as it may sound since the functions are named mostly the same as the mysql functions). That will also take care of the deprecated interface issue. |
#3
|
|||
|
|||
Thank you very much kh99!!
I changed it to what you suggested and the error is gone now. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|