The server gives me a mysql syntax error... I have tried combing it and combing it, trying different ways of doing it and to no avail. Please see the code, maybe im doing something completely wrong (there is a better way to do it) or I'm missing something silly.
Code: Select all
$streamlinker = mysql_pconnect("localhost", "username", "passwordhere") or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db("database1", $streamlinker);
$moresqlstreamlink='SELECT * from link where active = "1" and uid = "'.$ref.'"';
$morestreamresult=mysql_query($moresqlstreamlink)
or die(mysql_error());
while($morerows = mysql_fetch_array($morestreamresult))
{
$streamid = $morerows['streamid'];
$streamuid = $morerows['uid'];
$order = $morerows['order'];
$streamrefuid = $morerows['refuid'];
$streamrefdata = $morerows['refdata'];
$data = $morerows['data'];
$sticky = $morerows['sticky'];
if (empty($data)) { $refdata = $streamrefdata; $refuid = $streamrefuid;} else { $refdata = $data; $refuid = $streamuid; }
//lets check to see if the stream needs to continue to be sticky from the upline
if ($sticky <> "") {
include 'dblink.php'; //the second database
$link2 = mysql_pconnect($hostname, $un, $passwd)
or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db($database, $link2);
$sql2='SELECT id from users where (upline1 = "'.$sticky.'" or upline2 = "'.$sticky.'" or upline3 = "'.$sticky.'" or upline4 = "'.$sticky.'" or upline5 = "'.$sticky.'")';
$streamresult=mysql_query($sql2)
or die(mysql_error());
if (mysql_num_rows($sql2) > 0) { $sticky = $sticky; } else { $sticky = ""; }}
//Insert the new rows into the table with the new user's default information
$streamlink = mysql_pconnect("localhost", "username", "passwordhere") or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db("database1", $streamlink);
mysql_query ("INSERT INTO link (streamid, order, uid, refuid, refdata, data, active, sticky) VALUES ('$streamid', '$order', '$uid', '$refuid', '$refdata', '', '1', '$sticky'")
or die(mysql_error());
}thanks for your help!You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order, uid, refuid, refdata, data, active, sticky) VALUES ('1', '2', 'tvgxhksz30' at line 1