- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 4
- Posts with Upvotes
- 4
- Upvoting Members
- 4
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
32 Posted Topics
Re: There is no way to do that. What you can do is store the player logout time, and when he logs in again, compare the times and do necessary changes. | |
Re: [code] <?php $query = "SELECT DISTINCT event_date FROM events WHERE event_date >'$startdate' AND event_date <'$enddate'"; $result = mysql_query($query); $date = ''; while($row = mysql_fetch_assoc($result)) { $date = $row['event_date']; echo "<b>". $date . "</b><br />"; $query2 = "SELECT event_name FROM events WHERE event_date='$date'"; $result2 = mysql_query($query2); while($row = mysql_fetch_assoc($result2)) { $row['event_name'] … | |
Re: The "case" end with [b]:[/b] not [b];[/b] [code] switch($ad) { case "add1.gif": header("Location: http://www.google.co.uk"); break; case "add2.gif": header("Location: http://www.youtube.com"); break; } [/code] | |
Re: Well, since you [quote]trying to learn from all this and use this for a project at the same time[/quote] ... than take a look at this [URL="http://php.net/manual/en/function.copy.php"]copy()[/URL]. | |
Re: The most common way would be to make a unique id for the session. For example create a hash from users ip and browser he uses. Regenerate session id's after logout, set session timeout and so on. | |
Re: Hm, what kind of query is that? [code]mysql_query("SELECT * FROM table ORDER BY RAND(), LIMIT 1");[/code] I guess... [code] <?php include_once "connect_to_mysql.php"; $sql = mysql_query("SELECT * FROM table"); while($row = mysql_fetch_assoc($sql)) { $add = $row['add']; $link = $row['link']; $title = $row['title']; echo ' <b>'.$add.'</b> <a href="'.$add.$link.'" title="'.$title.'"></a>'; } ?> [/code] | |
Re: If you are using utf-8 in meta tag, mention that all source files should be also saved in utf-8. | |
Re: Check the mktime() function. Parse your dates in it and it will return the number of seconds since unix epoch, these are just two big numbers which can be easily compared. | |
Re: Well... seems that you lost a curly brace ({) and a semi-colon in your switch statement... Next, where is your actually searched string? I mean [code] $term = mysql_real_escape_string((string)$_POST['term']); [/code] Third, your SQL syntax is kinda wrong [icode]... LIKE '%term%[/icode] ..., I suppose it should be - [icode]... LIKE '%$term%'[/icode] … | |
Re: First of all your form... [code=html] <div> <form method="post" id="newsletterform" action="search.php"> <p><input type="text" name="term" id="s" style="width: 95%;" /></p> <p><select name="criteria"> <option value="1">course</option> <option value="2">surname</option> <option value="3">department</option> <option value="4">email address</option> <option value="5">student no</option> </select></p> <p><button class="Button" type="submit" name="search"></p> </form> </div> [/code] Now in the php script you just parse the value … | |
Re: Also to make the page cross-browser, I would recommend to set to null margin and padding to all elements. [code] * { margin: 0; padding: 0; } [/code] The issue is that different browsers set up different margin and padding to HTML elements. ![]() | |
Re: [code] //... $currentspecial = @mysql_query($query); $currentsub = @mysql_query($query2); if($currentspecial != $currentsub) { //... [/code] There is no way to compare two arrays in a such way. Let's see... you are comparing $currentspecial with $currentsub and actually you are comparing the Resource ID's returned by the mysql_query() function, not arrays of … | |
Re: You are selecting a picture rating for each photo right?? Then why all of your comparison you didn't put in the loop? [code] <?php $sql="SELECT * FROM photo WHERE type='current'"; $result = mysql_query($sql); while($row=mysql_fetch_assoc($result)) { $rating =$row['votes']; if ($rating >= 0 && $rating <= 1) { $rate = "0"; } … | |
Re: The thing is that we can create an array with 4 elements (for ach form "yes/no" radio) stored in $_SESSION. Say the user clicked "yes" on 1-st form... the first element will become "1", and so on. Doing the needed stuff according to array elements. | |
Re: Set of questions with radio buttons... the person clicks the correct answer then presses a submit button, the script loops through all pressed buttons and calcultes the result. | |
Re: utf8_encode() function is your way. Check it on php.net | |
Re: A lot easier would be to make the page self refreshing within some timespan. ![]() | |
Re: No way to do it in PHP. VB or JS are at client side, PHP only server side. Anyway you can create a page in php with such task using HTML forms... | |
Re: A simple example... which loops through "pdf" directory, outputs all files with *.pdf extension and their size in bytes. [code] <?php $dir = "./pdf"; $hnd = opendir($dir); while($file = readdir($hnd)) { if(substr($file,-3) == 'pdf') { echo '<p>'.$file.': '.filesize($dir.'/'.$file).'</p>'; } } closedir($hnd); ?> [/code] | |
Re: The error you were getting, is because wrong date() use... So far you tried to merge the strings inside the function, while date() gets only correct date modifiers. Try that... [code=php] $image_name = date('Ymdhis') . "." . $image_ext[1]; $image_name = $dest.$image_name; [/code] BTW doing explode() to get image extension could … | |
Re: Yes you are right... seems you just copy-pasted some code from a buggy site... (The > is the HTML entity for ">") | |
Re: What for you need to show the password?? | |
Re: The problem code please... I think that with "/" should not be problems at all, while the "\" in most cases has to be doubled, e.g. "\\". | |
Re: So? Whats the error? I don't think there are mediums on that forum... | |
Re: I think javascript could be handy here. To every button assingning an "onclick" event, which overrides the forms "action" field, adding an extra argument, the rows ID. So, after submitting the form the URL would be, for example "index.php?id=3". All what remains is to pass the $_GET['id'] variable and delete … | |
Re: Using urlencode() may solve the problem, but the thing is that plus and space signs in URL have the same value, they are not recomeded to use at all in URLs. | |
Re: The most likely is that you "echo"-ed some output before you called header(). | |
Re: First .htaccess file: [code] RewriteEngine On RewriteRule ^\.htaccess$ - [F] RewriteCond %{HTTP_HOST} ^([^.]+)\.domainname\.com$ RewriteRule ^$ /index.php?user=%1 [L] [/code] Second, we must set a redirection from whatever "username.domainname.com" link to "domainname.com". Thats achieved by talking to your hosting provider to setup such a redirect. Third, according to your site link generation, … | |
Re: I am always using separate queries, so as my example would be: 1. Get all users id's. 2. Foreach user id, get posts count. Store the id's and posts count into arrays. 3. Sort the array by descendant. | |
Re: Because you generated an output to browser, by making <script> tags and so on. Check the reference for header() function. There is said that NO OUTPUT should be BEFORE sending headers, not even a space or line feed. Instead of headers, you can use "document.location.href" javascript property. That is redirect … | |
Re: For every user we create a hash (MD5 or any other), store it in the database, and send it to the recipient. Then we just check the given hash in the link with existing one in the database. |
The End.