Jump to content

LooieENG

Members
  • Posts

    236
  • Joined

  • Last visited

    Never

Everything posted by LooieENG

  1. It does work http://ehwtf.com Posted by <a href="index.php?u=<?php echo $row['username'] ?>"><?php echo $row['username'] ?></a> on <?php echo date('d/m/Y', $row['time']) . ' at ' . date('H:i:s', $row['time']) ?> GMT Uses a timestamp stored in an INT column and works perfectly
  2. But that stores it like YYYY-MM-DD, having a plain timestamp is much better IMO.
  3. The way I did it, was insert time() to an INT column, and then when displaying it, I used <?php date('H:i:s', $row['time']); ?>
  4. <?php // Connect to mysql database $con = mysql_connect("localhost","user","password") or die(`Connection: ` . mysql_error());; mysql_select_db("logdata", $con) or die(`Database: ` . mysql_error()); mysql_select_db("logdata", $con); $consumed=$_POST['consumed']; $ProdNum=$_POST['ProdNum']; $copy = mysql_fetch_array(mysql_query("SELECT * FROM `SNAInv` WHERE `ProdNum`= `$ProdNum`")) or die(mysql_error()); $subtract = $copy[`QtyOnHand`] - $consumed; $sql = mysql_query("UPDATE `SNAInv` SET `QtyOnHand` = '$subtract' WHERE `ProdNum` = '$ProdNum'"); $sqlrun=mysql_query($sql) or die(mysql_error()); $hist = @mysql_query("INSERT INTO `SNAInvHist` (`ProdNum`, `ProdDesc`, `QtyOnHand`, `Consumed`, `RecvDate`, `ConSumDate`) VALUES (`$copy[ProdNum]`, `$copy[ProdDesc]`, `$subtract`, `$_POST[Consumed]`, `$copy[RecvDate]`, `Now()`)") or die(mysql_error()); echo "Inventory For Part Number:\n" .$copy[`ProdNum`] ." has been modified and a Transaction has been recorded "; echo "new Quantity is:\n" . $subtract; mysql_close($sqlrun,$con); ?> Does that work?
  5. So multiple pages would be better?
  6. <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> </ul> Is that what you mean? :-\
  7. Found this for you <?php function force_download($filename, $name ) { $filesize = filesize($filename); if($filesize) { ini_set('zlib.output_compression', 'Off'); /* IE FIX : FireFox Compatible */ header("Content-Type: application/application/octet-stream\n"); header("Content-Disposition: attachment; filename=\"$name\""); /* Read It */ $contents = fread(fopen($filename, "rb"), filesize($filename)); /* Print It */ echo $contents; exit; } else { return 0; } } ?>
  8. I mean like this http://ehwtf.com/a.php <?php if ( $_GET['page'] == 1 ) { ?> <h3>Page 1</h3> <p>Page 1 stuffs.</p> <?php } if ( $_GET['page'] == 2 ) { ?> <h3>Page 2</h3> <p>Page 2 stuffs.</p> <?php } ?> <p><a href="a.php?page=1">Page 1</a> | <a href="a.php?page=2">Page 2</a></p>
  9. Is this a good idea, or a bit pointless? I mean having something like <?php if ( $_GET['page'] == 'home' ) { // home page } if ( $_GET['page'] == 'page2' ) { // Load page 2 } ?> And then the tabs would be index.php?page=home Or is it better to use different pages?
  10. That's strange, it was working before cause I was playing it, but now it says forbidden. P.S. sorry for double-post, can't edit my last
  11. I think he means try hotlinking to it
  12. mysql_query("SELECT * FROM table WHERE where=something ORDER BY cid DESC") (or ASC for ascending order)
  13. $mail->setFrom('Photography <"' . $email . '">'); (if you want "Photography <"email@domain.com">") or $mail->setFrom('Photography <' . $email . '>'); (if you want "Photography <email@domain.com>") or $mail->setFrom('Photography ' . $email); (if you want "Photography email@domain.com")
  14. echo '<a href="#" onclick="toggleItem(\'myTbody\')">Toggle</a>'
  15. Nope, you can't download the source code for a PHP file, because it runs on the server and produces HTML output. But I also have this in my .htaccess file <files db.php> order deny,allow deny from all </files> And, if you're still a bit worried, you could place it below the web root, i.e. instead of /var/www/db.php place it under /user/yourname/db.php and call it using <?php require('/user/yourname/db.php'); ?> I think that's right anyway
  16. Could you take a look at this and say what needs improving (code wise) http://ehwtf.com/blog.zip There's an install script in there, and I don't know what it will and won't work on, but my host uses PHP5 and MySQL5. You'll need to make a database first. Example http://ehwtf.com P.S. I know I went a bit OTT with the comments lol, and I don't know about classes/OOP so please don't post stuff like "change this to $this->" or whatever Also, the install, login and admin script don't have any styles, and the sidebar has nothing there, but I was doing it for the PHP practice. Thanks.
  17. column called "time" type "int" value "time()" And when you need to post the time like 05:42:21, you would do <?php echo date('H:i:s', $r['time']); ?> Edit: Column, not table lol
  18. Ah, I think I kind of get what you mean. So when people use $db->stuff it does all the database connect stuff?
  19. SELECT customer.name from customer,order WHERE order.userid = customer.userid AND placed.order = 0 Edit: I think I read it wrong, lol
  20. I've been reading up on it, and I'm just wondering, what's the difference between using classes, and an external php page with functions on it? =/
  21. Store them as "t1,t4,t6,t7" and then when you retrieve the data, <?php $sess = explode(',', $row['sessions']); ?> And then <?php echo $sess[0]; ?> Would return "t1"
  22. Hi, For some reason every time I go to login with any password I can get through, so even if the password is not the one for my account I can still see the message "Login Succesful". <?php mysql_connect($db_host,$db_username,$db_password) or die(mysql_error()); mysql_select_db($db_database) or die(mysql_error()); $username = $_POST['username']; $password = $_POST['password']; $secpass = md5("2392j3k2js21".$password.$username); // Retrieve all the data from the "example" table $result = mysql_query('SELECT * FROM owners WHERE username="$username"') or die(mysql_error()); // store the record of the table into $row $row = mysql_fetch_array( $result ); // Print out the contents of the entry if ($secpass == $row['password']){ echo ("Login success!"); } else { echo ("Login Error!"); } ?> Does that work?
×
×
  • 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.