my table structure is

id|passport|stamp|postcard|poster|greetings|collage|
 1|2        |3   |4        |
 2|7|       6     |

................like this..

i want to show ma users the most recent entry....i am successfully able to show the entries but..my php script is showing all the earlier and recent records..i want to show just the last record inserted.
            or
            i want to update the last record of the above table and show my users.please help if anybody can....

Recommended Answers

All 15 Replies

Try this to take last record:
SELECT * FROM yourtable ORDER BY id DESC LIMIT 1;

@ albucurus...BRO you know what???...you are a genius :) thank you...

hey would it be possible for you to check out my post "photo Gallery"?.it would be a great help to me again :)

Member Avatar for diafol

I fail to see how the question is related to the title.

how to update all records of a table

Do you still need this info?

hey diafol i was waiting for ur rply regarding "price list" but my post remained unnoticed,newaz if possible den can u please help me out with the "photo gallery" where customers can upload as many pix they want in their individual albums...and order any number of any of the photos..
customers are provided with two input fields 1)total number of photos 2)option button(photo type:-passport,stamp,poster etc)...hope i have provided you the basic idea..

Member Avatar for diafol

hey diafol i was waiting for ur rply regarding "price list"

Sorry, must have missed that.

Do you have any php code of forms for uploading to the 'gallery'?

ya i have but its not solving the purpose..the photos are getting stored in a temporary folder instead of dataabase..moreova..i want 2 input fields.1)for entering number of photos of a particular type 2)option button for selecting phototype(passport,stamp,poster,postcard etc)..and after clicking on the "order now" button i want to show the customers the total price of the order(number of photos*price of photo type)retrived from "pricelist".

Member Avatar for diafol

Perhaps if you show us your code, we could help you tweak it in order to get it to work. Otherwise, you're asking somebody to code it for you from scratch and I don't think that's what this site is about.

<form action=addMember.php method=post enctype="multipart/form-data">
<table border="0" cellspacing="0" align=center cellpadding="3" bordercolor="#cccccc">
<tr>
<td>File:</td>
<td><input type="file" name="filep" size=45></td>
</tr>
<tr>
<td colspan=2><p align=center>
<input type=submit name=action value="Load">
</td>
</tr>
</table>
</form>
//processor
<?

if ($_POST["action"] == "Load")
{
$folder = "images/";

move_uploaded_file($_FILES["filep"]["tmp_name"] , "$folder".$_FILES["filep"]["name"]);

echo "
<p align=center>File ".$_FILES["filep"]["name"]."loaded...";

$result = mysql_connect("localhost", "******", "*****") or die ("Could not save image name

Error: " . mysql_error());

mysql_select_db("project") or die("Could not select database");
mysql_query("INSERT into dbProfiles (photo) VALUES('".$_FILES['filep']['name']."')");
if($result) { echo "Image name saved into database

"; }

}

?>
//authentication
<?php

// filename: upload.success.php

?><!DOCTYPE HTML PUBLIC 
>

<html lang="en">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">

        <link rel="stylesheet" type="text/css" href="stylesheet.css">

        <title>Successful upload</title>

    </head>

    <body>

        <div id="Upload">
            <h1>File upload</h1>
            <p>Congratulations! Your file upload was successful</p>
        </div>

    </body>

</html>

i am able to code this much.n what i need is already mentioned above.now all upto you diafol.

Click Heremy website concept is somewhat like this..please check it out for reference @diafol

Member Avatar for diafol

Don't personalise the help you require. I was speaking in general in order for a wider audience to start participating. I will be "off the grid" for a week, so I may not be in a position to help you.

personalise?now what does that mean?& dude the deadlines of my project are actualy kicking off my brains sanity.so its my request to YOu as well as any of your alies to consider my subject matter.i would be obliged :)

hi there
Saw this query on line 31
mysql_query("INSERT into dbProfiles (photo) VALUES('".$_FILES['filep']['name']."')");

change it to this
mysql_query("INSERT into dbProfiles (photo) VALUES('".$_FILES['filep']['tmp_name']."')");

Member Avatar for diafol

personalise?now what does that mean?

Meaning directed at me :) as in:

now all upto you diafol.

Now this:

dude the deadlines of my project are actualy kicking off my brains sanity

is of course important to you, but of very little relevance to us. We help when we can, we're all volunteering here.

Anyway, your question is referring to uploading files, but then you go on about buying photos and pricelists. This is getting confused.

$filename = $_FILES['filep']['name'];
$query = "INSERT into dbProfiles (photo) VALUES('$filename')"
mysql_query($query) or die( mysql_error());
echo $query;

If it fails with no error, copy the sql query echoed to the screen and run that in the SQL window in phpmyadmin - see what error message it gives.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.