Yesideez
Members-
Posts
2,342 -
Joined
-
Last visited
About Yesideez
- Birthday 10/19/1973
Contact Methods
-
Website URL
http://www.pictureinthesky.net
Profile Information
-
Gender
Male
-
Location
Devon, UK
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Yesideez's Achievements
-
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.
-
Connection problems and no error messages output
Yesideez replied to Yesideez's topic in PHP Coding Help
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. -
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?
-
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(); ?>
-
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.
-
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.
-
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 😕
-
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(); }
-
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.
-
You can use Javascript to hide the submit button as soon as it is clicked. Just a thought.
-
Checking for the presence of one or more number sequences
Yesideez replied to Yesideez's topic in Regex Help
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 -
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.
-
A friend has a company on which he currently has a database in MS Access 2007 which is shared on his local network in the office. When he designed and created the database he didn't link two main tables together and now it's grown to over 12,000 records he's asked me to take a look at it. I've successfully converted the data over to MySQL although we're unsure my code has auto linked all the data together that should be so this will require some time in itself. The reason I've emigrated it to MySQL is because there's some things he's asked me to do for him like generate PDF files on the fly of properties when desired and other stuff where PHP is ideal. Ideally he'd like to keep his database running on MS Access because he knows how to edit this (very much still a beginner although he's much better than I am) and he wants to make sure he'll not become unstuck in the future if his database needs attention and I'm not around - him learning PHP/MySQL/HTML is not an option. I've heard PHP can talk to a MS Access database but I've no idea where to start with this - I have dyspraxia so learning how this could be done might take a very long time. He'd also like to give clients a login so they can view/progress info on their properties and logins for his staff so they can view their stuff. All this I can do but the initial problem is his database. It only has two tables, one listing all his customers and the second listing all the work carried out. Although all properties relate to data in the work table not all work can relate back as some work would be a one-off job. What I'd like to know please is how would you tackle this?
-
I thought this was going to be a pig. The option of only limiting certain words isn't really possible due to the nature of the site. I did think of trying soundex but then, splitting a subject string into separate words then calculating soundex for each and comparing was again a bit off as soundex values aren't unique and, well, soundex values are strings so we're back to square one. Tricky. I think this idea will be binned.
-
Without any type of help regarding what it is you want to achieve it's pretty difficult but if your "id" field is set to AUTO_INCREMENT then it might not return anythign as AI starts counting at 1 and never 0. If you want to return the total you can use this instead: $total = mysql_query("SELECT COUNT(*) AS total FROM comments WHERE id=0"); $row=mysgl_fetch_assoc($total); echo $row['total']." Clicks\n"; If you're not wanting the SUM() then try TOTAL() but not sure entire what it is you're wanting to do.