Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. Where is the variable $row_uruns['image'] definded?
  2. Is this code being ran within a loop? You need to show more code.
  3. The urls you're after are possible with the use of mod_rewrite. However what mod_rewrite cant do is convert a users id into the corresponding userrname for you. You will have to modify your scripts so they output the urls you are wanting to use. Eg <?php $username = 'BelovedDoll'; echo "<a href=\"site.com/$username/\">See {$username}'s Profile</a>"; ?> You'd then use the following rule to map site.com/username/ to site.com/profile.php?user=username RewriteEngine On RewriteRule ^([a-z0-9_-]+)/?$ profile.php?user=$1 [NC,L] Now in profile.php you'd use $_GET['user'] to get the username from the url. Note: You will need to modify profile.php so it retrieves the users details from the database based on the username rather than the user id associated to that username. mod_rewrite doesn't have the ability to convert a username to the corresponding user id for you.
  4. Have a look at multi-column results
  5. You will need to buy a domain and register it to your computers IP address. However this will only work if you have a static ip address. You will also need to confirm with your ISP whether it is OK for you to host a website from your internet connection. If you have a dynamic IP address (one that frequently changes) you'll need to use service such as dyndns.org or no-ip.com.
  6. It is because your menu is redirecting you to edit.php?match_id=x rather than edit_match.php?match_id=x
  7. You're going to need to install a http server on to your computer in order to run your PHP scrupts. I'd suggest you to install Apache2.2 from http://httpd.apache.org Download the latests version of MySQL5.0 Community Server from http://downloads.mysql.com For PHP you'll want to download the PHP 5.2 package titled VC6 x86 Non Thread Safe and choose the zip option. Do not use the Installer Once you have Apache, PHP and MySQL downloaded. First install Apache. However during the Installation process click the Customise install option, choose to install Apache to C:\Server\Apache In one of the steps it'll ask for some hostnames, just type in localhost for both cases. The web server administrator email address can be any address, fake or valid. I normally just use webmaster@localhost. Next, extract the PHP zip package to C:\Server\PHP. Now open the folder C:\Server\PHP and rename the file named php.ini-recommended to php.ini. Next you'll want to add the PHP folder to the PATH Environment Variable. Restart your computer to finish the PHP installation Once you're computer has restarted. Open Apaches httpd.conf configuration file (Located in C:/Server/Apache/httpd). Add these three lines to the bottom of the file # PHP5 configuration LoadModule "C:/Server/PHP/php5apache2_2.dll" PHPIniDir "C:/Server/PHP" AddType application-x/httpd-php5 .php Save the httpd.conf and restart Apache (there should be an Apache taskbar icon. left click this icon and choose Restart). Before configuring Apache/PHP. First create a file called info.php in Apaches htdocs folder (C:/Server/Apache/htdocs) and place this code into the file <?php phpinfo(); ?> Delete the existing files in the htdocs folder too. Now open your web browser and go to http://localhost/info.php. You should get a page generated displaying the PHP version and configuration. Confirm the line that reads Loaded Configuration File does point to C:/Server/PHP/php.ini. If this is correct then Apache and PHP are properly configured. You can now setup Apache/PHP as you require. Just remember to restart Apache if make any changes to Apache and/or PHP's configuration. Lastly install MySQL to C:/Server/MySQL. The default installation options should be fine.
  8. Shouldn't that be preg_replace_callback()? AbraCadaver is using the 'e' pattern modifier. This will eval the code in the replacement. Which will call the function get_navigation()
  9. Change line41 to $color = (++$i % 2 == 0)? 'grey' : 'black';
  10. If you are searching the database then yes you'll need to use the LIKE clause for each word you're searching for. IN() will search for exact values.
  11. I assume <navigation></navigation> is part of an XML document? PHP has a built in library for working with XML called simplexml
  12. Make sure the code is within a .php file. Also make sure you are running the PHP script from a server environment, either locally (eg http://localhost) or on your website. Passing the php file directly to your browser will not work as web browsers do not understand PHP code. You can install amp packages such wampserver (windows only) or xampp (windows, mac, linux) to run your PHP code locally on your PC.
  13. Your query is has invalid syntax. The issue is highlighted in red
  14. Or use implode $query = "SELECT * FROM product WHERE product_name, product_comment IN ('" . implode("','", $query_keywords) . "')";
  15. session_start() can be called on any line, provided no output has been sent to the browser. @craigj1303: I think the issue is a file charset encoding issue. Make sue you are saving the file as ANSI or UTF-8 without the BOM.
  16. $text = $_POST['txttext']; $text = nl2br($text); $text = mysql_real_escape_string($text); That is all that is necessary. nl2br() needs to be done before you place it in the DB. then you can just echo the text. No, it shouldn't! It is best to call nl2br when you are displaying the data from the database. I think the issue is with addslashes/stripslashes. There is no need to call addslashes if you're using mysql_real_escape_string. You can also remove the call to strip_slashes here $text = stripslashes(htmlentities($rows['text'])); This is most probably affecting the newlines within your text and thus nl2br doesn't work.
  17. This topic has been moved to Beta Test Your Stuff!. http://www.phpfreaks.com/forums/index.php?topic=309601.0
  18. No, only the mod rewrite module is required. The other modules are enabled by default on a clean Apache install
  19. rwwd. Yes you're right. I was going to correct those top four lines, but didn't
  20. Whether its ran on Linux/Windows server it should work the same. Jut make sure you have placed the mod rewrite code within an .htaccess file that is in the same directory as track.php
  21. To sort them alphabetically you'll need to first need to add all the files to an array, then use asort to sort them into alphabetical order. To output the files you'll use a foreach loop to iterate through the array of files. <?php $remove = $_GET[remove]; $dir = "/home/public_html/upload/files/"; $remove = $dir."".$remove; if($remove != "/home/public_html/upload/files/") {unlink($remove);} // Open a known directory, and proceed to read its contents if (is_dir($dir)){ if ($dh = opendir($dir)) { $files = array(); while (($file = readdir($dh)) !== false) { if(filetype($dir . $file) == "file") { // add the file to the files array $files[] = $file; } } closedir($dh); } } // sort the files alphabetically asort($files); ?> <table border=0> <tr> <th>File</th> <th>Remove</th> </tr> <?php // Output the files $i = -1; foreach($files as $file): $color = (++$i % 2 == 0): 'grey' : 'black'; ?> <tr bgcolor="<?php echo $color; ?>"> <td><a href="../upload/files/<?php echo $file; ?>"><?php echo $file; ?></a></td> <td align=center><a href="?remove=<?php echo $file; ?>">X</a></td> </tr> <?php endforeach; ?> </table> You may want to look at the filemtime function
  22. You could do something like this instead include $_SERVER'[DOCUMENT_ROOT'] . '/file.php'; Includes behave differently if you're using a url to include the file. It'll only include the output of the included PHP file rather than the actual PHP code.
  23. Because you was using the assignment operator ( = ) rather than the comparison operator ( == ). Assignment operator is used to assign something a value Comparison operator is used to compare values. if ($postage = "first") {$post_cost = $post1;} elseif ($postage = "second") {$post_cost = $post2;} You could of wrote the above using a ternary opertor ( ?: ) $post_code = ($postage == "first" ? $post1 : $post2)
  24. You should change the way you're connecting to mysql. Rather than type out this $conn = mysql_connect('localhost', 'user', 'pass') or die('MySQL Error: ' . mysql_error()); mysql_select_db('database') or die('MySQL Error: ' . mysql_error()); each time to connect to mysql, take those lines and place them into a seperate PHP file, for example call this new file dbconn.php Now whenever you want to connect to mysql you just need to include that file include 'dbconn.php'; That way if you need to make a change to your database credentials all you need to do is edit just that one file. But to answer your question yes you will need to alter your database credentials in each file. However if you do as I said above then it'll save you alot of time. Yeah once you have finished developing then you'll transfer your database over to your site.
  25. Umm.The issue is with the data in the date_left column. It will be far better if your didn't set a date in the date_left column if the player hasn't left the team yet. Just set the date_left column to NULL for players that haven't left the team. You should only set the date in the date_left column when the player has left the team. To test for NULL values in an SQL query you'd use the IS NULL statement. So I'd change this part of the query: WHERE date_left > '2011-07-01' to WHERE date_left IS NULL NOTE: To covert 2011-07-01 to NULL values you can run this query UPDATE players SET date_left = NULL WHERE date_left = '2011-07-01'
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.