Jump to content

Stryves

Members
  • Posts

    79
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling
  • Location
    Toronto, ON

Stryves's Achievements

Member

Member (2/5)

0

Reputation

  1. Use Sessions? That way when they view the first page you can update their $_SESSION['firstpage'] variable or something. With Sessions you could have this all on one page, and this display only what they are supposed to see.
  2. If Else? $sql = "SELECT DATEDIFF (ThinDate, CURDATE()) AS intval FROM `vegeschedule` "; $result = mysql_query($sql); if (!$result) { echo "Could not successfully run query ($sql) from DB: " . mysql_error(); } else if (mysql_num_rows($result) == 0) { echo "No rows found, nothing to print so am exiting"; } else if ($result <= 0) { echo "N/A"; } else { while ($row = mysql_fetch_assoc($result)) { echo $row["intval"]."<br />\n"; } }
  3. I'm guessing it's the redirect after the message is sent. The if($sent) then header: blah blah thankyou.html
  4. I'd do it like this <?php include('include/function.php'); session_start(); if(isset($_SESSION['userName'])) { echo $_SESSION['userName']; } else { echo "<META HTTP-EQUIV = 'Refresh' Content = '0; URL =login.php'>"; } ?> <html> <head> <title>Home</title> </head> <body bgcolor="cyan"> <center></br></br> Home View <a href="login.php">Logout</a> </form> </center> </body> </html> And for the logout: <?php session_start(); unset($_SESSION['userName']); echo "<META HTTP-EQUIV = 'Refresh' Content = '0; URL =login.php'>"; ?> I changed the redirect to login, because the index should redirect them to login now anyways.
  5. You allow any type of file to be uploaded? That's scary!
  6. So let's say I run a query: <?php $query = "SELECT * FROM table"; $result = mysql_query($query) or die(mysql_error()); $array = mysql_fetch_array($result) or die(mysql_error()); ?> So now I would use $array['ID'] somewhere in my code... Isn't this a Global Variable considering it can be used almost anywhere?
  7. I have this <?php include "summary.php"; include "stufftodo.php"; ?> I want the summary to load AFTER stufftodo is ran... Or at least show at the top of the page. The problem is obviously if it loads first, it will load out dated data. I'd like the summary to be that the top of the page, and not at the bottom or on the right side. Is there anyway to have a php wait for the whole page to process before it loads something that's before it?
  8. $query = "SELECT * FROM vehicles ORDER BY somecolumn DESC, somecolumn2 LIMIT 10 "; If you want to go from highest to lowest, add DESC beside the column name, otherwise it's always ascending. Just put a comma between the 2 column names.
  9. "Also, you can add in a WHERE `clientname`='NAMEHERE' to show one result, with position" Oooo nice, I didn't know if the where clientname=clientname was used, it would still show the position. I'll give it a whirl, thanks a lot!
  10. Haha, that was my concern as well... I was using the i++ increment to determine the position, but it's always better to make the DB do the work. My other solution was creating a table for results, and cron job it to run/refresh every night... Just have static results per day. I wasn't sure if there was an easier way to do this... Guess not
  11. The query is is running, from top sales down. $i=1 when the while is running, if the client name is not the current result, i increments, and then the while runs again. If the clientname is matched during the 5th run through the while, the $clientrank = 5. This way I'd know they are 5th best in sales.
  12. Yes I could, but then it would just show me how many sales they have. I was hoping to determine where they rank VS the other staff.
  13. $query = "SELECT * FROM vehicles LIMIT 10"; Additionally, you can use the following to order by the somecolumn being a real column to select what area of first 10 you want. $query = "SELECT * FROM vehicles ORDER BY somecolumn LIMIT 10 ";
  14. I'm trying to determine what place someone is based on a query. <?php Query is "SELECT clientname, sales FROM clients ORDER BY sales DESC" $i=1; while($query) { if($query['clientname']==$_POST['clientname']) { $clientrank=$i; } i++; } ?> Is there any easier way to do this?
×
×
  • 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.