PHP - add record to MySQL data source

dragon2309

P.I Dragon
Using a PHP page is it possible to create my own user freindly GUI to add records to my MYSQL database. I currently do this by logging into PHP MY ADMIN and doing lots of stuff in there. Sometimes i use MySQL Control Center.

Any help would be much appreciated...

Code:
<?php
     include "dbinfo.php";

     // Connect to MySQL DBMS
     if (!($connection = @ mysql_connect(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD)))
       showerror();

     // Use the simplytruedb database
     if (!mysql_select_db(DB_DATABASENAME, $connection))
       showerror();

     // Create SQL statement
     $query = "SELECT *
	      FROM `ad_set`
	      WHERE StockCount > 0";

     // Execute SQL statement
     if (!($result = @ mysql_query ($query, $connection)))
       showerror();

	 // Display results
	while ($row = @ mysql_fetch_array($result))
       echo "<tr><td>{$row["StockCode"]}</td>
       <td>{$row["Description"]}</td>
       <td>{$row["Price"]}</td>
       <td><img src='{$row["IMG"]}'></img></td>
       <td><center><a href='{$row["URL"]}'>$row[URL]</a></center></td></tr>";

   ?>

Thats a part of the php page that returns the records from selected query arguments. Seeing as i have the database username and password stored in

Code:
include "dbinfo.php";

cant i just change a few things and ahve t add a record...?? I know cromewell is good at this type of thing, CROMEWELL, are you there???


dragon2309
 
Chill, 6-9AM local time is too early on weekends for me I don't live in the UK :P

I assume you're looking to build a web interface for running SQL commands?
 
Sure, it wouldn't be overly complicated to do, before you go reinventing the wheel here why can't you use phpMyAdmin?
What you need to do to build your own is create a way for a user to select a table (I'd use a drop down) then create x number of text fields for input based on how many fields are in the table.
 
Back
Top