Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. Modified your code abit, not sure what you was doing with your first while loop but doesn't seem it was required <?php session_start(); require_once '../settings.php'; $sql = "Select * from forumtutorial_posts ORDER BY lastrepliedto DESC LIMIT 10"; $result = mysql_query($sql) or die("Could not get threads"); echo '<table width="500 border="0" >'; $i = 0; while($row = mysql_fetch_assoc($resul)) { $color = (($i%2 == 0) ? '#000000' : '#00468C'); echo "\n".' <tr bgcolor="'. $color .'"> <td>'.$row['title'].'</td><td>'.$row['author'].'</td> </tr>'; $i++; } echo ' </table>'; ?>
  2. $getthreads3[title] should be $row['title']
  3. Its up to you. Adding it to a VirtualHost it'll only apply to that host. Whereas adding DirectoryIndex will apply globally.
  4. Add index.php to the DirectoryIndex directive in Apaches httpd.conf
  5. Change echo '<tr bgcolor="'. $currentcolor ."> <td><? echo $getthreads3[title]?> </td> </tr>'; to echo '<tr bgcolor="'. $currentcolor .'"> <td>'.$getthreads3[title].'</td> </tr>';
  6. I never recommend to setup PHP in CGI mode. I always configure PHP as an Apache Module using the following instead: LoadModule php5_module "C:/php/php5apache2_2.dll" PHPIniDir "C:/php" AddType application/x-httpd-php .php
  7. There is an automated process you could use which requires gd. There are many tutorials on the net for creating thumbnails with gd.
  8. cookies are stored as plain text in the browsers cache. Most modern browsers allow users to view all cookies stored in the cache. You should never store personal data within cookies this is what sessions are for (as sessions are stored on the server).
  9. How have you installed PHP? During the process of installing PHP you'll need to configure Apache, in order for it to understand how to handle php files.
  10. Yes, you'll need to have two images for this to work. The actual image itself and a smaller version of the original image for the thumbnail. You'll then do something like this: echo "<br><strong> Image: </strong>"; echo '<a href="'.$row["Picture"].'"><img src="'.$row["PictureThumbnail"].'" /></a>';} The code will not work until you have field in your database called PictureThumbnail -- this will hold the path to the thumbnail for the image.
  11. Two problems, your code doesn't even appear to use sessions. Cookies have nothing to do with sessions. The other problem is using cookies for storing the md5 hash of the user's password.
  12. This is the line that is causing the problems: if (is_array($folders(strpos($folders[core], '/') === FALSE))) { What are you trying to do with that line? Maybe it should be if (is_array($folders) && (strpos($folders[core], '/') === FALSE))
  13. What is held in the variable $row["Picture"] Is it a path to an image or is it the binary code of the image itself? If is the first then just output an HTML image tag to display the image, eg: echo "<br><strong> Image: </strong>"; echo '<img src="'.$row["Picture"].'" />';} However for the latter its a bit more complex as you cannot display binary data within a HTML page.
  14. I think you should explain what you're trying to do. I'm not understanding you.
  15. The last four is caused by the use of the concatenation operator (.=), add $Model = $Description = $Category = $Image = null before your while loop
  16. The code should not work at all no matter whatever error_reporting or display_errors is set to. The only way the code will work is if the OP has a setting called output_buffering set to On within the php.ini for thier WAMP setup, quote from the php.ini ; Output buffering allows you to send header lines (including cookies) even ; after you send body content, at the price of slowing PHP's output layer a ; bit. You can enable output buffering during runtime by calling the output ; buffering functions. You can also enable output buffering for all files by ; setting this directive to On. If you wish to limit the size of the buffer ; to a certain size - you can use a maximum number of bytes instead of 'On', as ; a value for this directive (e.g., output_buffering=4096).
  17. echo "<p>Number of records found: ".$num_results."</p>"; while ($row = mysql_fetch_array($result)) { $Model .= '<td>'.$row['Model'].'</td>'; $Description .= '<td>'.$row['Description'].'</td>'; $Category .= '<td>'.$row['Category'].'</td>'; $Image .= '<td>'.$row['Picture'].'</td>'; } for ($i=0; $i <$num_results; $i++) { ?> <table> <tr><td><?php echo "<p><strong>".($i+1)."Model"; ?></td><?=$Model?></tr> <tr><td><?php echo "<p><strong>".($i+1)."Description"; ?></td><?=$Description?></tr> <tr><td><?php echo "<p><strong>".($i+1)."Category"; ?></td><?=$Category?></tr> <tr><td><?php echo "<p><strong>".($i+1)."Picture"; ?></td><?=$Image?></tr> <?php } ?>
  18. for ($i=0; $i <$num_results; $i++) { ?> <table> <tr><td><?php echo "<p><strong>".($i+1)."Model"; ?></td><?=$Model?></tr> <tr><td><?php echo "<p><strong>".($i+1)."Description"; ?></td><?=$Description?></tr> <tr><td><?php echo "<p><strong>".($i+1)."Category"; ?></td><?=$Category?></tr> <tr><td><?php echo "<p><strong>".($i+1)."Picture"; ?></td><?=$Image?></tr> <?php } ?>
  19. That be only possible if your server has a torrent client installed. You then invoke the client via exec() or some other command function within php to start a torrent download.
  20. No just escape all double quotes within the string except for the first and last quote, example Escape all the quotes highlighted in blue. Do not escape the quotes in red. TO escape you place a backslash in front of the quote like so \" or \'
  21. Your parameters are round the wrong for mysql_query. Line 145 should be $result = mysql_query($sql, $cxn) or die ("Query died: user name");
  22. By "close the array" do you mean remove the generated array made by mysql_fetch_* from memory after you have used it? You can do by using unset(). However PHP will automatically clear all memory the scripts consumes after the script has been executed.
  23. You just need to add the relevant code in the included file then. If you post phptuts.php here I'll be able to incorporate the code I posted earlier for you.
  24. You mean a webhost? Any host which runs PHP5 should support mysqli.
×
×
  • 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.