|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
RE: News Articles
is theres an error when you call mysql_fetch_array i think it means theres an error in your sql statement just make sure you got all the fields correct
|
|
#2
|
|||
|
|||
|
News Articles
I have a databse with news articles in it ... i want to call it in order of date with only five articles at a time (ie 5 most recent!)
I wrote this: but it doesn't seem to work: <?php $db = mysql_connect("localhost", "username", "password"); mysql_select_db("maraquita",$db); $sql="SELECT * FROM news ORDER BY date DESC limit 0,5"; $result=mysql_query($sql,$db); $num = mysql_num_rows($result); // this is where my error is: why? any help? $cur = 1; while ($num >= $cur) { $row = mysql_fetch_array($result); $id = $row["id"]; $title = $row["title"]; $content = $row["content"]; $author = $row["author"]; $date = $row["date"]; echo "<li><a href="news-articles.php?id=$id"><b>$title</b></a> - $author :: $date</li>"; } ?> Thanks, Liam |
|
#3
|
|||
|
|||
|
RE: News Articles
Try changing this line:
$result=mysql_query($sql,$db); to : $result=mysql_query($sql,$db) or die(mysql_error()); That will show if there is an error executing the query... |
|
#4
|
|||
|
|||
|
RE: News Articles
"Got Error 127 from Table Handler"
A quote from Austinn Powers: "But what does it all mean Austinn?" |
|
#5
|
|||
|
|||
|
RE: News Articles
That means your record file has crashed...check this out at mysql.com:
http://www.mysql.com/doc/R/e/Repair.html If you have a backup of the data, it might just be easier to drop the table and recreate it.... |
|
#6
|
|||
|
|||
|
RE: News Articles
Generally when that happens, simply open mysql (the client thingy, usually in c:mysqlbin in windows) and type :
REPAIR TABLE maraquita.news; That's always worked for me. |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > News Articles |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|