-
Posts
1,216 -
Joined
-
Last visited
Everything posted by WebStyles
-
Shortest way to return results based on two values
WebStyles replied to CoffeeAddict's topic in PHP Coding Help
something like order by mileage desc limit 2 -
how about this (it's just an idea, that i've used before and worked fine for me): Grab all id's from database and place in a session array if array doesn't exist yet: (assuming you unique id field is called `id`) if(!isset($_SESSION['ids']) || empty($_SESSION['ids']){ $_SESSION['ids'] = array(); $q = mysql_query("SELECT `id` FROM `Projects`"); while ($row = mysql_fetch_array($result)) { $_SESSION['ids'][] = $r['id']; } } // reorder array in random fashion every time the page is loaded (why the hell not?) shuffle($_SESSION['ids']); //grab an element from end of array while removing it from array (so it never repeates) $id = array_pop($_SESSION['ids']); // now just use that id to retrieve project from database. // when $_SESSION['ids'] is empty, it should reload again in a different order. * untested code, may contain typos and need some tweeking. hope it helps
-
I've seen the 0 being outputted before, but at the end of pages that actually had content. If memory serves me well, it was an apache/headers issue, but I cannot remember any details.
-
wordwrap
-
I just gave you a tip, I didn't do the work for you, so you don't just "put the code somewhere". echo that variable to see what you get while inside one of the admin folders. Then you can figure out how to protect the folders by splitting the result and adding another $_SESSION check.
-
A better example: function confirmSubmit(formName){ if(confirm("Are you sure you want to submit this form?")){ document.forms[formName].submit(); } } hope that helps
-
you can use onsubmit="" to call a javascript function, and use a simple confirm("are you sure"); in javascript.
-
Need someone who can help me calculate the price of a job.
WebStyles replied to Jumpy09's topic in Miscellaneous
in Portugal I charge €45 / hour -
in what situation? when submitting a form? if so, maybe you need a little javascript to avoid jumping back and forward between pages.
-
have you tried just: $email = "youremail@yourdomain.com"; mail($email,"test","a little test"); just to be sure your server and smtp are set up correctly?
-
you're grabbing the $_POST['email'] value into $email, but you're using $email_to when sending it. try changing: @mail($email_to, $email_subject, $email_message, $headers); to @mail($email, $email_subject, $email_message, $headers);
-
Need code for an online registration form
WebStyles replied to Pieter Lategan's topic in PHP Coding Help
Would you like to try yourself or would you rather one of us just do the whole thing for you? May I suggest posting in the forum "Get your entire homework done for free". (sorry man, couldn't help myself) Seriously now: Try google.com, slap some stuff together and post the code here with any errors you're getting, and we'll help you from there. -
Need code for an online registration form
WebStyles replied to Pieter Lategan's topic in PHP Coding Help
google.com -
means the file does not exist. check folder and filenames, remember that on unix systems they are case-sensitive.
-
try adding quotes: (I'm assuming $newfile has the name you want without .jpg <? rename('/members/01/myfile.jpg', '/members/01/'.$newfile.'.jpg') ?>
-
mysql_affected_rows() will give you a count of the changed rows.
-
Did the same for me, but if you go though the homepage, and use the links, it works. Still, since the file doing all the formatting is zstore.php, it will be hard to help without it's code.
-
That makes the order non-alphabetical. Are you just trying to reverse the order of the original array?
-
you can use $_SERVER['REQUEST_URI'] to grab the url path and split it accordingly to find the last folder's name.
-
then read dcro2's reply.
-
you can use explode to separate each line... something like: $file = file_get_contents('yourFileName.txt'); $lines = explode("\n",$file); foreach($lines as $line){ $parts = explode("C:",$line); echo '<br \>C:'.$parts[1]; } hope that helps.
-
on windows or linux ?
-
I got your private message explaining the problem... Why? Seems like you expect me (and only me??) to help... You'll stand a much better chance of getting feedback if you post the details here for everyone to participate. thanks
-
mail() function is sending to address in $email_to, but the one posted is stored in $email.
-
Have you tried it? did it work? Did you get an error? what error was it?