Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* SQL */
- $sql = "UPDATE Exchange SET poundRate= $_pounds, dollarRate= $_dollars, euroRate= $_euros";
- $result = mysql_query($sql) or die(mysql_error());
- /* some other general usage */
- $num_rows = mysql_num_rows($result);
- while($row = mysql_fetch_assoc($result)) {
- echo $row['field1'].' '.$row['field2']; //etc...
- }
- ========== IMPORTANT ========================= BUT, BUT Y U STILL USE THIS OLD GRUMPY THING??===================
- PLEASE DON'T, FOLLOW UP WITH YOUR TOOLS, LEARN PDO and PREPARED STATEMENTS:
- like... now!
- /* Connect with PDO */
- $connection = new PDO('mysql:host=localhost;dbname=my_db;charset=UTF-8','username', 'password');
- $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $connection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
- // connection is all setup
Add Comment
Please, Sign In to add comment