Click here to Skip to main content
15,889,462 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
so i have this code that will display the information from a table in my database but it does it randomly. the two things that i want to be organized are the question and response. i want to use the id for each row to basically put it in order so it shows the question and then the response under that question in that row. if any of this makes sense please help me.
PHP
<?php
include 'config.php';

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM name";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

echo "<center>Database Output</center><br><br>";

$i=0;
while ($i < $num) {
$responses=mysql_result($result,$i,"Kiya_responses");
$responses = preg_replace("/%u([0-9a-f]{3,4})/i","\\1;",urldecode($responses));
$questions=mysql_result($result,$i,"Kiya_questions");
$questions = preg_replace("/%u([0-9a-f]{3,4})/i","\\1;",urldecode($questions));

echo "<br>$questions</br>";
echo "<br>$responses</br>";


$i++;
}

?>
Posted

1 solution

Me thinks this might work if i understand your question

C#
$query="SELECT * FROM name ORDER BY id";
 
Share this answer
 
Comments
faizanza 27-Jul-15 19:34pm    
this was perfect thank you!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900