SMFHacks.com

Modifications/Themes => General SMF Forum => Topic started by: shuban on December 09, 2014, 12:20:06 pm

Title: Need help with this query...
Post by: shuban on December 09, 2014, 12:20:06 pm
Hello, for some reason this query won't display the id_msg (it displays everything but $row)... What am I doing wrong? :-\

Code: [Select]
global $db_prefix;

$result = db_query("
SELECT id_msg
FROM {$db_prefix}messages
WHERE topicSolved = 1 AND ID_TOPIC = 176113", __FILE__, __LINE__);

$row = mysql_fetch_assoc($request);

echo 'The id message for this topic is: ',$row,'';
Title: Re: Need help with this query...
Post by: SMFHacks on December 09, 2014, 12:28:14 pm
Change
echo 'The id message for this topic is: ',$row,'';
to
Code: [Select]
echo 'The id message for this topic is: ',$row['id_msg'],'';
Title: Re: Need help with this query...
Post by: SMFHacks on December 09, 2014, 12:33:49 pm
Also
$row = mysql_fetch_assoc($request);
Should be
$row = mysql_fetch_assoc($result);
Title: Re: Need help with this query...
Post by: shuban on December 09, 2014, 12:35:39 pm
Yes :D

This worked:

Code: [Select]
$result = db_query("
SELECT id_msg
FROM {$db_prefix}messages
WHERE topicSolved = 1 AND ID_TOPIC = 176113", __FILE__, __LINE__);

$row = mysql_fetch_assoc($result);

echo 'The id message for this topic is: ',$row['id_msg'],'';