Hi,
I got stuck recently attempting to read an sql database using php as I kept on getting the error:
Warning: implode() [function.implode]: Invalid arguments passed in /home/***/public_html/***/includes/query_posts.php on line 28
The idea was that I would create this php page that would read an vbulletin sql database and then pop off an email when a user is over certain post amounts of 500 and 1000. The idea being that the poster is rewarded for their efforts etc.
Here below is the code I am using with identifying site information trimmed of course using *** symbols - this version is for the 500 post limit being met or exceeded.
<?php
//Get variables from config.php to connect to mysql server
require 'config.php';
// connect to the mysql database server.
mysql_connect ('localhost', '***', '***');
//select the database
mysql_select_db('***_forums1') or die('Cannot select database');
//select statement for users
$sql = "SELECT username FROM user WHERE posts >='500'";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$username = $row["username"];
//take the emails and add a comma to email and create an string
$list = implode(',' , $username);
echo $list;
$to = "***@***.com";
$subject = "These users have reached 500 posts "&$list;
//send the emails
//mail($to, $from, $subject);
?></p>
Now I can't see why this error would happen as I don't fully understand implode and its requirements.
Any help appreciated.
Thanks
Aqua