<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title>Add Order By to sql_select statement</title>
        <link>https://interactivetools.com/forum/forum-posts.php?Add-Order-By-to-sql_select-statement-80070</link>
        <description></description>
        <pubDate>Wed, 19 Aug 2026 08:31:14 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-posts.php?rss=1&amp;Add-Order-By-to-sql_select-statement-80070" rel="self" type="application/rss+xml" />

                <item>
          <title>Add Order By to sql_select statement</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2236741#post2236741</link>
          <description><![CDATA[<p>Thanks Djuilia - worked perfect!</p>]]></description>
          <pubDate>Mon, 18 May 2015 05:19:50 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2236741#post2236741</guid>
        </item>
                <item>
          <title>Add Order By to sql_select statement</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2236740#post2236740</link>
          <description><![CDATA[<p>Hi,</p>
<p>Try this :</p>
<p><code>&lt;?php $submissionRecords = mysql_select('submission', $where); ?&gt;<br /><br />Name:&amp;nbsp;<br />&lt;select name="num"&gt;<br />&lt;?php <br />    $lastName = array();<br />    foreach ($submissionRecords as $key =&gt; $row) {<br />        $lastName[$key] = $row['last_name'];<br />    }<br />    array_multisort($lastName, SORT_ASC, $submissionRecords); // or SORT_DESC<br />    foreach ($submissionRecords as $submissionRecord): ?&gt;<br />&lt;option value = "&lt;?php echo$submissionRecord['num'];?&gt;"&gt;#&lt;?php echo $submissionRecord['num']; ?&gt; - &lt;?php echo $submissionRecord['last_name']; ?&gt;, &lt;?php echo $submissionRecord['name']; ?&gt;&lt;/option&gt;<br />&lt;?php endforeach ?&gt;<br />&lt;/select&gt;</code></p>
<p>Thanks!</p>
<p>Djulia</p>]]></description>
          <pubDate>Sun, 17 May 2015 23:31:23 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2236740#post2236740</guid>
        </item>
                <item>
          <title>Add Order By to sql_select statement</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2236739#post2236739</link>
          <description><![CDATA[<p>I need to add a ORDER BY statement to the following and I'm having a problem finding the correct syntax. I do not want to add the ODER BY to the $where statement as the $where statement is added by an "included page" and it is very lengthy.</p>
<p>If I can sort the output in the <em>'sql_select'</em> or the <em>'foreach</em>' statement that would be great - I need to sort by 'last_name' - any help would be appreciated!</p>
<p>Thanks</p>
<p>nmsinc</p>
<p><code>       &lt;?php $submissionRecords = mysql_select('submission', $where); ?&gt;<br />                                                        <br />       Name:&amp;nbsp;<br />       &lt;select name="num"&gt;<br />       &lt;?php foreach ($submissionRecords as $submissionRecord): ?&gt;<br />       &lt;option value = "&lt;?php echo$submissionRecord['num'];?&gt;"&gt;#&lt;?php echo $submissionRecord['num']; ?&gt; - &lt;?php echo $submissionRecord['last_name']; ?&gt;, &lt;?php echo $submissionRecord['name']; ?&gt;&lt;/option&gt;<br />       &lt;?php endforeach ?&gt;<br />       &lt;/select&gt;<br /></code></p>
]]></description>
          <pubDate>Sun, 17 May 2015 13:52:24 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2236739#post2236739</guid>
        </item>
              </channel>
    </rss>
  