hello

i have seen that tables are locked in mysql while reading the same table..so should i continue using mysql in my website...

Recommended Answers

All 14 Replies

Instead you should probably wrap the group of queries in a MySQL transaction.
The easiest way to go is to INSERT a record in the logging table if it's not yet present, and then check for that record

there are multiple Database storage engines in MySQL. MyISAM and InnoDB for example.
MyISAM locks the whole table on single write and can be corrupted etc.
InnoDB locks only the row not the whole table and has no chances of corruption (as far as i know)

ok good answer.

and what i see is backing up of database takes more memory than replication ...so is innodb good for replication .....because i will replicate my data as it is on another system ....

yeah innoDB is great. I never ran into problems with it. and if you're using Windows on the Client machine (where you want all data backed up aka replicated), you might want to try SQLYog there.

no...i was wrong..total database size was 22kib but mysqldump file is only 5.5 kb..so its better to take backup then replicate..

are u expert in java also..??

I would like to think so

ok..how could i get options value through ajax of <select> inhtml??

do you want it in a java application or a web based application with jsp back-end?

java is not running correctly on my ubuntu laptop..so i decided to make this in html+php...i show u my codes..

i want both the values of select dropdownlist so that i can pass to another php script for processing

<?php

$q=$_GET['q'];

//echo $q;

$con=mysqli_connect("localhost","root","",$q);
    if (mysqli_connect_errno()) 
        {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}


$abc=mysqli_query($con,"use $q") or die('cannot show tables');

$result=mysqli_query($con,"show tables");
echo "<select>";
        while($row= mysqli_fetch_array($result))
                {
echo "<option value='". $row[0]. "'/>" . $row[0] . "</option>";

                   }
                   echo "</select>";

?>

and index.php

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
                <title>Main Page</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script>
function getddl1v()
{
    var a=document.getElementById("dbase").value;
   // alert(a);
var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
   document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getddl2v.php?q="+a,true);
xmlhttp.send();
}


function showtables()
{
    var a=document.getElementById("dbase").value;
   // alert(a);
var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
   document.getElementById("txtHint").innerHTML=xmlhttp.responseText;


        }
  }
xmlhttp.open("GET","getddl2v.php?q="+a,true);
xmlhttp.send();
}


</script>
    </head>
    <body onload="getddl1v()">
        <h1>For Businesses</h1>
            <form name="f1" action="wel.php" method="post" target="_blank">
                <select id="dbase" name="dbase" onchange="showtables()">
                <?php
                            $link = mysqli_connect('localhost', 'root', '','people') 
                                    or die("Could not connect database");
$result=mysqli_query($link, "show databases");
        while($row= mysqli_fetch_array($result))
                {
echo "<option value='". $row['Database']. "'/>" . $row['Database'] . "</option>";

                   }
                    ?>

                </select>
                <select id="a"></select>
                <div id="txtHint"></div>

            <textarea name="skills" placeholder="skill or item or spec">java</textarea>
            <textarea name="city" placeholder="city"></textarea>
            <textarea name="region" placeholder="region"></textarea>
            <textarea name="country" placeholder="country"></textarea>
            <input type="text" name="lat" placeholder="Latitude in degrees">
        <input type="text" name="long" placeholder="Longitude in degrees">
        <input type="text" name="dist" placeholder="Distance"><br>
        <input type="text" name="file" placeholder="Genearted filename">
        <input type="submit" value="(1) Show Results" name="results">
        <input type="submit" value="(2) Update Table" name="update"> 
        <input type="submit" value="(3) Make E-mail CSV" name="csv"> 
        <input type="submit" value="(3) Make Phone Number CSV" name="phone">

        <input type="submit" value="Get person Info with Deposit<Bid" name="less"> 

        </form>
        <form action="wel.php" target="_blank" method="post">
            <input type="text" placeholder="Database" name="db1" value="people">
            <input type="text" name="table1" placeholder="Table containing person data">
            <input type="text" placeholder="Sno" name="sno">
            <input type="text" name="amount" placeholder="Deposit amount">
            <input type="submit" value="Make Deposit" name="deposit">  
            </form>
        <h1>For Marriages</h1>
        <h1>For Jobs</h1>



        </body>
</html>

i want ajax to return only the options value of select id=a..

first of all, NEVER PASTE YOUR DATABASE PASSWORD. Replace it with something like XXXX. Secondly use jQuery or something like that and thirdly nothing would show up because you're using mysqli_fetch_array and using string keys.
You might want to replace it with mysqli_fetch_assoc

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.