Log in

View Full Version : getting data from DB



jaffyy
01-13-2008, 07:45 PM
I get the following error when i try to get the data from my SMF forum Database



Parse error: parse error, expecting `','' or `';'' in D:\Program Files\xampp\htdocs\posts.php on line 10


And the script is:



<?php
include 'config.php';

$query = "SELECT subject FROM smf_messages LIMIT 8 BY DESC"."SELECT ID_MSG FROM smf_messages LIMIT 8 BY

DESC"."SELECT ID_TOPIC FROM smf_messages LIMIT 8 BY DESC";
$result = mysql_query($query);

while($row = mysql_fetch_array($result, MYSQL_ASSOC))

{
echo "<font color=grey size=2>><a

href="http://l2rt.coolc.biz/forum/index.php/topic,{$row['ID_TOPIC']}.msg{$row['ID_MSG']}.html#msg{$row['subject']}">

{$row['subject']}</a></font><br>";

}


include 'close.php';
?>


I could not find the problem.. any help is appercited thanks!

Master_script_maker
01-13-2008, 09:19 PM
try this:

<?php
include 'config.php';

$query = "SELECT subject FROM smf_messages LIMIT 8 BY DESC"."SELECT ID_MSG FROM smf_messages LIMIT 8 BY DESC"."SELECT ID_TOPIC FROM smf_messages LIMIT 8 BY DESC";

$result = mysql_query($query);

while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<font color=grey size=2><a href=\"http://l2rt.coolc.biz/forum/index.php/topic,{$row['ID_TOPIC']}.msg{$row['ID_MSG']}.html#msg{$row['subject']}\">{$row['subject']}</a></font><br>";

}


include 'close.php';
?>

jaffyy
01-13-2008, 10:44 PM
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\Program Files\xampp\htdocs\posts.php on line 8


Dosen't work... :(

Master_script_maker
01-13-2008, 10:56 PM
<?php
include 'config.php';

$query = "SELECT subject FROM smf_messages LIMIT 8 BY DESC "."SELECT ID_MSG FROM smf_messages LIMIT 8 BY DESC "."SELECT ID_TOPIC FROM smf_messages LIMIT 8 BY DESC";

$result = mysql_query($query);

while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<font color=grey size=2><a href=\"http://l2rt.coolc.biz/forum/index.php/topic,{$row['ID_TOPIC']}.msg{$row['ID_MSG']}.html#msg{$row['subject']}\">{$row['subject']}</a></font><br>";

}


include 'close.php';
?>

jaffyy
01-14-2008, 08:51 PM
1. dont work
2. lol its the same.. :|

Twey
01-14-2008, 09:10 PM
mysql_query() only does one query at a time. Also, validate your HTML (http://validator.w3.org/).