Jump to content

PravinS

Members
  • Posts

    459
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by PravinS

  1. Set headers, 4th parameter of mail() function

    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    
    // Additional headers
    $headers .= 'To: TO_NAME <TO_MAIL>' . "\r\n";
    $headers .= 'From: FROM_NAME <FROM_MAIL>' . "\r\n";
    $headers .= 'Cc: CC_MAIL' . "\r\n"; 
    $headers .= 'Bcc: BCC_MAIL' . "\r\n";
  2. You can use UPDATE query like this

    UPDATE table_name SET phone = CONCAT('353',TRIM(LEADING '0' FROM phone)) WHERE SUBSTRING(phone,1,1) = '0';

    before that use the SELECT query to check if its correct or not

    SELECT phone, CONCAT('353',TRIM(LEADING '0' FROM phone)) FROM table_name WHERE SUBSTRING(phone,1,1) = '0';
    

    hope this will find you helpful

  3. Try this

    <html>
    <head>
    <style type="text/css">
    .colleft{
    	float:left;
    	width:50%;
    	text-align:left
    }
    .colright{
    	float:right;
    	width:50%;
    	text-align:right;	
    }
    
    </style>
    </head>
    <body>
    <div>
        <div class="colleft">Left</div>
        <div class="colright">Right</div>
    </div>
    </body>
    </html>
    
    
  4. Named the submit button, but still no luck on writing to the database....

     

    you have not included "dbconfig.php" database connection file in "registration.php" file

    also use error_reporting(E_ALL & ~E_NOTICE); at the top, to check PHP errors

  5. I can't believe I missed the method... Feel like a fool... Ok so now that I've added that I checked and can confirm that the array now holds the data, but now it's not writing to the database.

     

    I still have to read through everything again so see what I may be missing.

     

    also you have not given name to submit button

  6. Try using this function

        function sort_array($array, $sortkey, $order)
        {
            if ($order == "DESC")
                $or = "arsort";
            else
                $or = "asort";
    	foreach ($array as $key => $array_row)
            {
                $sort_values[$key] = $array_row[$sortkey];
            }
            $or($sort_values);
            reset($sort_values);
            while (list ($arr_key, $arr_val) = each($sort_values))
            {
                $sorted_arr[] = $array[$arr_key];
            }
            return $sorted_arr;
        }
    

    hope this will work for you

  7. use quotes around option value or use select box as

    <select name="charity_name" id="charity_name">
    <?php
        while ($row=mysql_fetch_array($charity))
        {
           echo '<option value="'.$row[charity_name].'">'.$row[charity_name].'</option>'; 
        }
    ?>
    </select>
    
    

    hope this will help you

  8. That solution isn't going to quite work since $row{"visivel"} comes from the first query.

     

     

    @magcr23 - That first query probably is not necessary. The update query will only change visivel when it is equal to zero.

     

    If you need to show the message about the product already being shown, you could use mysql_affected_rows(). More information about the function can be found here:

    http://php.net/manual/en/function.mysql-affected-rows.php

     

    oh sorry, i missed that

  9. You missed mysql_query() for UPDATE query, also SELECT query should be below UPDATE query, so you will get updated data

    <?php
    	require("bd/conexao.php");       
    	if ($row{"visivel"}== 0)
    	{
    		$update= "UPDATE produtos SET visivel = 1 WHERE visivel = 0";
    		mysql_query($update);
    		echo $update;
    	}
    	else
    	{
    		echo "o produto ja esta visivel";
    	}   
    
    	$sql = "SELECT * FROM produtos";
    	$resultado = mysql_query($sql);
    	$row = mysql_fetch_array($resultado);
    ?>
    
  10. Try this query

    SELECT username, count(username) AS post_count FROM TABLE_NAME 
    GROUP BY username
    ORDER BY count(username) DESC;

    you can apply LIMIT to get top records, as query will give sorted result according to max post count of user.

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