Jump to content

Masna

Staff Alumni
  • Posts

    288
  • Joined

  • Last visited

Posts posted by Masna

  1. Why are you putting everything in a loop? All of your header declarations should be outside of the loop. The only thing in the loop should be the readfile for each file (and whatever else you need to add each file to the .zip).

  2. Can someone show me what the error in this is.

    Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource n /public_html/venues/venues.php on line 23 This is line 23 $num=mysql_numrows($result);

    NO Vemues Schedule

    $query = 'DELETE FROM Venues WHERE DATE_SUB(CURDATE(),INTERVAL 1 DAY) >= `Date1`'; 
    mysql_query($query);
    $query= 'SELECT venues_field_1, venues_field_2, venues_field_3, venues_field_4, venues_field_5, venues_field_6, venues_field_7, venues_field_8. venues_field_9, venues_field_10, venues_field_11, venues_field_12, venues_field_13, venues_field_14, venues_field_15 FROM Venues ORDER BY venues_field_1 DESC LIMIT 0, 100';
    
    $result=mysql_query($query);
    
    $num=mysql_numrows($result);
    
    if ($num==0) {
    echo "<b>NO Vemues Schedule</b><br>";
    }else{
    echo "<b>Where We Are</b><br>";
    }
    
    mysql_close();
    
    $i=0;
    while ($i < $num) {
    
    $venues_field_1=mysql_result($result,$i,"venues_field_1");
    $venues_field_2=mysql_result($result,$i,"venues_field_2");
    $venues_field_3=mysql_result($result,$i,"venues_field_3");
    $venues_field_4=mysql_result($result,$i,"venues_field_4");
    $venues_field_5=mysql_result($result,$i,"venues_field_5");
    $venues_field_6=mysql_result($result,$i,"venues_field_6");
    $venues_field_7=mysql_result($result,$i,"venues_field_7");
    $venues_field_8=mysql_result($result,$i,"venues_field_8");
    $venues_field_9=mysql_result($result,$i,"venues_field_9");
    $venues_field_10=mysql_result($result,$i,"venues_field_10");
    $venues_field_11=mysql_result($result,$i,"venues_field_11");
    $venues_field_12=mysql_result($result,$i,"venues_field_12");
    $venues_field_13=mysql_result($result,$i,"venues_field_13");
    $venues_field_14=mysql_result($result,$i,"venues_field_14");
    $venues_field_15=mysql_result($result,$i,"venues_field_15");
    
    echo "<b>$venues_field_1<br>$venues_field_2 - $venues_field_3</b><br>$venues_field_4<br>$venues_field_5<br>$venues_field_6<br>$venues_field_7<br>$venues_field_8<br>$venues_field_9<br>$venues_field_10<br>$venues_field_11<br>$venues_field_12<br>$venues_field_13<br>$venues_field_14<br>$venues_field_15<br>";
    
    $i++;
    }

     

     

     

    You have a very basic (and relatively obvious) syntax error in your query: a period where a comma should be. Use this:

     

    $query= 'SELECT venues_field_1, venues_field_2, venues_field_3, venues_field_4, venues_field_5, venues_field_6, venues_field_7, venues_field_8, venues_field_9, venues_field_10, venues_field_11, venues_field_12, venues_field_13, venues_field_14, venues_field_15 FROM Venues ORDER BY venues_field_1 DESC LIMIT 0, 100';

     

    Also, the function is mysql_num_rows(), not mysql_numrows (although, apparently the latter works also).

  3. <?php
    // Our name
    $name = "john Doe";
    
    // Seperate the name at the space, this will
    // give us an array with 2 values
    $parts = explode($name);
    
    // ucfirst makes the first character uppercase
    echo ucfirst($parts[0]);
    ?>
    
    

     

    Should be:

     

    <?php
    // Our name
    $name = "john Doe";
    
    // Seperate the name at the space, this will
    // give us an array with 2 values
    $parts = explode(" ", $name);
    
    // ucfirst makes the first character uppercase
    echo ucfirst($parts[0]);
    ?>

     

  4. function store_errors($error_level, $error_message, $error_file, $error_line, $error_context){
         $insert = mysql_query("INSERT INTO `table` (`error_level`, `error_message`, `error_file`, `error_line`, `error_context`) VALUES ('$error_level', '".mysql_escape_string($error_message)."', '".mysql_escape_string($error_file)."', '".mysql_escape_string($error_line)."', '".mysql_escape_string($error_context)."')");
    }
    
    set_error_handler("store_errors");
    
    //this of course implies that you've created a MySQL table called "table" with 5 fields (error_level, error_message, error_file, error_line, error_context)

  5. A foreach loop is a loop that takes an array and cycles through it. $_FILES['file']['name'] is not an array: it's a string.

     

    Try this:

     

    foreach($_FILES as $str) {
    $fp = fopen('upload.xml', 'a+');
    fwrite($fp, $str['name']);
    fclose($fp);
    }

  6. <?php
    $redir = @$_GET['redir'];
    if (!$redir) $redir = "index.php";
    
    if (!$userInfo['loggedin']) {
    $do = @$_GET['do'];
    if ($do == "") {
      fetchTemplate("header");
      fetchTemplate("login");
      fetchTemplate("footer");
    }
    else if ($do == "login") {
      $error = "";
      $user = addslashes(htmlentities($_GET['user']));
      $pass = md5(addslashes(htmlentities($_GET['pass'])));
      $query = mysql_query("SELECT * FROM `member` WHERE username='$user' AND password='$pass'");
      $q = mysql_fetch_row($query);
      if (!$q[0]) {
       $error .= "Username and password do not match.<br />\n";
      }
      else {
       $_SESSION['loggedin'] = 1;
       $_SESSION['user'] = $user;
       header("Location: ".$redir);
      }
      if ($error) {
       fetchTemplate("header");
       echo "<br><p align=center><font color=red>".$error."</font></p>";
       echo "\n<p align=center><a href=\"login.php\">[ Back ]</a></p>\n";
       fetchTemplate("footer");
      }
    }
    }
    else {
    header("Location: index.php");
    }
    ?>

  7. firstpage.html

    <form action="secondpage.php" method="post">
         <input type="text" name="username">
         <input type="submit" name="submit" value="Login">
    <form>

     

    secondpage.php

    $username = $_POST['username'];

     

  8. You can convert it to a string by typecasting the variable. Although I can't see how it could be anything other than a string, when you're retrieving it from the database?

     

    So, can you post how you retrieve $mydate?

  9. You can combine this line -

    if (!isset($error['name']) && !isset($error['email']) && !isset($error['password']) && !isset($error['accept']))

     

    into -

    if (!isset($error['name'], $error['email'], $error['password'], $error['accept']))

     

    What the OP posted and what you have here are, logically, not the same. Passing multiple variables to isset (joined by commas) checks them all with respect to OR; that is, if any one of the 4 variables passed in here isn't set, the entire statement will return true (because of the logical NOT; isset will return false).

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