Hi Everyone
I'm looking for a ready made php script that allows me to make mysql database modification. abviously I will make some changes to fit my needs.
Any suggestions or links where I could download such a script

    not sure if its what you want, but do a search for PHP MY ADMIN - download it and install on your server and it will allow you to do many things with your mySQL databases.

      Hi
      Thanks for your help, but that is not what I'm looking for, I have created my database using myphpadmin on my server and I can go and make mods there, but I want to be able to make changes from a php script that reads and write, on a database. A simple script will do.

        Assuming you have MySQL...

        To connect to a database:

        $login="mysql_login_name";
        $password="mysql_password";
        $host="localhost";
        $database="database name";
        
        $connection=mysql_connect($host,$login,$password)
          or die("Connection to database server on $host not established.");
        $db=mysql_select_db($database,$connection)
          or die("Connection to database $database not established");
        

        To select data:

        $select="select column1,column2 from tablename
          where column3=\"$somevalue\" ";
        $result=mysql_query($select)
          or die("Select statement \"$select\" had errors.");
        while ($row=mysql_fetch_array($result,MYSQL_ASSOC))
          {
          extract($row);
          //do what you need to do...
          }
        

        To update data:

        $update="update tablename set 
          column1=\"$var1\",
          column2=\"$var2\" 
          where column3=\"some-value\" ";
        $result=mysql_query($update)
          or die("Update into tablename had errors.");
        

        To insert data:

        $insert="insert into tablename
          (column1,column2,column3)
          values
            (\"$var1\",\"$var2\",\"$var3\") ";
        $result=mysql_query($insert)
          or die("Insert into tablename had errors.");
        

        To delete data:

        $delete="delete from tablename
          where $column1=\"$var1\" ";
        $result=mysql_query($delete)
          or die("Delete from tablename had errors.");
        

        To close the database after you're done:

        mysql_close($connection);
        

        That's about as general as I can get...

          Hi
          Thanks for going through all the trouble in writing the codes for me, but I found this neet script that is exactely what I was looking for, the only problem is that it is to complicated for me, perhaps you can still help me, my database is huge it has over 8700 records and 22 columns, it take to long to display data and twice as long to edit the records.
          Could you or anyone that can help me, add a code to specify from which id record it should start from, and show 20 records at a time.
          Please look at the attached file

            Write a Reply...