-
Posts
15,232 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
$con = mysqli_connect('$host','$username','$password','$db');Variables do not work in single-quoted strings. Do away with the quotes entirely.
-
How Can i Make a Conditon to get two diffrent Percentage
requinix replied to allpkresults's topic in PHP Coding Help
What? -
The only thing I got out of those three posts was that the XML file is 850 MB and that the script isn't outputting anything. The XML may be too large to load into memory. Open up your php.ini and change error_reporting = -1 display_errors = on memory_limit = 0then restart the web server (if you're running this script from a web page) and try again. Any errors?
-
You have to check that the form was submitted before you try to use it anywhere. Like if (isset($_POST["name of the submit button"])) {
-
Which "root" are you talking about? The root of the server should be irrelevant when talking about setting up a specific site. There's also the root of the website which is typically like /var/www or /home/user/public_html. If you've bought the entire server then you have access to the entire server. It's yours. Do with it as you wish.
-
It's actually possible to URL rewrite to a non-public file so you could have a "public" directory with absolutely nothing inside. You'd still need it because Apache wants a directory for the website, but you could have requests for everything be sent to a file somewhere.
-
Right. If you're interested in OOP then go with objects (DateTime, DateTimeZone, etc). I'm just stuck in my ways with the procedural functions.
-
- Depends what you bought. If it's shared hosting then you have some flexibility but really not that much. Dedicated hosting means you can do whatever you want. - Unless you have really locked-down shared hosting (less and less common these days) then you can make any directory "public" or "private". - Public directories can contain whatever you want. They probably shouldn't have views/templates because those files are no good if executed directly. In fact they might even have some code in them that shouldn't be seen at all. Generally such directories have things like CSS and Javascript and image files instead. - Yes, making a directory public or private is done in Apache through .htaccess (or a server-level configuration file). That's what you would use to block browsing.
-
Don't use regular expressions unless you absolutely must. They're much slower and more difficult to understand than simpler functions like explode().
-
Why are you advertising your website? It has nothing to do with your question. date_default_timezone_set. Use it before calling date() for every timezone you want a date/time in.
-
That is not helpful for us. We can't see what's going on. You have to describe what's happening.
-
You really need to learn how to ask a question. So I'm going to ask some for you: What are you talking about? What is the purpose? What is your code so far? What happens when you execute your code? What did you want it to do? Do you get any error messages? Have you tried debugging the code yourself yet? Do you have any specific questions? What have you done to try to answer those questions yourself? What did you search for and what did you find? What potential solutions did you try, or why didn't you try any? What was wrong with those solutions that they did not solve your problem?
-
I just did.
-
Then DreamWeaver is (surprise!) doing something screwy with your stuff. Put it aside for a moment and just look at your site in WAMP. Does it work?
-
As we've been trying to tell you on another site, Stop looking at index.php. That is not where the problem is. You have to find that index_48z72rfhp6.php and look at it. index.php will not help you. It means nothing to us. Look at the other file. If you can't find it that's because you are not looking at C:\wamp\www\celebration\index_48z72rfhp6.php. Are you saying that you are in the C:\wamp\www\celebration folder and there is not a file there named "index_48z72rfhp6.php"?
-
Keeping in mind what I said about making your scripts work with names (since that's what you have in the URL) and not numbers (since you don't have that in the URL), Yes that'd be about right.
-
You can break it apart by underscores and then put the first two pieces back together. [edit] Or strtok strtok($string, "_") . strtok("_")
-
Try to avoid using RewriteBase - you generally don't need it anyways. The best way to do this is to make index.php accept the name of a category instead of the ID number. That way you can say "any directory that doesn't exist is going to be a category and should go through index.php". On that note, you should avoid polluting the root with fake directories: how about making it like "/category/dogs"? RewriteEngine on # Add a trailing slash RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^/?category/(\w+) $0/ [L,R] # Category RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^/?category/(\w+)/ index.php?category=$1 [L]
-
For the Type and Id you definitely don't need XPath. For the Height... yeah, XPath. foreach ($xml->Catalog->xpath("EquipmentSpec") as $n => $equipmentspec) { // xpath for the numeric key $equipment = $xml->Installed->Equipment[$n]; $Type = (string)$equipmentspec->Type; $Id = (int)$equipment->Id; $Height = (int)current($equipment->xpath("Characteristic[CharacteristicName='Height']/CharacteristicValue")); // a search $sql = "INSERT INTO machines (`Type`, `Id`, `Height`) VALUES ('{$Type}', {$Id}, {$Height})"; $req = new requete($site->db, $sql); echo $sql; }Never understood why people feel like arrays are easier than SimpleXML...
-
If you're alright with a simpler email validity check, maybe like "*@*.*", then UPDATE spammers SET email = countery WHERE email NOT REGEXP ".+@.+\..+" AND countery REGEXP ".+@.+\..+"
-
You're overwriting $res inside the loop. You know you can just update everything in one statement? UPDATE spammers SET abc=5252If you've hidden something important and can't do that (like you don't actually want to update all of them) then I guarantee you there's a much better way of doing it than the horribly inefficient SELECT/UPDATE loop you have now.
-
It does sound bad. Exactly what are these values and why do you need them everywhere?
-
1. "php help" is a meaningless title. It says nothing about what you're trying to do. That's a bad thing. 2. You've told us what you want to do. What you haven't told us is where you need help. Keeping in mind that we won't do the work for you, what specific questions do you have? What is your code so far? What is it supposed to do and what does it actually do?
-
You can't return two different values through AJAX. Which is what you're doing with the two echo statements. Return just the one. echo json_encode(array("key" => $key, "nonce" => $nonce, "error" => true, "message" => $mes));
-
Order allow,denyin a .htaccess inside the directory. Or in a in the virtual host/server configuration.