I am new to databasing, I started using sql with our server, I want to do work outside my office, and the server I have setup uses mysql. To my understanding sql and mysql are similar or the same, am I wrong? This are basic funtions that I use to connect and do simple funtions to my database with sql. Can someone help me rewrite the few code snippets I provided to mysql. I tried doing this myself and I just can’t get it to work. If someone can help, thanks so much, this means alot. I don’t need complex codes, just the basics I provided but in mysql code. Thanks in advance.
DB
[code=php]
<!– INSERT INTO DATABASE –>
<?php
$ser=”111.111.0.0″;
$db=”database”;
$user=”username”;
$pass=”password”;
$conn = odbc_connect($db, $user, $pass);
$conn = odbc_connect($db, $user, $pass);
$query = “INSERT INTO tablename (Entry1, Entry2, Entry3) VALUES (‘$Entry1’, ‘$Entry2’, ‘$Entry3’)”;
odbc_do($conn, $query);
?>
<html>
<!– HTML PAGE CODE HERE –>
</html>
<?php
odbc_close($conn);
?>
<!– UPDATE DATABASE –>
<?php
$ser=”111.111.0.0″;
$db=”database”;
$user=”username”;
$pass=”password”;
$conn = odbc_connect($db, $user, $pass);
$query = “UPDATE tablename SET Entry1 = ‘$Entry1’, Entry2 = ‘$Entry2’, Entry3 = ‘$Entry3’ WHERE Info =’$Info'”;
odbc_do($conn, $query);
?>
<html>
<!– HTML PAGE CODE HERE –>
</html>
<?php
odbc_close($conn);
?>
<!– DELETE FROM DATABASE –>
<?php
$ser=”111.111.0.0″;
$db=”database”;
$user=”username”;
$pass=”password”;
$conn = odbc_connect($db, $user, $pass);
$query = “DELETE FROM tablename WHERE Entry1 = ‘$Entry1′”;
odbc_do($conn, $query);
?>
<html>
<!– HTML PAGE CODE HERE –>
</html>
<?php
odbc_close($conn);
?>
<!– VIEW INFO FROM DATABASE –>
<?php
$ser=”111.111.0.0″;
$db=”database”;
$user=”username”;
$pass=”password”;
$id = $_GET[‘id’];
$conn = odbc_connect($db, $user, $pass);
$query = “SELECT * FROM tablename WHERE Entry1 = ‘” . $id . “‘”;
odbc_do($conn, $query);
?>
<html>
<?php
while($myrow=odbc_fetch_array($result)) {
echo(‘
Entry1: <input name=”Entry1″ value=”‘.$myrow[‘Entry1’].'”><br>
Entry2: <input name=”Entry2″ value=”‘.$myrow[‘Entry2’].'”><br>
Entry3: <input name=”Entry3″ value=”‘.$myrow[‘Entry3’].'”><br>
‘);
}
}
?>
</html>
<?php
odbc_close($conn);
?>