-1
<table width="1200px" class="flat-table flat-table-1">
                    <tbody>
                        <tr>
                            <th style="width:10px">Name</th>
                            <th style="width:200px">SSS#/LICENSE#</th>
                            <th style="width:5px">Offenses</th>
                            <th style="width:150px">Officer</th>
                            <th style="width:200px">Violation</th>
                              <th style="width:200px">Price</th>
                            <th style="width:200px">Last Update</th>
                        </tr>
                    </tbody>




         <?php
         date_default_timezone_set('Asia/Manila');
                        $conn=mysql_connect("localhost","root","");
                        mysql_select_db("dbposo",$conn);


            $violationz=mysql_query("select *,date_format(time,'%h:%i %p') as timed from tblviolator ORDER BY DDATE DESC");

                        while($data=mysql_fetch_array($violationz))
                            {
                                $license=$data['license'];
                                $link=str_replace(" ","-",$license);
                                $fname=$data['fname'];
                                $mname=$data['mname'];
                                $lname=$data['lname'];
                                $offenses=$data['offenses'];
                                $officer=$data['officer'];
                                $violation=$data['violation'];
                                $ddate=$data['ddate'];
                                $ttime=$data['ttime'];


                                print "
                                    <tr license='X$license'>
                                    <td width='10px'><center>$lname,$fname,$mname</center></td>
                                    <td width='200px'><center><a href='edit_publicviolation.php?n=$link'><font color='#00FF00'>$license</font></a></center></td>
                                    <td width='90px'><center>$offenses</center></td>
                                    <td width='170px'><center>$officer</center></td>
                                    <td width='230px'><center>$violation</center></td>
                                    <td width='200px'><center>$price</center></td>
                                    <td width='200px'><center>$ddate $ttime</center></td></tr>
                                    ";
                            }

                                    ?>  
    </table>

Get fetch, while { what is my error here? what to edit? please specify im a beginner in coding, i can't help it :( help please ? please thank you in advance
:) please help, your answers are highly appreciated. and sorry for my bad english >.<

Daryl
  • 29
  • 1
  • 4
  • Why did you decide to use a general filler that tells us nothing rather than actually tell us something? – John Dvorak Feb 19 '14 at 12:05
  • i can't get what you say sir :( im a beginner – Daryl Feb 19 '14 at 12:05
  • 1
    try this: `$violationz=mysql_query("select *,date_format(time,'%h:%i %p') as timed from tblviolator ORDER BY DDATE DESC") or die(mysql_error());` – Awlad Liton Feb 19 '14 at 12:06
  • 2
    "possible duplicate" means that somebody else has already asked the same question as you and you are supposed to read the previous question rather than asking anew. About ten thousand different people have, to be exact. – John Dvorak Feb 19 '14 at 12:06
  • 1
    If you're a beginner, you shouldn't have legacy code that's using the `mysql_*` functions, and no new code should use them. Throw away/delete the bookmark for whatever resource you're using to learn how to do MySQL with PHP and find one that covers PDO or mysqli. – Wooble Feb 19 '14 at 12:10
  • thank you for voting me down :( i just want a fast and reliable answers from you guys, im sorry for my questioning :( – Daryl Feb 19 '14 at 12:30

3 Answers3

0

Try this :

Change ORDER BY DDATE DESC to ORDER BY ddate DESC

ddate in small caps

Prasanth Bendra
  • 29,105
  • 8
  • 50
  • 70
0

you have error in sql.

It seems that you have error in column name DDATE:

$violationz=mysql_query("select *,date_format(time,'%h:%i %p') as timed from tblviolator ORDER BY DDATE DESC");

column name is case sensitive : Are column and table name case sensitive in MySQL?

and you also need to check if it executed or not.

try this:

$violationz=mysql_query("select *,date_format(`time`,'%h:%i %p') as timed from tblviolator ORDER BY ddate DESC") or die(mysql_error()); 
Community
  • 1
  • 1
Awlad Liton
  • 9,260
  • 2
  • 26
  • 50
  • @prasanth bendra : thank you, you helped me – Daryl Feb 19 '14 at 12:13
  • @Awlad please read documentation here https://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html . you could find this line there `Column, index, and stored routine names are not case sensitive on any platform, nor are column aliases` – krishna Feb 19 '14 at 12:14
0

time is a reserve word of mysql, so use backticks for time column

$violationz=mysql_query("select *,date_format(`time`,'%h:%i %p') as timed from tblviolator ORDER BY DDATE DESC");
Sumit Bijvani
  • 8,012
  • 17
  • 49
  • 82