Jump to content

Zhadus

Members
  • Posts

    376
  • Joined

  • Last visited

    Never

Posts posted by Zhadus

  1. No problem, sometimes all it takes is another set of eyes. If you have any more questions, feel free to post here, also welcome to contact me directly through AIM or MSN etc.

     

    A quick pointer: Use some "debugging" skills. You noticed it wasn't changing the results, therefore it isn't understanding something or it isn't getting all the information. What I normally do then, are "echo" out variables after if statements to see if they passed and if the variables look as they should. Hope that helps.

  2. Sorry for the lengthy time to respond, a bit busy on my end.

     

    If really have the process down from what I can see, you're just missing a component.

    When you put a variable in the address bar, for instance you have a link that goes to:

    page.php?var=blah

     

    When it goes to that page, you don't automatically have the variable $var, it's $_GET['var'].

    You understood this with:

    $var = @$_GET['q'];
    

    But then the variable $s is passed up, and you don't get it before you check if it's empty, you need:

    $s = $_GET['s'];
    

  3. You grasp the concept, you're just not using the right functions.

     

    As long as I am reading you correctly, you just need to check if a file is in place in the thumbs folder, and if it isn't, make the main image resized smaller to display. You can use this function: file_exists().

  4. Additionally, using asmith's code you can check the extension for valid filetypes:

    <?php
    $file_ext = end(explode('.',$_FILES['uploadedfile']['name']));
    if (($file_ext == 'jpeg') || ($file_ext == 'jpg') || ($file_ext == 'gif') || ($file_ext == 'png')) {
         // All is good
    } else {
         // Bad filetype
    }
    ?> 
    

  5. <?php 
    include "config.php";
    if($logged[id]){
    echo '<div id="gameoptionsmenu"><form name="add" action="addfav.php" method="POST">
    <input type="hidden" value="' . $name . '" name="fav">
    <input type="hidden" value="' . $url . '" name="fav2">
    <input type="submit" class="submit" value="+ Add To Favourites +">
    </form>';
    }
    ?>
    

     

    That should do it for you. When you are within an echo statement, you merely need to break and input the variable, as opposed to echoing again.

     

    Please use the starting and end [\code] tags in the future.

  6. Here is a function that you can use that will count the images in the directories:

    <?php
    function countImages()
    {
    if ($handle = opendir("./"))        // CHANGE TO TARGET DIRECTORY
    {
    	while (false !== ($file = readdir($handle)))
    	{
    		if ($file != "." && $file != "..")
    		{
    			$ext = explode(".", $file);
    			if (($ext[1] == "jpg") || ($ext[1] == "jpeg"))
    			{
    				$files[] = $file;
    			}
    		}
    	}
    closedir($handle);
    }
    
    $files = sizeof($files);
    return $files;
    }
    ?>
    

     

    If you change to the correct directory (or run that function from within the directory you're searching) it will return the amount of files with extension .jpg or .jpeg.

     

    Then on your display page you can use:

    <?php
    $max = countImages();
    $image = "<img src='gallery/$page/$page-";
    for ($x = 0; $x < $max; $x++)
    {
         echo $image . $x . " />";
         if (($x % 5) && ($x != 0))
              echo '<br />';
    }
    ?>
    

     

    That will put 5 images on a line and then make a break. You should be able to manipulate it as needed from there.

  7. Thanks for reading,

     

    Anyway I need help with some regex, here is the pattern I have so far:

    (\b[^\s]+\b\s*\()
    

    Which will identify terms such as:

    blah(

    scien (

    examp    (

     

    What I want it also to negate, are the terms:

    if (

    elseif  (

     

    Basically the term itself should not be if or elseif. I'm having trouble changing the [^\s] (No white space in the term) to also include no matching of the strings "if" and "elseif".

  8. PHP and Databases. That's all a game like that is (aside from graphics). I'd recommend downloading a free one and take a look at how it's done, or start small using your own way to manipulate things. If you've done a lot of PHP before, it should fall into place pretty quickly.

  9. Lots of PHP. With the form submission, you can have it insert values into a database, which you will draw for two purposes. You can draw from that database each time the calendar page is loaded up. Secondly, you can have a template page for the events that fills it's information by loading in the data from the database as well.

     

    i.e.

    User submits form for February 10th that saves in the database as 31 for the id. All users see there is an event on February 10th called "Test Event". The text will be a link to "template.php?id=31". When users click on it, it will open up template.php and the information will be drawn from id 31.

     

    I hope this makes sense.

  10. If you do as described and you get the list of models, and then pull the data (sold or unsold) into an array, the model and the information of whether it's sold or not, will share the same index number.

    i.e.

    Model:          Status:

    MKX              Sold

    Sable            Unsold

    Milan            Unsold

    Mariner          Sold

     

    $models[0] = MKX & $status[0] = Sold

    $models[2] = Milan & $status[2] = Unsold

  11. Also utilize the "mysql_error" function in order to get the errors to return. This will help narrow down the problems.

     

    From what he is describing, the query isn't failing, it's just not happening, because it fails the PHP IF statement.

    I may be mistaken though.

×
×
  • 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.