Page 1 of 1

Another MySQL Syntax error!

Posted: Fri Jun 12, 2009 12:47 pm
by cap2cap10
Hello again! PHP technorati. I require your assistance in solving another syntax error problem.

Here is my code:

Code: Select all

 
<?php
require '*****.php';
 
$query = "SELECT * FROM bs_mail_list WHERE bossID = $bossID";
$result = mysql_query($query) or die (mysql_error());
 
while($row = mysql_fetch_assoc($result))
{
$text.= '<span class="style4">1-'.$row['my_category_1'].'<P>';
$text.= '2-'.$row['my_category_2'].'<P>';
$text.= '3-'.$row['my_category_3'].'<P>';
$text.= '4-'.$row['my_category_4'].'<P>';
$text.= '5-'.$row['my_category_5'].'<P></span>';
}
echo $text;
mysql_close();
?>
 
[color=#0000FF]*****.php = <?php
// Connect to server and select databse.
mysql_connect("**********", "*****", "***********") or die(mysql_error());
mysql_select_db("*****") or die(mysql_error());[/color]
 
?>
 
I keep getting syntax error '' line 1 :banghead:

Please enlighten me.

Thanks in advance,

Batoe

Re: Another MySQL Syntax error!

Posted: Fri Jun 12, 2009 1:04 pm
by akuji36
I would try placing my connection script in a separate script then

use it as an include in this larger php script

follow this link:

http://www.tizag.com/phpT/include.php

Re: Another MySQL Syntax error!

Posted: Fri Jun 12, 2009 1:11 pm
by requinix
Where's $bossID coming from?

Re: Another MySQL Syntax error!

Posted: Fri Jun 12, 2009 1:45 pm
by akuji36

Re: Another MySQL Syntax error!

Posted: Fri Jun 12, 2009 2:37 pm
by cap2cap10
Thanks! I forgot to add in session variable bossID. Worked like a charm.

Batoe