quickstopman Posted September 28, 2007 Share Posted September 28, 2007 here is the code for one of my pages <? ob_start(); session_start(); include('config.php'); include('header.php'); ?> <h1>FlameAble Design</h1> <?php $sql = mysql_query("SELECT * FROM `news` WHERE `title` = '$_GET['title']' ") OR die(mysql_error()); while ($news_info1 = mysql_fetch_array($sql)) { ?> ?> <p> <table width="670px" height="104" class="table"> <tr> <td width="365" align="right" valign="top" style="padding:10px;"> <h1><? echo $news_info1['title']; ?></h1> <? echo $news_info1['content']; ?> </td> <td width="71" align="center" valign="top" style="padding:10px;"> <script type="text/javascript"> digg_url = 'http://www.flameable.getmetola.com/news/<? echo $news_info1['title']; ?>'; digg_title = '<? echo $news_info1['title']; ?>'; digg_bodytext = '<? echo $news_info1['content']; ?>'; digg_topic = 'Design'; digg_bgcolor = ''; </script> <div style="background-color:#FFFFFF; border: 2px solid #666633"> <script src="diggthis.js"> </script> </div> </td> </tr> </table> </p> <? } include('footer.php'); ?> i keep getting this error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/pokebash/public_html/getmetola/flameable/news.php on line 9 can somebody help me stop the error?? thanks guys Quote Link to comment https://forums.phpfreaks.com/topic/70993-solved-mysql_query-error-i-cant-seem-to-find/ Share on other sites More sharing options...
hvle Posted September 28, 2007 Share Posted September 28, 2007 $sql = mysql_query("SELECT * FROM `news` WHERE `title` = '{$_GET['title']}' ") OR need the {} arond the $_GET Quote Link to comment https://forums.phpfreaks.com/topic/70993-solved-mysql_query-error-i-cant-seem-to-find/#findComment-356951 Share on other sites More sharing options...
cooldude832 Posted September 28, 2007 Share Posted September 28, 2007 even more important dont' use get directly in query = dangerous Quote Link to comment https://forums.phpfreaks.com/topic/70993-solved-mysql_query-error-i-cant-seem-to-find/#findComment-356952 Share on other sites More sharing options...
quickstopman Posted September 28, 2007 Author Share Posted September 28, 2007 im still getting the same error ??? im really confused here is the updated code <?php ob_start(); session_start(); include('config.php'); include('header.php'); ?> <h1>FlameAble Design</h1> <?php $title = $_GET['title']; $sql = mysql_query("SELECT * FROM `news` WHERE title = '{$title}'"); while ($news_info1 = mysql_fetch_array($sql)) { ?> <p> <table width="670px" height="104" class="table"> <tr> <td width="365" align="right" valign="top" style="padding:10px;"> <h1><? echo $news_info1['title']; ?></h1> <? echo $news_info1['content']; ?> </td> <td width="71" align="center" valign="top" style="padding:10px;"> <script type="text/javascript"> digg_url = 'http://www.flameable.getmetola.com/news/<? echo $news_info1['title']; ?>'; digg_title = '<? echo $news_info1['title']; ?>'; digg_bodytext = '<? echo $news_info1['content']; ?>'; digg_topic = 'Design'; digg_bgcolor = ''; </script> <div style="background-color:#FFFFFF; border: 2px solid #666633"> <script src="diggthis.js"> </script> </div> </td> </tr> </table> </p> <? } include('footer.php'); ?> i have no idea what im doing wrong Quote Link to comment https://forums.phpfreaks.com/topic/70993-solved-mysql_query-error-i-cant-seem-to-find/#findComment-356956 Share on other sites More sharing options...
quickstopman Posted September 28, 2007 Author Share Posted September 28, 2007 i updated the code again still the error <? ob_start(); session_start(); include('config.php'); include('header.php'); ?> <h1>FlameAble Design</h1> <?php $title = $_GET['title']; $sql1 = mysql_query("SELECT * FROM `news` WHERE `title` = '{$title}'"); $news_info1 = mysql_fetch_array($sql1); ?> <p> <table width="670px" height="104" class="table"> <tr> <td width="365" align="right" valign="top" style="padding:10px;"> <h1><? echo $news_info1['title']; ?></h1> <? echo $news_info1['content']; ?> </td> <td width="71" align="center" valign="top" style="padding:10px;"> <script type="text/javascript"> digg_url = 'http://www.flameable.getmetola.com/news/<? echo $news_info1['title']; ?>'; digg_title = '<? echo $news_info1['title']; ?>'; digg_bodytext = '<? echo $news_info1['content']; ?>'; digg_topic = 'Design'; digg_bgcolor = ''; </script> <div style="background-color:#FFFFFF; border: 2px solid #666633"> <script src="diggthis.js"> </script> </div> </td> </tr> </table> </p> <? include('footer.php'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/70993-solved-mysql_query-error-i-cant-seem-to-find/#findComment-356962 Share on other sites More sharing options...
darkfreaks Posted September 28, 2007 Share Posted September 28, 2007 take out the curly brackets around $title Quote Link to comment https://forums.phpfreaks.com/topic/70993-solved-mysql_query-error-i-cant-seem-to-find/#findComment-356963 Share on other sites More sharing options...
quickstopman Posted September 28, 2007 Author Share Posted September 28, 2007 it still says line 9 something is completely messed up about this code! ive even made the mysql_query line into a comment and it still says line 9 any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/70993-solved-mysql_query-error-i-cant-seem-to-find/#findComment-356964 Share on other sites More sharing options...
quickstopman Posted September 28, 2007 Author Share Posted September 28, 2007 ok for some odd reason i had to change the file name but it works now! thanks guys! Quote Link to comment https://forums.phpfreaks.com/topic/70993-solved-mysql_query-error-i-cant-seem-to-find/#findComment-356966 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.