Jump to content

javinladish

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

javinladish's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hey! This actually works perfectly. Thanks so much. Is there a way to limit it to only able to print once? Right now, as you keep clicking the button, it continues to print the table over and over.
  2. Hello, What I am looking to do is have a series of buttons laid out and when the user 'onClick', a table from my MySQL database will load into a scrollable textbox within the same webpage. I figure I need to go about this using AJAX, which unfortunately I have basically no experience in. For example purposes here is what I have going: This php code basically just displays the table we want to tie the button click to. <?php include("connect.php"); //Query of facebook database $facebook = mysql_query("SELECT * FROM facebook") or die(mysql_error()); //Output results if(!$facebook) { echo "There was an error running the query: " . mysql_error(); } elseif(!mysql_num_rows($facebook)) { echo "No results returned"; } else { $header = false; echo "<table border='1'>\n"; while($row = mysql_fetch_assoc($facebook)) { if(!$header) { echo "<tr>\n"; foreach($row as $header => $value) { echo "<th>{$header}</th>\n"; } echo "</tr>\n"; } echo "<tr>\n"; foreach($row as $value) { echo "<th>{$value}</th>\n"; } echo "</tr>\n"; } echo "</table>\n"; } mysql_close(); ?> I'd really like to make this as easy as possible. After doing research, I figured that just Javascript would not be enough because it is client-side. It would be great if someone could point me in the right direction. Thanks in advance to anyone who replies.
  3. Nevermind about that last error. I think it might just because nothing is submitted when you first load the page. However, when I run a query on a table that I know has information in it, I get this error: Warning: mysql_fetch_assoc() expects at least 1 parameter, 0 given in /var/www/test.php on line 27
  4. This is the syntax error that is being reported. Notice: Undefined index: user_query in /var/www/test.php on line 11 The line of code this error is referring to is: $query = $_POST['user_query'];
  5. I think we are on the right track, but I am still getting some syntax errors. The code to my form is as follows: <form id="form1" name="form1" method="post" action=""> <p> <label for="user_query">Query:</label> <input type="text" name="user_query" id="user_query" /> </p> <p> <input type="submit" name="submit" id="submit" value="Submit" /> </p> </form> Am I still going about this wrong? And yes, I am fairly new to php/MySQL.
  6. First off, let me say that this will not be a public use site. We want to create a site that allows us to run queries in our database; this way we don't need to log into the MySQL server when ever we want to run a query. Basically, I am trying to create something as simple as a form with a text-input and a submit button. In this text-input, we will write a query (such as SELECT * FROM xxxx). When we hit submit, we would like to have the MySQL table printed out in a large textbox below. Our database has multiple tables, so something that works across the entire database seamlessly is key. Has anyone ever made anything like this? Is there another way to go about this? We really just want an easy way to run queries on the go. Thanks in advance to anyone who replies!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.