Jump to content

gristoi

Members
  • Posts

    840
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by gristoi

  1. you havent executed the query. You need to execute the query to get the resource id THEN use any fetch commands to retrievfe the data. it should look something like this:

    <?php
    session_start();
    include './includes/mysql/connect.php';
    
    $query = 
    ("
    SELECT *
    FROM `forum_cats` AS cats, `forum_subs` AS subs, `forum_topics` AS topics, `forum_replys` AS replys, `users` AS users
    WHERE subs.cat = cats.name
    AND topics.sub_cat_id = subs.id
    AND replys.sub_cat_id = subs.id
    AND users.username = replys.username
    ORDER BY cats.id ASC , replys.id DESC
    ") ;
    $result = mysql_query($query) or die(mysql_error());
    while ($row = mysql_fetch_array($result)){
    
    // output the results . ie $row['item1'];
    
    }
    ?>
    

  2. It is a matter of maths. If you had, for example, 6 queries that perform a set of tasks compared against 1 query that returns the same results as the 6, then you had 100 hits per second on your site executing the queries on that page then you would end up with 600 calls to the database compared to 100. So scale that up and imagine how much impact that would have on your server. Take thorpes good advice and look up on joins

  3. what was it you said? :" i have 2 problems" lol:

     

    mysql_query("DELETE from `pass_reset` WHERE 'confirm_code='$confirmation'");

    should be

    mysql_query("DELETE from `pass_reset` WHERE `confirm_code`='$confirmation'");

  4. thisnk ive found your problem:

    $selectkey="SELECT * FROM $table1 WHERE confirm_code =$confirmation'";

     

    you have a ' after confirmation. should be:

    $selectkey="SELECT * FROM $table1 WHERE confirm_code ='$confirmation'";

  5. do you mean something like this?

    <?php
    
    $host="localhost"; // Host name 
    $username="fustigat_lol"; // Mysql username 
    $password="lol123"; // Mysql password 
    $db_name="fustigat_phoenix"; // Database name 
    
    
    //Connect to server and select databse.
    mysql_connect("$host", "$username", "$password")or die("cannot connect to server"); 
    mysql_select_db("$db_name")or die("cannot select DB");
    
    $email=$_POST['email'];
    
    $tbl_name=users;
    
    $sql="SELECT mail FROM $tbl_name WHERE mail='$email'";
    $result=mysql_query($sql);
    
    if(mysql_num_rows($result)== 0)
    {
    		echo 'You did not submit a valid email';	
    }
    else {
    
    	$query_user="SELECT username FROM $tbl_name WHERE mail='$email'";
    	$user=mysql_query($query_user);
    
    
    	$confirmation=md5(uniqid(rand()));
    	$hotel_name=Hotel;
    
    	// Email
    	$to=$email;
    
    	$subject="Password Reset - $hotel_name";
    
    	$header="From: fustigate@fustigate.net\r\n";
    	$message="Your confirmation link\r\n";
    	$message.="Click on this link to to have a password sent to you\r\n";
    	$message.="http://fustigate.net/confirmation.php?code=$confirmation";
    
    	$sentmail = mail($to,$subject,$message,$header);
    
    
    	if($sentmail){
    	echo "Thank you $user, a confirmation link has been sent to your email.";
    	}
    }
    ?>
    

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