Jump to content

Masna

Staff Alumni
  • Posts

    288
  • Joined

  • Last visited

Posts posted by Masna

  1. thanks a lot, I fixed it.

    but the only problem that I still have is when I enter all the information, the submit button will appear, and the fieds are becoming empty, how can I keep the information inside the fields?

     

    <input type="text" name="name_of" value="<?PHP echo htmlspecialchars($_POST['name_of']); ?>">

  2. function Hilight($val1, $val2){

    $return = "";

    if($val1 == $val2){

    $return = " style='color:blue;'";

    }

    return($return);

    }

     

     

    echo("<option value='cat'><font" . Hilight("cat",$teach) . ">

    cat

    </font></option>");

     

    ...

     

    The HTML source that's outputted. (I guess I had this coming to me.)

  3. $get_emails = mysql_query("SELECT * FROM `emails`");
    while($row = mysql_fetch_assoc($get_emails)){
         $curr_email = $row['emails_email'];
         $curr_count = mysql_query("SELECT * FROM `emails` WHERE `emails_email`='".mysql_escape_string($curr_email)."'");
         $i = mysql_num_rows($curr_count);
         while($i > 1){
              $del = mysql_query("DELETE FROM `emails` WHERE `emails_email`='".mysql_escape_string($curr_email)."' LIMIT 1");
              $i--;
         }
    }

     

    Run this once. This will delete duplicate entries in emails_email. (I suggest backing up first...)

  4. $sql = "SELECT id,Subject FROM menusubjects";
    $menu = mysql_query($sql);
    while($row = mysql_fetch_assoc($menu)){
    echo $row['Subject'];
    if ($row['Subject'] == $menu_type)
    {
    $sql2 = "SELECT * FROM regularmenu WHERE menusubjects ='$menu_type'"; //line 54
    $smenu = mysql_query($sql2);
    while ($srow = mysql_fetch_assoc($smenu)) {
    echo $srow['shoename']; 
    }
    }
    }
    ?>

  5. hi,

    when these fields are checked, I want the submit button to open the response.php page.

    if it contains errors they will be fixed and if no response.php will open when clicked on it.

    is it possible to do it?

     

    Thanks...

    I put this code, but it is wrong :S

     
    <?php 
    if (!isset($error['name']) && !isset($error['email']) && !isset($error['password']) && !isset($error['accept']) ){
    }?>
    <input name="submit" type="submit" onClick="document.contactForm.action='response.php';" value="Submit">
    

     

    Huh?

  6. $sql = "SELECT id,Subject FROM menusubjects";
    $menu = mysql_query($sql);
    while($row = mysql_fetch_assoc($menu)){
    echo $row['Subject'];
    if ($rod['Subject'] == $menu_type)
    {
    $sql2 = "SELECT * FROM regularmenu WHERE menusubjects ='$menu_type'"; //line 54
    $smenu = mysql_query($sql2) //missing semicolon HERE <-- ERROR ERROR ERROR
    while (srow = mysql_fetch_assoc($smenu)) {
    echo $smenu['shoename']; 
    }
    }
    }
    ?> 

  7. I tend to program most efficiently when I'm listening to music. It distracts that part of my brain that is seeking distractions (so as to keep throwing me off track), and I'm usually able to keep the work-oriented portion of my brain concentrated with the rest concentrated on the music.

  8. It's not bad. It looks, for the most part, professional. It certainly gets the job done.

     

    Though, I wouldn't be totally surprised if at least half of the users that first visit the site vow never to revisit because of the blinding purple rays coming from every direction.

  9. thanks for quick reply,

    I am attaching a part of script

     

    <?session_start();

     

    $uip=$_SERVER['REMOTE_ADDR'];

    $query = "select pollId from pollanswers where pollId=1 and visitorIP='$uip'";

      $numresults=mysql_query($query);

      $numrows=mysql_num_rows($numresults);

    if ($numrows == 0){?>

      <h2>Poll Of The Day</h2>

      <form action="" name="poll" >

      <?

      $result=mysql_query("select * from pollquestions");

      while($row_list=mysql_fetch_assoc($result))

    <display Poll Questions / Options>

    }

     

    For Exp:

    I have Casted vote and My External IP is 1.1.1.1 and to this external ip there 3 computers connected with internal ip.

    How to allow others to cast the vote, hopefully I am expressing my question properly, if not I appologise.

    Thanks

     

     

    Well, unfortunately (as far as I know), there's no way to differentiate from devices connected locally to the same remote IP address. So, even if one IP address is consistent with ten local users (all in the same house, for argument's sake), once one of the ten voted, the other nine could not vote.

  10. Does your server provide MySQL Database support? If so, I recommend reading up on MySQL: INSERT and SELECT queries.

     

    And, you can retrieve a user's IP address at any time using the superglobal array "$_SERVER."

     

    $ip_address = $_SERVER['REMOTE_ADDR'];

  11. This works:

    $query  = "SELECT * FROM test1";

    $result = mysql_query($query) or die (mysql_error());

     

    But this throws up the error:

    $query  = "load data infile 'upload.csv' INTO TABLE test1";

    $result = mysql_query($query) or die (mysql_error());

     

     

    That probably means that the user "mobile" doesn't have the privilege to utilize the LOAD DATA INFILE syntax. Check the privileges on said user.

  12. Yes, this is the error:

    Access denied for user 'mobiles'@'localhost' (using password: YES)

     

     

    Lol.

     

    You have to use mysql_connect() to open a connection with the MySQL server associated with your site. Then, you have to use mysql_select_db() to select a database with which you'd like to interact.

     

    Both of these must be used before you attempt to execute any MySQL queries.

     

    Edit: I see that you actually have already implemented these two functions. So, the problem, clearly, is that your username and password credentials are collectively invalid.

  13. thanks for the webiste, but I still need help ! :S

     

    is there any link to put it in the other page in order not to display undifined name?

     

     

    Huh?

     

    somepage.html

    <form action="otherpage.php" method="post">
         <input type="text" name="name">
         <input type="submit" value="submit">
    </form>

     

    otherpage.php

    echo $_POST['name']; //will print whatever is inputted in the 'name' text field in somepage.html

     

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