1) I used datetime in my database as 00/00/0000 00:00:00 format and i want to convert it to M/D/YY or something... how can I do that? Is there a good tutorial out there that I can UNDERSTAND from? Yes I have used google to find a such tutorial and I haven't found one that I do understand.... there's just a function or something similar.. and I need to create it by my hand because I'm doing it for my portfolio so I have to say that it's 100% mine and I actually understood what I was doing. So... anybody knows a good one?
2) I have viewing page where people view an original image at a time.. and I wanted to make "<<PREV - 1 of 100 images - NEXT>>" thing so they can nagivate easily while they are viewing the images... my database doesn't have IDs in it so I'm wondering if there is a way to get a current row number from the database like... get $row['name'] row then echo what the number of that row is.. like 4th row or something. I am putting it in ORDER BY date DESC order... and I want it to figure out the row number it is without having to use IDs. Is there a such way to do that?
My aplogoies if I posted it in the wrong section.
Last edited by Dm7 on Tue Oct 18, 2005 5:43 pm, edited 1 time in total.
Each url should reference the offset to where the page should jump into the database query results. You then use the LIMIT or similar logic in your given DBMS.
I got it working... (the date format thing.. ) thanks
Anyways.. for picture sliding or whatever.. I use $pix to call $_GET[pix] from the url which would be something like view.php?pix=icecream.jpg so how can I identify which row it is in by using $pix var... my sql query is something like..
That's how I select the row where I wanted it to be... so how can I use that query to get row number as well..... and use that for next row number and prev row number so I can call name column for next/prev so I can make a url that would be like this after being reviewed by php first.
I'm not sure if I'm clear enough... but the reason I'd need to get the number of that selected row so I can get the number for the image.. like 30 out of 102 total images... I can do the total rows without any problems, but I'm suck with how to get number from selected name column by using url referring $pix which would be the filename of that image... so I want to get something like...
instead of using the filename as a pagemarker, it would be better to use the offset (or row number) and utilize the LIMIT in mysql to get what you want.
the reason why I wanted to use view.php?pix=blah.jpg is because so people can nagivate my viewing page easily and possibly be able to memorize the url easier rather than having view.php?offset=1
I just want to be able to get row number from the name row... like if pix is blah.jpg so it searches for blah.jpg in name column in db, then determines which row it is in (like 3rd row) so I can use that for 3 out of 100 images (which I can do with mysql_num_rows(); function).. I just need to know what row it is in... but I think the easiest way is to use ids. Unless you have another idea.
because so people can nagivate my viewing page easily
you can read about SQL_CALC_FOUND_ROWS here
use this together with LIMIT clause.
SQL_CALC_FOUND_ROWS will enable you to know how many records there are total and LIMIT selects only specific range/record
there are probably other way too...
and possibly be able to memorize the url easier rather than having view.php?offset=1
because so people can nagivate my viewing page easily
you can read about SQL_CALC_FOUND_ROWS here
use this together with LIMIT clause.
SQL_CALC_FOUND_ROWS will enable you to know how many records there are total and LIMIT selects only specific range/record
there are probably other way too...
and possibly be able to memorize the url easier rather than having view.php?offset=1
do you think there are peolpe who memorize links?
Argh I'm stupid. I dont understand how it works...and how can i use LIMIT clause when I use WHERE clause to get what I want. care to give me some examples?
And uh.. I do memorize links.
// BETA VERSION!!!
$sqltest = "SELECT SQL_CALC_FOUND_ROWS(name) FROM $table WHERE name ='$pix'";
$results3 = mysql_query($sqltest);
$test = mysql_fetch_array($results3) or die ("Error ". mysql_error());
echo $test[0];
assuming i understand your problem correctly..you could do the following...
show the first blurgem(blurgem being how many results they requested) by using a limit statement.and then on page two use this nifty function.. http://us2.php.net/mysql_data_seek
along with the proper modifier to start at said row along with result..and then using some nifty URL manipulation you should be able to accomplish what you were asking..you're welcome;)