Jump to content

Yesideez

Members
  • Posts

    2,342
  • Joined

  • Last visited

Everything posted by Yesideez

  1. Whenever I use the CODE and /CODE tags to surround my code I always have to go and edit my post to re-format the code as actual tabs seem to get added in at seemingly random places. I don't have any tabs in my code as I only ever use spaces and two spaces per intent level.
  2. FIXED! Somehow my try...catch section, the die() statement I've passed it two parameters as the . to concatenate strings turned into a comma. No idea how that happened but I've changed it to a . and it's all now working perfectly. Although I have no error message appear telling me there was a problem with it.
  3. I've got XAMPP installed onto two machines. This (my primary machine) is running Manjaro and my laptop behind me is running Mint. I've rebooted my laptop and I can no longer find any application in the launch menu (Start menu on Windows) called LAMPP or XAMPP. Tried typing LA and XA and get nothing returned. How do I launch it please?
  4. I have the following code and yesterday this was working and now I get nothing sent to my browser... <?php ini_set('display_errors','1'); //only during development ini_set('display_startup_errors','1'); //only during development error_reporting(E_ALL); //only during development $options=[ PDO::ATTR_EMULATE_PREPARES => false, // turn off emulation mode for "real" prepared statements PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, //turn on errors in the form of exceptions PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, //make the default fetch be an associative array ]; try { $pdo=new PDO("mysql:host=localhost;dbname=polthouse",'root','',$options); } catch (PDOException $e) { die('Connection failed: ',$e->getMessage()); } phpinfo(); ?>
  5. Thanks guys, I've changed it all over to PDO and finding it a lot easier. I decided to use MySQLi as I'd previously used MySQL years ago and thought it would be the natural progression and had no idea about PDO.
  6. Is it possible to get the number of rows returned when using a SELECT query and a statement? $sql="SELECT * FROM users WHERE username=? AND password=? AND active=1"; $stmt=$db->stmt_init(); if ($stmt->prepare($sql)) { $stmt->bind_param("ss",$uname,$pword); $stmt->execute(); $stmt->bind_result($id,$username,$password,$level,$added,$edited,$active); $stmt->fetch(); echo "Matched: ".$stmt->num_rows.'<br>'; echo "id: ".$id."<br>Added: ".$added."<br>"; $stmt->close(); The "Matched" line always gives me 0. I've tried added parenthesis to make it num_rows() and I still get 0 regardless of whether my query returns data from my table or not. I've checked in the PHP manual and it doesn't give an example using a statement.
  7. Correct - Noticed that just after I posted it and couldn't figure out how to delete my post. I missed another later on as well. For some reason it gives me error messages but I don't get error messages when I miss a semi-colon 😕
  8. It's been many years since I did any of this stuff and just getting back into it. I did think of posting this in the mysql section but it's more of a code problem. I have the following... $db=new mysqli(host,username,password,database); $sql="SELECT * FROM users WHERE username=? AND password=?"; $stmt=$db->stmt_init() That last line where I call $db->stmt_init() I get an empty browser - absolutely nothing where I should have a load of HTML appear. I have written the rest (just in case it matters) which is: if ($stmt->prepare($sql)) { $stmt->bind_param("ss",$uname,$pword) $stmt->execute(); $stmt->fetch(); echo "id: ".$id."<br>Added: ".$added."<br>"; $stmt->close(); }
  9. Take a look at PHPMailer. http://phpmailer.worxware.com/ It's free to download and use and is fairly simple to set up, should be what you're looking for.
  10. You can use Javascript to hide the submit button as soon as it is clicked. Just a thought.
  11. Just remembered - some land line numbers in smaller villages are still only 5 digits so where mobile numbers will always be 11 digits, land line (01) numbers can be either 10 or 11 digits. 01xxxxxxxx or 01xxxxxxxxx or 07xxxxxxxxx
  12. I've got a site where users can make posts and I need to check for the presence of phone numbers. Phone numbers can either be 01xxxxxxxxx or 07xxxxxxxxx depending on land line or mobile (total of 11 digits). I think the easiest way to check is to strip out any non-numeric character (can this be done with regex?) which will bring all numbers together, then check with a much simpler regex. I need an if() to check for the presence of either number and return true or false. Big problem is, I've tried to learn this (wasted many hours) and can't get my head around it. Any help would be gratefully appreciated.
  13. I'd like to submit Web Once to the list. http://www.webonce.com I use these and they're absolutely great. What I really like about them is that they have live support via IRC where you can talk to their tech guys 24 hours. If no-one is present then you can leave a message and someone gets back to you. They're really cheap and offer great service. I've had very little down time that I've noticed and can honestly say they're better than all the others I've used.
×
×
  • 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.