Advertisement:

SQL query "upgrade" help needed...

Aloittaja tones_ie, heinäkuu 09, 2008, 01:23:48 AP

« edellinen - seuraava »

tones_ie

Hi guys,

looking for anyone that can help me out...i have a lil script that was made for me a long time ago ...its to pull up a list of posts that contain images...100 at a time. Worked great on smf before install of beta...and from what i gather theres changes to tables in beta...anyone able to tell me wat to change to get my script to work with smf beta please :)

<?php

$page 
= ($_GET['start']? $_GET['start'] : '0');

$dbh=mysql_connect ("localhost"$dbuser$dbpass) or die ('I cannot connect to the database because: ' mysql_error());
mysql_select_db ($dbname);

$result=mysql_query("SELECT id_msg,body,id_topic,subject FROM smf_messages WHERE body LIKE '%[img]%'ORDER BY posterTime DESC LIMIT " $page "," . ($page+100));

while(list(
$id_msg,$body,$id_topic,$subject)= mysql_fetch_row($result))
{
$imgs preg_split('/\[\/?img\]/i'$body);
print(
'<li><a href="'.$forumsURL.'index.php?topic='.$id_topic.'.msg'.$id_msg.'#msg'.$id_msg.'">'.$subject.'</a><ul>');
for (
$x=0$x<count($imgs); $x++)
{
if(
$x%2)
print(
'<li><a href="'.$imgs[$x].'">' $imgs[$x] . '</a></li>');
}
print(
"</ul></li>");
}

?>




Just dont know enuff sql to figure it out :(

Thanks un advance guys

tones_ie

nobody able to point me in right direction...  :(


Dragooon


tones_ie

Hi there...thanks for replying...

LainaaWarning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/james/public_html/imagelink.php on line 29

line 29 has this
Lainaawhile(list($id_msg,$body,$id_topic,$subject)= mysql_fetch_row($result))

thanks again

Advertisement: