Jump to content

Recommended Posts

Posted

I was wondering if someone could point me in the right direction to a tutorial or something along those lines. Basically I want to be able to pull data from a mysql db into a form and edit the information in that form and then send the updated data back to the db. Got any links? :)

Posted

I did a few google searches and didn't find anything that was close to what I was looking for. Thanks for the link but unfortunately it's not exactly what I'm looking for. Thank you for looking though.

Posted (edited)

Maybe this'll get you started:

 

><?php
$username = "username";
$password = "password";
$database = "database";
$table = "table";

// Connecting, selecting database
$link = mysql_connect("localhost", "$username", "$password")
  or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db("$database") or die('Could not select database');

// Performing SQL query
$query = "SELECT * FROM $table";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());

// Printing results in HTML
// echo "<table>\n";
echo "<html><body>";
echo "<p>";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
  foreach($line as $key => $value) {
   echo "\$$key == $value";
   echo "<br>";
   }
  echo "<p>";
  
  }

echo "</body></html>";

// Free resultset
mysql_free_result($result);

// Closing connection
mysql_close($link);
?>

 

When I have more time, if you still haven't figured the rest out, I might be able to look deeper into it.

Although, you could just use phpmyAdmin in your controlpanel:

http://yoursite.com:2082/3rdparty/phpMyAdmin/index.php

Edited by Steve Scrimpshire

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...