Jump to content

newest_oldest.php (member search)


Scotty13

Recommended Posts

this is my script....

<?php

// connect to your MySQL database here

require_once "connect_to_mysql.php";

// Build the sql command string

$sqlCommand = ("SELECT * FROM myMembers ORDER BY dateField DESC LIMIT 6");

// Execute the query here now

$query = mysql_query($sqlCommand) or die (mysql_error());

// Output the data here using a while loop, the loop will return all members

while ($row = mysql_fetch_array($query)) {

// Gather all $row values into local variables for easier usage in output

$id = $row["id"];

$firstname = $row["firstname"];

$lastname = $row["lastname"];

$country = $row["country"];

// echo the output to browser

echo "Item ID = $id

<br />Item firstname = $firstname

<br />Item lastname = $lastname

<br />Item country = $country

<hr />";

}

// Free the result set if it is large

mysql_free_result($query);

// close mysql connection

mysql_close();

?>

 

When I test it in my browser, I get this error message...

Unknown column 'dateField' in 'order clause'

Please Help & Thanks in Advance,

Scotty13

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...