$username='';
$password='';
$database='';
$con = mysql_connect('localhost',$username,$password);
mysql_select_db($database,$con);
$insert = 'INSERT INTO `usuarios`(`nombre`, `edad`) VALUES ("'.$name.'","'.$edad.'")';
mysql_query($insert,$con);
$rows = array();
$query = mysql_query('SELECT * FROM `usuarios`',$con);
while ($row = mysql_fetch_array($query)){
$rows[] = $row;
}
echo json_encode($rows);
mysql_close($con);
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.