Hello Dear I Want to display 96 in my webpage, please tell me code, please .. i want to show like this, $crdt = "Show credit where ROW=admin"; echo $crdt; Please tell me about this
SELECT credit FROM tablename WHERE username='admin' Code (markup): Everything else depends on whether you are still using deprecated mysql_* functions or not. Note: http://www.w3schools.com/sql/ is waiting for you.
I type this, <?php mysql_connect("localhost","test","pass") or die(mysql_error()); mysql_select_db("test") or die(mysql_error()); $lol = SELECT credit FROM dbUsers WHERE username='admin'; echo $lol; ?> PHP: This Error show Parse error: syntax error, unexpected T_STRING in /home/lalaurl/public_html/register/new.php on line 6
Are you serious? mysql_connect("localhost","root","") or die(mysql_error()); mysql_select_db("test") or die(mysql_error()); $query = mysql_query("SELECT credit FROM users WHERE username='admin'"); if (mysql_num_rows($query) != 0) { while ($row = mysql_fetch_array($query)) { echo "Credit: " . $row["credit"]; } } else { echo "No data found!"; } PHP:
Hello Dear if want to put Credit in this, $db = new mysqli('localhost','root','','test'); if ($db->connect_error) { die("Connect Error: " .$db->connect_error); } $sql = "UPDATE dbUsers SET credit='??????????' - 1 WHERE username='admin'"; if ($db->query($sql) === FALSE) { die("Update failed. Error: " .$db->error); } else { echo "Success"; } PHP: