Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Posts posted by PravinS

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

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

    hope this will help you

  2. 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:



    oh sorry, i missed that

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

    	if ($row{"visivel"}== 0)
    		$update= "UPDATE produtos SET visivel = 1 WHERE visivel = 0";
    		echo $update;
    		echo "o produto ja esta visivel";
    	$sql = "SELECT * FROM produtos";
    	$resultado = mysql_query($sql);
    	$row = mysql_fetch_array($resultado);
  4. 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.

  5. Check this simple logic


    <table border="0" cellspacing="0" cellpadding="5">
        $array = array(1,2,3,4,5,6);
        $i = 1;
        foreach($array as $val)
            echo '<td>'.$val.'</td>';
            if ($i % 2 == 0)
                 echo "</td></tr>";

    I hope this will help you

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