premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
$result = mysql_query("SELECT `location` FROM `users` WHERE `username` = '$username'") or die(mysql_error()); $row = mysql_fetch_row($result); $mylocation = $row[0]; // should be 0 since location is the only column that should be returned. $result = mysql_query("SELECT `location` FROM `users` WHERE `username` = '$target'") or die(mysql_error()); $row = mysql_fetch_row($result); $hislocation = $row[0]; // should be 0 since location is the only column that should be returned. Edit: Oh and as for the needing a hand....*claps very zealously over and over*
-
[SOLVED] Help With Interpreting Alternate Syntax for If/Else Statement
premiso replied to limitphp's topic in PHP Coding Help
You can try, not sure if that is kosher, but give it a try, you can't really hurt anything by trying. Edit: Nope you cannot, syntax error. -
Usually when you have multiple . it should generally be to tell you what is in the zip file. That way you can know, oh it is a PDF that is in there etc. That is not always the case, but generally if you have .ext.ext the last one is the correct one, the one before is what is inside or what it might have used to be.
-
Either IF-Logic or put the form in a <div and use javascript to hide it depending on your needs. <?php if (isset($_POST['submit'])) { // do form processing }else { // display the form. } ?> That would be a sample if logic. Given that your submit button name is "submit".
-
preg_match would basically throw out anything that is not kosher, since periods, _, - and alpha-numeric are all good for filenames, you would not really need to verify multiple extensions. That would be an unnecessary step imo. $name = str_replace(" ", "_", || "#", "_", $_FILES['Filedata']['name']); Should be $replaceArr = array(" ", "#"); $name = str_replace($replaceArr, "_", $_FILES['Filedata']['name']); And using _ is better than %20, for SEO reasons and because the file does not get brokenup when trying to link it in emails etc. That and %20 just looks soo ugly, who wants that?
-
date would be all that you need. <?php session_start(); echo 'Session started at ' . date('H:i'); ?>
-
Forward Port 80 to the computer with WAMPS internal LAN ip address via the router.
-
Why are you using $this, you have not defined an object period, and even if you did you would need to access the data in it with $object I would suggest removing the this-> part and just making min and max variable names, or figure out what the object you are to be referencing should be and use that.
-
In order to do the client side you either, a need to use javascript to grab their timezone, or b have the user specify their timezone. PHP does not interact with the client other than providing them displayed data.
-
Post your full code, the error seems straight forward to me, you are not inside a function or object, thus $this cannot be used because there is no object to reference.
-
Seriously, wait at least an hour or two or until this is on the next page, not less than 15 minutes to bump.
-
Or a simpler approach is PEAR is not available is phpMailer, check it out on google. Although, to send mail with that without using mail you would need an SMTP server to send mail from, so yea.
-
You really should save the file without a space in the name... <?php //create the directory if(!is_dir("./files")) mkdir("./files/", 0755); //move the uploaded file $name = str_replace(" ", "_", $_FILES['Filedata']['name']); move_uploaded_file($_FILES['Filedata']['tmp_name'], "./files/".$name); chmod("./files/".$name, 0777); ?> That way it is replace with an _ and you do not have to worry. But I would do more checking than that, such as only allowing alpha-numeric characters using preg_match cause any other character could potentially cause problems, such as ' would not allow a file to be deleted, etc.
-
[SOLVED] interrupt while loop, then resume?
premiso replied to theredking's topic in PHP Coding Help
if (($i%10) == 0) { The modulus operator is what you want. -
Opening your firewall at port 80 and giving them your IP. Although I tend to use http://www.no-ip.org and give them that, but yea it is not recommended due to the security issues of opening up your firewall to port 80.
-
2 days should return more results...no? Why not print out the TIME in your while loop after returning the data and verify that they are not within the 2-day mark. I bet they are.
-
I would learn AJAX with jQuery, that framework makes AJAX so much easier and pain free!
-
[SOLVED] interrupt while loop, then resume?
premiso replied to theredking's topic in PHP Coding Help
Sorry, syntax mistake: if ($i == ceil($num/2)) { Replace that line above, before it had a single = it should be == for comparison. -
Try this instead. <?php $data = file_get_contents("http://feeds.artistdata.com/xml.shows/artist/AR-YX458DZO75EQACZ3/xml/future"); echo $data; ?> And see what gets returned. Also view the source of that test.php page you have, the xml data is there, the issue is you are using <html> tags etc instead of proper XML tags. This will cause issues of feeds not displaying right.
-
Try this: vote.date > DATE_SUB(NOW(), INTERVAL $time DAY) And see what happens.
-
[SOLVED] interrupt while loop, then resume?
premiso replied to theredking's topic in PHP Coding Help
$num = mysql_numrows($result); $i = 0; while ($i < $num) { if ($i = ceil($num/2)) { echo 'table header info here'; } print "data goes here."; $i++; } You do not really want to "break" or "continue", you just want to add another row halfway through the results, That should do it, and if /2 does not give it enough try /3 or /4 etc until you get it how you want. -
What is $time being defined as?
-
T'other way round. The regular sorting functions sort lowest to highest; the (k)rsort functions sort highest to lowest. Yea, sorry. My original line of thinking was file size lol. Thanks for correcting!
-
The apply button will have to use javascript to imitate a forum.submit then on the next page, depending on if the form is posted or get you would use $_POST['selectboxname'] to grab what the value was. Then use that value against the DB to pull out that information.
-
mysql_real_escape_string Any data that is coming from the form and being tested on the DB. But make sure that get_magic_quote_gpc is off before doing that or it will double escape the data, if it is not off then stripslashes on the data before using the real_escape_string. Also make sure that register_globals is off, this can cause problems. Other than that you should be good.