|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
more issues
okay, I was reading php / mysql tutorial, and I thought, lets try a news script, but I get this error
Parse error: parse error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/gmflp/public_html/test.php on line 19 here is my code |
|
#2
|
|||
|
|||
|
RE: more issues
Try changing the following:
while($myrow = mysql_fetch_array($result)) { echo( "<b>".$myrow['title']."<b>- posted by <a href=mailto:".$myrow['email']."class="gmflp">".$myrow['name']."</a>".$myrow['date'] ); echo( "<br>".$myrow['news'] ); } |
|
#3
|
|||
|
|||
|
RE: more issues
thanks for that man, it works now, is there anyways of reversing the data?? and how to show a selected No. eg, show the last 5?
|
|
#4
|
|||
|
|||
|
RE: more issues
You can use "ORDER BY" to get your results in ascending or descending order.
ex: ORDER BY _fieldName_ desc You can use "LIMIT" to only get a certain amount returned in your result. ex: LIMIT _number_ So in order to get what you asked for the last 5, you would use something like this: SELECT * FROM newsdb ORDER BY _fieldName_ LIMIT 5 Hope that helps. |
|
#5
|
|||
|
|||
|
RE: more issues
ah, thank you, works like a charm. Now does anyone know how I could add a comments section on my news program??
|
|
#6
|
|||
|
|||
|
RE: more issues
also, I have timestamp on the date at the moment, I was wondering how I can change the date into Monday, June 10th 8:25pm
|
|
#7
|
|||
|
|||
|
RE: more issues
|
|
#8
|
|||
|
|||
|
RE: more issues
okay, so I want to format the date like this date("F j, g:i a"); would I have to format it before it goes to the database or when its displayed?
|
|
#9
|
|||
|
|||
|
RE: more issues
say.. $timestamp = 1002990103083;
then.. print(date("F j, g:i a", $timestamp)); |
|
#10
|
|||
|
|||
|
RE: more issues
I get unexpected T_VARIABLE when I put that in
|
|
#11
|
|||
|
|||
|
RE: more issues
uhh sorry it needs to be formated properly.. um. try
echo date("F j, g:i a", $timestamp); or (' single quotes ') print(date('F j, g:i a', $timestamp); ya know.. |
|
#12
|
|||
|
|||
|
RE: more issues
sorry to bug u again mate, appreciate the help, but where ever I put
echo date("F j, g:i a", $timestamp); I just get December 31, 7:00 pm and still the same 20020610162214 printed too |
|
#13
|
|||
|
|||
|
RE: more issues
HMM.. not sure how ur doing it but try this.
$timestamp = "20020610162214"; $display = date("F j, g:i a", $timestamp); print("$display"); it should work i don't see any reason why it wouldn't work :-/ |
|
#14
|
|||
|
|||
|
RE: more issues
|