Jump to content

zq29

Staff Alumni
  • Posts

    2,752
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by zq29

  1. I'm not as fluent in SQL, so I'd probably go about it like this:
    [!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] * [color=green]FROM[/color] [color=orange]companies,[/color] employees [color=green]WHERE[/color] companies.email [color=orange]=[/color] [color=red]'$_POST[email]'[/color] [color=blue]AND[/color] companies.password [color=orange]=[/color] [color=red]'$_POST[password]'[/color] [color=blue]AND[/color] companies.password [color=orange]=[/color] employees.password [!--sql2--][/div][!--sql3--] Someone could come along and put me in my place with a [i]"Ooohhh thats the long way around it, you can do it like this in half the space..."[/i] [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]
  2. You need to define which table the columns are in...
    [!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] * [color=green]FROM[/color] [color=orange]companies,[/color] employees [color=green]WHERE[/color] companies.email [color=orange]=[/color] [color=red]'$_POST[email]'[/color] [color=blue]AND[/color] companies.password [color=orange]=[/color] [color=red]'$_POST[password]'[/color] [!--sql2--][/div][!--sql3--]
  3. [!--quoteo(post=385967:date=Jun 20 2006, 12:33 PM:name=elementz)--][div class=\'quotetop\']QUOTE(elementz @ Jun 20 2006, 12:33 PM) [snapback]385967[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    also can you do more than 1 mysql search at once like:

    [code][/code]
    $sql="SELECT * FROM `emails` WHERE email='$email'";
    "SELECT * FROM `domain` WHERE email='$edmn'";
    "SELECT * FROM `user` WHERE email='$user'";
    $result=mysql_query($sql);
    if(mysql_num_rows($result)==0){

    }
    else{
    };
    [/quote]
    I'm not sure, but one thing I am sure of, it will take less than two minutes to find out [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /]
  4. [!--quoteo(post=386124:date=Jun 20 2006, 08:18 PM:name=maxim)--][div class=\'quotetop\']QUOTE(maxim @ Jun 20 2006, 08:18 PM) [snapback]386124[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    see how i have the word "php" before the path to my script. what dose crontab do when it sees that ?
    [/quote]
    The part where you have "php" is pointing to your install of php on the system, it looks like your host is set up to accept "php" as the path to php. If this is not working on your local machine, try pointing it to "usr/local/bin/php", I think thats the default install location (providing you're running a *NIX OS on your local machine. I am assuming you do as you said you have cron.)
    [!--quoteo(post=386140:date=Jun 20 2006, 09:29 PM:name=rsj1)--][div class=\'quotetop\']QUOTE(rsj1 @ Jun 20 2006, 09:29 PM) [snapback]386140[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    A great looking alternative to cronjobs would be [a href=\"http://www.dwalker.co.uk/phpjobscheduler/\" target=\"_blank\"]http://www.dwalker.co.uk/phpjobscheduler/[/a] I found this free script by accident earlier today when I was looking for an script to automatically backup my databases to server. I havn't tested it but it looks like it could do what you are asking ;)
    [/quote]
    That still requires user interaction to trigger the script, automation without a scheduling application like cron or scheduler is impossible.
  5. [!--quoteo(post=385997:date=Jun 20 2006, 02:08 PM:name=benluke)--][div class=\'quotetop\']QUOTE(benluke @ Jun 20 2006, 02:08 PM) [snapback]385997[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    Hi,

    ok so how would i go about doing that. Would i be looking at using the isset function?

    benluke
    [/quote]
    Pretty much, yeah.
    [code]if(!isset($_POST['knowledge1'])) echo "No checkboxes were selected for Knowledge 1";[/code]
  6. As it stands, that piece of code won't print anything to the screen. I ran your code on my machine and it runs perfectly fine, giving me the expected output. What is it (not) doing for you?

    I rewrote it for you though, you were going about it the long way a bit...
    [code]function check_Name($Name,$FamName) {
        $Name_Pattern = "^[a-zA-Z]+$";
        if((eregi($Name_Pattern,$Name)) && (eregi($Name_Pattern,$FamName))) {
            return TRUE;
        } else {
            return FALSE;
        }
    }

    $acc2 = check_Name($Name,$FamName);[/code]
  7. [!--quoteo(post=385929:date=Jun 20 2006, 11:10 AM:name=maxim)--][div class=\'quotetop\']QUOTE(maxim @ Jun 20 2006, 11:10 AM) [snapback]385929[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    i have the same problem. i have a few scripts which generate a image. and out that image to a file.

    the file only gets updated when the script runs. My free host supports cron jobs.

    but im lost as to how to get it working. all tutorials i read say u need root acces or lynx which my host dose not have.

    any ideas on how to execute a PHP script form cron
    [/quote]
    If you don't have access to it through a GUI such as cPanel, you'd need to have SSH access to write the contab manually.
  8. It may be possible with one query, but I'm no expert when it comes to MySQL queries, so I'd probably just run the following two queries:
    First time:[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] [color=green]DISTINCT[/color] concat( users.lastname, [color=red]', '[/color], users.firstname ) [color=green]AS[/color] name, time_log.log, time_log.ts
    [color=green]FROM[/color] [color=orange]users,[/color] time_log
    [color=green]WHERE[/color] time_log.user [color=orange]=[/color] users.userID [color=blue]AND[/color] time_log.ts [color=orange]LIKE[/color] [color=red]'2006[span style=\'color:orange\']-[/color]05[color=orange]-[/color]25 08:%'[/span]
    [color=green]ORDER BY[/color] ts [color=green]ASC[/color] LIMIT 1 [!--sql2--][/div][!--sql3--]
    Last time:[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] [color=green]DISTINCT[/color] concat( users.lastname, [color=red]', '[/color], users.firstname ) [color=green]AS[/color] name, time_log.log, time_log.ts
    [color=green]FROM[/color] [color=orange]users,[/color] time_log
    [color=green]WHERE[/color] time_log.user [color=orange]=[/color] users.userID [color=blue]AND[/color] time_log.ts [color=orange]LIKE[/color] [color=red]'2006[span style=\'color:orange\']-[/color]05[color=orange]-[/color]25 08:%'[/span]
    [color=green]ORDER BY[/color] ts [color=green]DESC[/color] LIMIT 1 [!--sql2--][/div][!--sql3--]
    Someone with a lot more MySQL knowledge might come along soon and show you an easier way though!
  9. In a bid to rid this forum of similar questions being asked numerous times, I have pinned this read-only topic which will contain the most commonly requested expressions. This topic will be updated as and when we deem neccisarry.

    [code]//Validating E-Mail addresses
    if(!eregi("[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}",$email)) echo "Invalid E-Mail address.";

    //Validating UK format dates (DD/MM/YYYY), can be easily rearranged for other formats
    if(!eregi("(0[1-9]|[12][0-9]|3[01])[\/](0[1-9]|1[012])[\/]([0-9]{4})",$date)) echo "Invalid date.";[/code]
    Thanks for reading :)
  10. If you're using an image as the input type, you'll have to reference it as $_POST['submit_x'] or $_POST['submit_y'] instead of $_POST['submit'] as IE sends the coordinates of the click rather than the elements name. Other than that, I'd go along with poirot.
  11. You could probably do this be creating two arrays, one containing all of the files referenced in the database and the other containing all of the files actually in the directory. Compare the two arrays, and delete any files from the directory that are returned by the comparisson.

    Heres the functions I'd use...

    glob() - To get an array of files from a directory
    array_diff() - To compare the two arrays
    unlink() - To delete files

    Mixed with the usual MySQL functions and control structures.
  12. [!--quoteo(post=385622:date=Jun 19 2006, 02:11 PM:name=craigo)--][div class=\'quotetop\']QUOTE(craigo @ Jun 19 2006, 02:11 PM) [snapback]385622[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    [img src=\"style_emoticons/[#EMO_DIR#]/excl.gif\" style=\"vertical-align:middle\" emoid=\":excl:\" border=\"0\" alt=\"excl.gif\" /] Well because a collegue updated the site but didnt remove the old images in the folder, so now we need to check which of the files(.jpg's) are needed and which are not needed anymore before we delete the wrong files but if i have to do it manually then i have to delete about 500-1000 files(which will take forever).
    [/quote]
    I think you missunderstood me. How is PHP supposed to know if a file is not needed? Are you comparing the files in a directory to a list of files that are not needed, comparing to database enteries, or something else?
×
×
  • 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.