sKunKbad
Members-
Posts
1,832 -
Joined
-
Last visited
-
Days Won
3
Everything posted by sKunKbad
-
try <? echo $_GET['id']; ?> the location of the closing semi-colon might make a difference you would of course have to remove the one that is a couple lines down
-
Try this at the top of your page: ini_set('display_errors', 1);
-
I believe what I've seen is a simple check of the HTTP_Referer, and redirect to somewhere else or block access to anything that isn't from your domain.
-
I figured it out. Adding: $pdo2->closeCursor(); before $sql = $pdo->prepare("SELECT * FROM tipsntricks WHERE tipType = '$searchType'"); was all that was needed.
-
I see your point 100%, but that is why I am so confused. Look at the samples in the documentation: PDOStatement->execute(). I am using this PDO statement just as they are, am I not?
-
Well the second set of code above works, so I was just wondering why the first doesn't. Both have the same: $sql->execute(); but the first set of code doesn't work, and the second does. Do you see what I'm talking about?
-
Why do I get: Fatal error: Call to a member function execute() on a non-object in /home/content/test/pdotest2.php5 on line 18 <?php ini_set('display_errors', 1); try{ $pdo = new PDO('mysql:host=1.secureserver.net;dbname=tips', 'tips', 'ChromeDomeX'); foreach ($pdo->query('SELECT * FROM tipsntricks WHERE tipType = "performance"') as $row) { echo "<p>Tip number " . $row['tipNum'] . " is:<br />"; echo $row['tipTitle'] . "</p>"; } $pdo2 = $pdo->query('SELECT * FROM tipsntricks WHERE tipType = "aerodynamics"'); $result = $pdo2->fetch(PDO::FETCH_ASSOC); extract($result); echo "<p>Tip number " . $tipNum . " is:<br />"; echo $tipTitle . "</p>"; $searchType = 'endurance'; $sql = $pdo->prepare("SELECT * FROM tipsntricks WHERE tipType = '$searchType'"); $sql->execute(); $numRows = count($sql->fetchAll()); if ($numRows != 0){ echo "Number of $searchType tips: " . $numRows; }else{ echo "There are no $searchType tips, sorry."; } $pdo = null; } catch(PDOException $e){ echo $e->getMessage(); } ?> This works fine, but I was hoping to have only one object: <?php ini_set('display_errors', 1); try{ $pdo = new PDO('mysql:host=1.secureserver.net;dbname=tips', 'tips', 'ChromeDomeX'); foreach ($pdo->query('SELECT * FROM tipsntricks WHERE tipType = "performance"') as $row) { echo "<p>Tip number " . $row['tipNum'] . " is:<br />"; echo $row['tipTitle'] . "</p>"; } $pdo2 = $pdo->query('SELECT * FROM tipsntricks WHERE tipType = "aerodynamics"'); $result = $pdo2->fetch(PDO::FETCH_ASSOC); extract($result); echo "<p>Tip number " . $tipNum . " is:<br />"; echo $tipTitle . "</p>"; $pdo = null; } catch(PDOException $e){ echo $e->getMessage(); } ?> <?php $pdo = new PDO('mysql:host=1.secureserver.net;dbname=tips', 'tips', 'ChromeDomeX'); $searchType = 'endurance'; $sql = $pdo->prepare("SELECT * FROM tipsntricks WHERE tipType = '$searchType'"); $sql->execute(); $numRows = count($sql->fetchAll()); if ($numRows != 0){ echo "Number of $searchType tips: " . $numRows; }else{ echo "There are no $searchType tips, sorry."; } $pdo = null; ?>
-
Ok, this works: $pdo = new PDO('mysql:host=p6mysql1.whatever.net;dbname=tips', 'tips, 'ChromeDomeX'); $sql = $pdo->prepare('SELECT * FROM tipsntricks WHERE tipType = "performance"'); $sql->execute(); echo "Number of rows: " . count($sql->fetchAll()); $pdo = null; but there can't be any SELECT queries above the prepare statement.
-
I still can't get it to do what I want to do. Here is my standard connection / query / echo script: <?php try{ $pdo = new PDO('mysql:host=p13mysql65.secureserver.net;dbname=tips_table', 'tips_table', 'ChromeDomeX'); foreach ($pdo->query('SELECT * FROM tipsntricks WHERE tipType = "compatibility"') as $row) { echo "<p>Tip number " . $row['tipNum'] . " is:<br />"; echo $row['tipTitle'] . "</p>"; } $pdo2 = $pdo->query('SELECT * FROM tipsntricks WHERE tipType = "performance"'); $result = $pdo2->fetch(PDO::FETCH_ASSOC); extract($result); echo "<p>Tip number " . $tipNum . " is:<br />"; echo $tipTitle . "</p>"; $pdo = null; } catch(PDOException $e){ echo $e->getMessage(); } ?> and for instance, I need to be able to check to see how many tips are in the performance catagory, and I need the script to return a number, like how mysql_num_rows works. If there are 4 performance tips, I need the script to return 4. I tried the script in example 2 on the rowCount page, but it's not working.
-
oh! I was looking at the second part of the first example. Thanks, I'll give it a shot.
-
rowCount doesn't work for SELECT statements
-
I may not have been specific, but I'd like to know the number of rows in the query result, not the entire table. My example query would return the entire table, and that's not what I'm after. If for instance my query was to return 3 rows, I'd like a function(method) that returns 3, like mysql_num_rows.
-
I need the PDO equivalent of mysql_num_rows. I thought this would work but it doesn't: $numrows = $pdo->query("SELECT * FROM tipsntricks")->fetchAll(); echo "There were " . count($numrows) . " rows in the table"; anybody know?
-
change the order in your query to the database. see http://www.w3schools.com/sql/sql_orderby.asp
-
kabs, don't do that. Look for some tutorials on Mod Rewrite.
-
Call you host. Make them work for their money.
-
The best way is just to do it. Download WAMP or XAMP and read a good book.
-
an inc file is just another php file but with the inc extension. You shouldn't use inc as your file extension unless you are sure that your php will process them, otherwise people may be able to view your script. You should probably use something like "include.inc.php" instead.
-
I can't even access your site. Sounds like you have been hacked?
-
I have been using a secured folder on my server. I have the standard .htaccess authentication file in that folder, and standard .htpasswd file elsewhere. Today I noticed that I could type in quite a few passwords with my username that would pass authentication, even though they were not valid passwords. Most of the time the authentication works, but when the non-valid passwords were pretty close to the real password, access to the folder was allowed! .htaccess: AuthUserFile /home/content/r/b/g/rbgwebdesign/html/.htpasswd AuthGroupFile /dev/null AuthName "Confidential" AuthType Basic require valid-user .htpasswd rEalaDmin:cw3B.SFCbETnM The ecrypted password is 'wHateverDood', but the problem is, I have been able to gain access with passwords like: wHateverD00d, which is zeros instead of letter o's. wHateverDnnd, which is obviously not even close. wHateverDmmc, which is not even close. wHatevereeee, which is not even close. So I guess my question is, how strong is this method of authentication? It seems pretty weak, and I don't think I'm doing anything wrong. If the password is wrong in the first few letters, then access is not granted. Is there some limit to the number of letters that the password is good for??
-
I dont see a point of using preg_match_all if you aren't going to generate an array from back references inside your regex.
-
smashingmagazine.com had a nice article last week about sending html email. In the article was a service that writes a whitelist html page for you, so that your customers know to whitelist you on their ISP. I learned alot about sending email from the article, and I think there are issues that relate to your emails because they include links which are HTML.
-
You are going to have to loop through the array and then output your checkboxes for each checkbox array value.
-
Is there a reason why previous records and current records can't be kept in the same table? If not, you could have two seperate queries, and as long as the names of the fields of each table aren't the same, you could merge the two arrays together, extract the array into variables, and then output as desired. I would simply create select queries by user ID, customer number, or something similar.
-
Setting the actual session cookie lifetime is easy, but I have no idea how to tell the server how long to hold on to cookie info that hasn't been unset. Good question.