Jump to content

y2yang

Members
  • Posts

    59
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

y2yang's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks anupamsaha. Works like a charm. I owe you one.
  2. hello, can somebody help me here? Am I using the referrer correctly here? It's not working. I'm having syntax error.
  3. I don't think I did this part correctly: history.go(-1); <? if($session->logged_in){ history.go(-1); } else{ ?>
  4. header("Location: ".$session->referrer-1); I wanted for the referrer to go back twice. My situation: From home.php, I got to login.php, and login.php send a request to process.php, once process.php done the processing, it send the page back to login.php. What I wanted is for process.php to send the page back to home.php. How do I go about doing that? Here is what I have in process.php: function procLogin(){ global $session, $form; /* Login attempt */ $retval = $session->login($_POST['user'], $_POST['pass'], isset($_POST['remember'])); /* Login successful */ if($retval){ header("Location: ".$session->referrer-1); }
  5. I got it fixed by renaming my id manually, good thing it's only 1290 rows and i have to fix only 90 rows starting with row 1207. But I can see where this is going if I would to delete say row 100th and I have over 1000 row, that's about 900 rows to rename. Me being novice, there is most likely a better way to accomplish this. The thing that bothered me is that on id 1291, my last row, the image that showed up was in row 1290 and not the image from row 1291, as if row 1291 doesn't exist at all. I set it so that if the url's id is anything higher than the last row id, that it would return the real last row instead. My problem is probable better explained in an essay so I'll just move on but please answer this one last question. Does re-indexing my column id require it done manually or with a script? On the side note, I could create a row 1207 and put an image in the row 1207 that say "image no longer exist" so people linking to my pages would not get a different page when they visited the pages, so as to be consistence.
  6. Can I re-auto increment my id so no gap would be in between any number? say i have rows 1206 and 1208, but not 1207, and I want to re-number my id so no gap like 1207 is there. I use a code that call the title of the next and previous row as my link, but since there is no title on 1207, there is no title and and I don't want that. I use a + and - 1 code.
  7. <?php echo "<img src=\".../wallpaper/<?php print $row['img_large']; ?>"\>"; ?>
  8. I can create a new column no problem. What function or code would I need to achieve so that mysql would update the column everytime it's accessed? If it required long code, I can just go google it up, but if it's not long code can you show me how?
  9. How can I get this code: <select name="SearchField" id="SearchField" style="width:80px;" class="vam"><option value="title">Title</option><option value="body">Body</option></select> To achieve something like this code: <input type="checkbox" name="title" value="on" /> <input type="checkbox" name="body" value="on" /> What I want is to get a url something like this: .../list.php?SearchText=...&body=on&title=on I wanted the url to somehow, have BODY and TITLE as a string up there. I know this is not considered php but I don't know where else to post it.
  10. I would like to perform two condition in one else if statement. Here is my code: <?php } // end if elseif($Article == "1" && $numrows == 0){ ?> Don't know if this is right, but certainly it's not showing what I wanted. BTW, what is &, &&, % used mainly for in php? ...and by any chance would someone explain what this code do for me? Thanks. Been having it for a while but still don't know how it works; I don't feel so proud of myself ??? <?php if (!empty($count) && $count % $half_point == 0) { ?>
  11. Need for php to get field before current field and field after current field from mysql, sort of like a next and previous, only they're text file. Example: There are two of this in my HTML table: <?php print $row['title_main']; ?> I want the first one to do something like this: <?php print $row['title_main'] + 1; ?> And the second one to : <?php print $row['title_main'] -1; ?> Here is my code: <tr style="height:25px;"> <td><img src="http://image.vickizhao.net/style_guide/icn/icn_starhome_prev.gif" class="vam" alt="" /></td> <td class="tal fc14"><span style="margin:0 0 0 5px;"><a href="read.php?nPageNo=<?php echo $_GET['nPageNo']; ?>&Article=<?php print $prevpage; ?>"><?php print $row['title_main']; ?></a></span></td> </tr> <tr style="height:1px;"><td colspan="2" class="bgc9"></td></tr> <tr style="height:25px;"> <td><img src="http://image.vickizhao.net/style_guide/icn/icn_starhome_next.gif" class="vam" alt="" /></td> <td class="tal fc14"><span style="margin:0 0 0 5px;"><a href="read.php?nPageNo=<?php echo $_GET['nPageNo']; ?>&Article=<?php print $nextpage; ?>"><?php print $row['title_main']; ?></a></span></td> </tr> I got nPageNo to get the correct link id but not the Article. Here is my query: <?php // Connect to DB. // find out how many rows are in the table $query = "SELECT COUNT(*) FROM info_all"; $result = mysql_query($query, $conn) or trigger_error("SQL", E_USER_ERROR); $r = mysql_fetch_row($result); $numrows = $r[0]; // number of rows to show per page $img_per_page = 1; // find out total pages $totalpages = ceil($numrows / $img_per_page); // Get current page or set a default. if (isset($_GET['Article']) && is_numeric($_GET['Article'])) { // cast var as int $Article = (int) $_GET['Article']; } else { // Default page number. $Article = 1; } // end if // if current page is greater than total pages... if ($Article > $totalpages) { // set current page to last page $Article = $totalpages; } // end if // if current page is less than first page... if ($Article < 1) { // set current page to first page $Article = 1; } // end if // Get table information. $query = "SELECT * FROM info_all WHERE Article=$Article"; $result = mysql_query($query, $conn) or trigger_error("SQL", E_USER_ERROR); $row = mysql_fetch_assoc($result); // Get previous page number. $prevpage = $Article + 1; // Get next page. $nextpage = $Article - 1; ?> The code I used to get my nPageNo id is // Get previous page number. $prevpage = $Article + 1; // Get next page. $nextpage = $Article - 1; and I used <?php print $prevpage; ?> to get previous id <?php print $nextpage; ?> to get next id I would like to achieve something similar to <?php print $row['title_main']; ?>
  12. Ok solved after some googleing around. What I needed was adding WHERE Article=$Article to my query. Sorry forgot to mention field Article was my PRIMARY key.
  13. The print data works now but I can't seem to get the next row of data to display on my next ID. URL read.php?nPageNo=1&Article=2 should have displayed the second row of data but somehow it keep displaying the first row of data. I don't know what to do.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.