Another MySQL Syntax error!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
cap2cap10
Forum Contributor
Posts: 158
Joined: Mon Apr 14, 2008 11:06 pm

Another MySQL Syntax error!

Post 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
Last edited by Benjamin on Fri Jun 12, 2009 5:43 pm, edited 1 time in total.
Reason: Changed code type from text to php.
User avatar
akuji36
Forum Contributor
Posts: 190
Joined: Tue Oct 14, 2008 9:53 am
Location: Hartford, Connecticut

Re: Another MySQL Syntax error!

Post 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
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Another MySQL Syntax error!

Post by requinix »

Where's $bossID coming from?
User avatar
akuji36
Forum Contributor
Posts: 190
Joined: Tue Oct 14, 2008 9:53 am
Location: Hartford, Connecticut

Re: Another MySQL Syntax error!

Post by akuji36 »

User avatar
cap2cap10
Forum Contributor
Posts: 158
Joined: Mon Apr 14, 2008 11:06 pm

Re: Another MySQL Syntax error!

Post by cap2cap10 »

Thanks! I forgot to add in session variable bossID. Worked like a charm.

Batoe
Post Reply