-
-
mine wamp is ****ed up
First off: mysqli_connect() is better. mysql_connect() is not technically depricated, but is highly discouraged. Secondly: the same thing happened to me a long time ago. Instead of wasting my time fighting with it, I just let it be. It's a local server, so it's not a big deal. Just make another database and name it something else.
-
PHP Security
http://www.sitepoint.com/books/phppro1/
-
Chat application with Ajax, won't send message to db
URL Encode your strings to be sent through AJAX. I know that # signs are a common issue when being ajax'd, and that everything should be turned into an html entity. If that's not the problem, perhaps there is a problem when inserting the information into the DB.
-
getting location for SEO
Of course. HTML5 offers Geolocation, which is nice. A lot of web bots and crawlers don't use too much javascript, so you'd need to get the Geolocation info and send it to the server through the URL. The catch, however, is that the user must accept to show his/her location.
-
PHP MySQL real time chat application without JavaScript
Instead of an infinite loop you could use HTML5 SSE (technically is JS).
- 8 replies
-
- php
- mysql
- javascript
- chat
-
Tagged with:
-
Anyone know a really simple PHP script for news and comments?
Writing one from scratch isn't hard, just a little time consuming if you aren't familiar with all the aspect, such as connecting to your database. You could hop on google.com and search for "Lightweight PHP CMS" and you'll get roughly a dozen decent, light weight, and simple CMS's.
-
CSS3 or hacks for Interntet Explorer 8 & below
In my personal opinion (and it's just that, an opinion) I wouldn't bother with non conforming browsers. You can tell if a user has an html5 browser (which is fairly safe to assume they have CSS3 on the same browser), and if they can't use html5 give them a popup telling them to update their browser. Or do as Germany did and tell people not to use IE haha. Google made a bold move to push html5, even on people using older browsers. However, http://dimox.net/cross-browser-border-radius-rounded-corners/ seems to be a decent article on rounding corners in IE7 and 8.
- The menu is lost in IE
-
-
Need help targeting IE7 & 8
You can also try adding <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> To your <head></head> section. This tells the browser to render the page as the latest version of IE.
-
Creating a simple page that updates using textarea content
First, you should use <textarea></textarea>. By not using the closing tag it could contribute to the problem (but probably isn't). When you use the "w" command in PHP with fopen() you are telling PHP to make a new page every time. $dateposted.html is referring to the variable called $dateposted, which is going to change from day to day. To solve all of this, use one file name such as "posts.html" - don't use a changing variable in the file name, And I would conjugate all the information together before writing to the file. Then, when it's time to write to the file, you'll want to append the data using the "a" action. This will not over write the file ever time someone posts something. <html> <head> </head> <body> <form name="form1" method="post" action="save.php?saving=1"> <textarea id="date" name="date" cols="10" rows="1"></textarea> <textarea id="author" name="author" cols="10" rows="1"></textarea> <textarea id="post" name="post" cols="60" rows="1"></textarea> <input type="submit" value="Save"> </form> </body> </html> And then for the PHP I'd use something like: <?php $file = "posts.html"; // no variable in the value, it won't change. if(!file_exists($file)) { // use blank fopen($file, "w") to create the file } $date = "<div>".$_POST['date']."</div>"; $author = "<div>".$_POST['author']."</div>"; $post = "<div>".$_POST['post']."</div>"; $conjugatedString = $date . $author . $post; // now we know the file exits for sure, we can append data to it $fp = fopen($file, "a") or die("Error"); fwrite($fp, $conjugatedString); fclose($fp); echo "Saved $author's post in $file"; ?> Try that out, let me know if that works for you.
-
How to show search results under the search box?
Using CSS (position:relative and position:absolute, with display:none) you can position a hidden element under the input box. Using jQuery you can find when a key is being pressed in the input element. $("#searchForm").keypresss(function() { // add your ajax in here } AJAX is easiest through jQuery because it allows you to have such great control over how the other page is Ajax'd. (Ajax is the loading of another page, from within the current page - no need to load another page) If you've followed me so far.. you'll want to sent the value of your form, $("#searchForm").val() and send it through the URL using AJAX. The page that you send it to should be able to collect this information, such as PHP with the $_GET super global variable. You can then do a database query looking for the value in the URL and echo it to the page. Once the page echo's the result, your AJAX command from jQuery can use that information and put it into the hidden element we originally made like so.. $("#searchResults").html(ajaxData);
-
problem sending mail to customers upon cart checkout
Hey I took a better look at this.. MAIL POSITION 1 is inside the foreach() loop. foreach($_SESSION["cart_array"]... mail(...).. So foreach item in the cart_array it will mail() the customer. 10 items = 10 emails. And for MAIL POSITION 2.. I didn't analyze the code that well, but my guess would be that the older variables are getting over written by the newer ones. Example: <?php $name = "The Friendly Farmer"; $names = array("Kalob", "Bob", "Bill"); foreach($names as $value) { $name = $value; } echo $name; ?> This started as "The Friendly Farmer" and turned into "Kalob", then "Bob", then "Bill. When we echo'd $name after the loop, $name was "Bill", meaning $name was being over written every time the loop cycled. Hopefully this helps you out
-
problem sending mail to customers upon cart checkout
The first error I got when I ran this script was the first 2 lines: $cartOutput ==""; $cartTotal ==""; SHOULD BE $cartOutput = ""; $cartTotal = ""; == means comparison = means assignment Now for the mail() loops => check to see if they are inside the foreach() or while() loop. If the mail() function is inside a loop, it will mail over and over again.
-
-
Noobish mistake.
<style> .dNone { display: none !important; } </style> Add that class AFTER all your CSS and then add that class to your HTML element. It should no longer display. the !important means CSS should over write any other styling before or after this, unless another !important is specified.
-
Images not showing although URL Path is correct
Unless a default background image was specified, then CSS can be used for images. <style> .default { background-image:url('../directory/image.png'); } </style> If you don't use something like that, then look at the HTML. Often, if this happens to me, I'll right click on the blank image (where the Image should be) and copy the URL into my browser. If the image shows up, then I coded it correctly. If "page/file not found" shows up, it's the SRC of the image.