The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
php script to extract thread titles
I'm starting to program a php script to extract thread titles.
I am new to PHP but I'm learning ... PHP Code:
Code:
Connected to MySQL Connected to Database Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/mysql.php on line 8 |
#2
|
|||
|
|||
I think the problem is the quotes you have around the column and table names. The quote character should be a backtick (`) and it looks like you have single quotes. (You don't really have to quote column and table names unless they have special characters).
Also, if you look at the page for mysql_query (http://us2.php.net/manual/en/function.mysql-query.php) under the Return Values section, you'll see that it can return FALSE if there's an error, so that's why your error message says that mysql_fetch_array() was expecting an array. |
#3
|
|||
|
|||
Quote:
PHP Code:
Code:
Connected to MySQL Connected to DatabaseArray Array Array Array Array Array Array Array Array Array ......... (it keeps on going for a little while) |
#4
|
|||
|
|||
That probably means it's working. The return from mysql_fetch_array() will be an array even if you are only selecting one column. So if you change your echo to $row['title'] you should see the titles.
|
#5
|
|||
|
|||
Pardon my butting in but my curiosity is killing me. What would you use that for?
|
#6
|
|||
|
|||
kh ... I get this now:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /Applications/XAMPP/xamppfiles/htdocs/mysql.php on line 10 setishock - The reason for this is to generate a report of thread titles from the 15th of each month to the 14th of each month. Based on the data I have, it will populate an excel spreadsheet and make my monthly reporting for the manager a lot less time consuming. It's only the start of what I want to have the script do. |
#7
|
|||
|
|||
Quote:
That usually means that quotes are mismatched or something. |
#8
|
|||
|
|||
PHP Code:
|
#9
|
|||
|
|||
Oh right. Sorry, change the echo line to
Code:
echo "$row[title]"; |
#10
|
|||
|
|||
PHP Code:
Thanks for the help kh99. It worked. Just need to figure out how to calculate the from date and to date properly as needed. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|