Jump to content

mike12255

Members
  • Posts

    439
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by mike12255

  1. Im trying to figure out if a user has already downloaded something so im seeing if they have a uid (user id) in the database along with the nid (note id) that they are trying to download. I echoed out the sql and it returned this:

     

    SELECT * FROM purchases WHERE uid =1 AND nid =7

     

    i manually ran that sql in phpmyadmin and it returned a couple rows.  However my var $rows = mysql_num_rows($res2) has no value when i echo is out. Appriciate any help here is my code:

     

    <?php
    $sql2 = "SELECT * FROM purchases WHERE uid =".$user_id." AND nid =".$id;
    				$res2 = mysql_query($sql2) or die (mysql_error());
    				$rows = mysql_num_rows($res2);
    				?>

     

  2. Hey guys I cant seem to find this error guess ive been looking at this screen to long to try and get this project done in time would appriciate if someone could take a fresh look at it and tell me where I went wrong. Basically im trying to get the number of entries returned by my query. I echoed out the query and manually entered it into phpmyadmin there is a 1 row result however whenever i kill $num_result it doesnt give me any  output.

    <?php
    
    public function getNewMessages()
    {
    	global $db,$db_table_prefix;
    
    	$sql = "SELECT
    			*
    			FROM
    			messages
    			WHERE
    			`to_id` = '".$db->sql_escape($this->user_id)."' AND `read` = 0";
    
    
    
    
    	$res = mysql_query($sql) or die (mysql_error());
    
    	$num_rows = mysql_num_rows($res);
    
    	die ($num_rows); // does not return a value
    
    
    
    	return $num_rows;
    
    }
    
    
    ?>

  3. $query=mysql_query("SELECT * FROM users WHERE username='$username'") or die (mysql_error());

     

    lets see what error it gives you, if any.

     

    Also do you understand that in location the text has to exactly look like this spaces and all or it will return 0:

     

    England, Japan, Colombia, USA, Russia, Italy, Turkey

  4. Because I dont have time to look through your code ill just type a quick example.:

    <?php
    $query = "SELECT * FROM customer_info";
    $res = mysql_query($query);
    $row = mysql_fetch_array($res);
    
    echo "<input type=\"text\" name=\"name\" value=\"".$row['name']."\" />";
    echo "<input type=\"text\" name=\"adress\" value=\"".$row['adress']."\" />";
    
    ?>
    

     

    understand?

  5. Ok, so basically someone submits a file (doc) and I need to see if it is the same as another file. So instead of opening 300+ files and checking for word similarity, I put the file info into a table called newnotes. Then check the file size for each of the notes in "newnotes" against all of the notes in the table "approvednotes" this could be something like matching 20 file sizes to 300+ file sizes. The user gets returned back to a page and this is all done in backend by the click of a button the admins can use. But would doing this slow down my server/website?

  6. FROM is a reserved mysql keyword, as in SELECT * FROM table_name.

     

    You either need to rename your column to something else or you must enclose the column `FROM` in back-ticks every time you use it in a query.

    good call, dont know how I missed it.

  7. if (($ext == "jpg") ||($ext == "gif") || ($ext == "png") && ($_FILES["uploaded_file"]["type"] == "image/jpeg") && 
        ($_FILES["uploaded_file"]["size"] < 600000)) {

     

     

    you can view information on php's or (||) operator  here

     

     

    you should learn all of the operators before starting to code.

  8. Question One:

    <?php
    $username = $_GET['user'];
    echo "<input type=\"text\" name=\"username\" value\"".$username."\"/>";
    ?>
    

     

    Dont quite understand question two sorry. I think your asking to pass the login credentials through the URL and have it auto login the user. This is very unsafe and in my opinion stupid (no offence) most passwords in databases are encrypted ($pass = md5($pass)) so that there would be no way to know what the actually password it because the only way to have pass equal the md5 is by typing in the right password.

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